diff --git a/billable_metric.go b/billable_metric.go index 1a33652..2e8af68 100644 --- a/billable_metric.go +++ b/billable_metric.go @@ -42,7 +42,6 @@ type BillableMetricInput struct { Recurring bool `json:"recurring,omitempty"` FieldName string `json:"field_name"` WeightedInterval WeightedInterval `json:"weighted_interval,omitempty"` - Group map[string]interface{} `json:"group,omitempty"` Filters []BillableMetricFilter `json:"filters,omitempty"` } @@ -72,7 +71,6 @@ type BillableMetric struct { FieldName string `json:"field_name"` CreatedAt time.Time `json:"created_at,omitempty"` WeightedInterval *WeightedInterval `json:"weighted_interval,omitempty"` - Group map[string]interface{} `json:"group,omitempty"` Filters []BillableMetricFilter `json:"filters,omitempty"` ActiveSubscriptionsCount int `json:"active_subscriptions_count,omitempty"` DraftInvoicesCount int `json:"draft_invoices_count,omitempty"` diff --git a/charge.go b/charge.go index 3b1109f..293dcea 100644 --- a/charge.go +++ b/charge.go @@ -35,14 +35,7 @@ type Charge struct { Prorated bool `json:"prorated,omitempty"` MinAmountCents int `json:"min_amount_cents,omitempty"` Properties map[string]interface{} `json:"properties,omitempty"` - GroupProperties []GroupProperties `json:"group_properties,omitempty"` Filters []ChargeFilter `json:"filters,omitempty"` Taxes []Tax `json:"tax,omitempty"` } - -type GroupProperties struct { - GroupID uuid.UUID `json:"group_id"` - Values map[string]interface{} `json:"values"` - InvoiceDisplayName string `json:"invoice_display_name,omitempty"` -} diff --git a/coupon.go b/coupon.go index 1678f6f..6b6535b 100644 --- a/coupon.go +++ b/coupon.go @@ -142,9 +142,8 @@ type AppliedCoupon struct { AmountCents int `json:"amount_cents,omitempty"` AmountCurrency Currency `json:"amount_currency,omitempty"` - ExpirationDate string `json:"expiration_date,omitempty"` - ExpirationAt time.Time `json:"expiration_at,omitempty"` - TerminatedAt time.Time `json:"terminated_at,omitempty"` + ExpirationAt time.Time `json:"expiration_at,omitempty"` + TerminatedAt time.Time `json:"terminated_at,omitempty"` PercentageRate float64 `json:"percentage_rate,omitempty,string"` Frequency CouponFrequency `json:"frequency,omitempty"` diff --git a/credit_note.go b/credit_note.go index ee9eb4d..9531c00 100644 --- a/credit_note.go +++ b/credit_note.go @@ -104,16 +104,6 @@ type CreditNote struct { UpdatedAt time.Time `json:"updated_at,omitempty"` Items []CreditNoteItem `json:"items,omitempty"` - - // Deprecated: Will be removed in the future - TotalAmountCurrency Currency `json:"total_amount_currency,omitempty"` - CreditAmountCurrency Currency `json:"credit_amount_currency,omitempty"` - BalanceAmountCurrency Currency `json:"balance_amount_currency,omitempty"` - RefundAmountCurrency Currency `json:"refund_amount_currency,omitempty"` - VatAmountCents int `json:"vat_amount_cents,omitempty"` - VatAmountCurrency Currency `json:"vat_amount_currency,omitempty"` - SubTotalVatExcludedAmountCents int `json:"sub_total_vat_excluded_amount_cents,omitempty"` - SubTotalVatExcludedAmountCurrency Currency `json:"sub_total_vat_excluded_amount_currency,omitempty"` } type CreditNoteEstimated struct { diff --git a/customer.go b/customer.go index 39bb7ba..88c8f7b 100644 --- a/customer.go +++ b/customer.go @@ -149,20 +149,10 @@ type CustomerChargeUsage struct { Charge *Charge `json:"charge,omitempty"` BillableMetric *BillableMetric `json:"billable_metric,omitempty"` - Groups []CustomerChargeGroupdUsage `json:"groups,omitempty"` Filters []CustomerChargeFilterUsage `json:"filters,omitempty"` GroupedUsage []CustomerChargeGroupedUsage `json:"grouped_usage,omitempty"` } -type CustomerChargeGroupdUsage struct { - LagoId string `json:"lago_id,omitempty"` - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - AmountCents int `json:"amount_cents,omitempty"` - EventsCount int `json:"events_count,omitempty"` - Units string `json:"units,omitempty"` -} - type CustomerChargeFilterUsage struct { InvoiceDisplayName string `json:"invoice_display_name,omitempty"` Values map[string]interface{} `json:"value,omitempty"` @@ -176,7 +166,6 @@ type CustomerChargeGroupedUsage struct { EventsCount int `json:"events_count,omitempty"` Units string `json:"units,omitempty"` GroupedBy map[string]interface{} `json:"grouped_by,omitempty"` - Groups []CustomerChargeGroupdUsage `json:"groups,omitempty"` Filters []CustomerChargeFilterUsage `json:"filters,omitempty"` } diff --git a/fee.go b/fee.go index 9006fbf..50fe9e5 100644 --- a/fee.go +++ b/fee.go @@ -81,7 +81,6 @@ type FeeItem struct { Code string `json:"code,omitempty"` Name string `json:"name,omitempty"` InvoiceDisplayName string `json:"invoice_display_name,omitempty"` - GroupInvoiceDisplayName string `json:"group_invoice_display_name,omitempty"` FilterInvoiceDisplayName string `json:"filter_invoice_display_name,omitempty"` Filters map[string]interface{} `json:"filters,omitempty"` LagoItemID uuid.UUID `json:"lago_item_id,omitempty"` @@ -104,7 +103,6 @@ type FeeAppliedTax struct { type Fee struct { LagoID uuid.UUID `json:"lago_id,omitempty"` - LagoGroupID uuid.UUID `json:"lago_group_id,omitempty"` LagoChargeFilterID uuid.UUID `json:"lago_charge_filter_id,omitempty"` LagoInvoiceID uuid.UUID `json:"lago_invoice_id,omitempty"` LagoTrueUpFeeID uuid.UUID `json:"lago_true_up_fee_id,omitempty"` @@ -113,7 +111,6 @@ type Fee struct { AmountCents int `json:"amount_cents,omitempty"` AmountDetails map[string]interface{} `json:"amount_details,omitempty"` - UnitAmountCents int `json:"unit_amount_cents,omitempty"` // deprecated PreciseUnitAmount string `json:"precise_unit_amount,omitempty"` AmountCurrency string `json:"amount_currency,omitempty"` TaxesAmountCents int `json:"taxes_amount_cents,omitempty"` diff --git a/group.go b/group.go deleted file mode 100644 index 81f71bb..0000000 --- a/group.go +++ /dev/null @@ -1,67 +0,0 @@ -package lago - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/google/uuid" -) - -type GroupRequest struct { - client *Client -} - -type GroupResult struct { - Groups []Group `json:"groups,omitempty"` - Meta Metadata `json:"meta,omitempty"` -} - -type GroupListInput struct { - PerPage int `json:"per_page,omitempty,string"` - Page int `json:"page,omitempty,string"` - Code string `json:"code,omitempty"` -} - -type Group struct { - LagoID uuid.UUID `json:"lago_id,omitempty"` - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` -} - -func (c *Client) Group() *GroupRequest { - return &GroupRequest{ - client: c, - } -} - -func (cr *GroupRequest) GetList(ctx context.Context, groupListInput *GroupListInput) (*GroupResult, *Error) { - jsonQueryParams, err := json.Marshal(groupListInput) - if err != nil { - return nil, &Error{Err: err} - } - - queryParams := make(map[string]string) - if err = json.Unmarshal(jsonQueryParams, &queryParams); err != nil { - return nil, &Error{Err: err} - } - - subPath := fmt.Sprintf("%s/%s/%s", "billable_metrics", groupListInput.Code, "groups") - clientRequest := &ClientRequest{ - Path: subPath, - QueryParams: queryParams, - Result: &GroupResult{}, - } - - result, clientErr := cr.client.Get(ctx, clientRequest) - if clientErr != nil { - return nil, clientErr - } - - groupResult, ok := result.(*GroupResult) - if !ok { - return nil, &ErrorTypeAssert - } - - return groupResult, nil -} diff --git a/invoice.go b/invoice.go index d802347..bac4c77 100644 --- a/invoice.go +++ b/invoice.go @@ -122,10 +122,10 @@ type InvoiceCredit struct { Invoice InvoiceSummary `json:"invoice,omitempty"` - LagoID uuid.UUID `json:"lago_id,omitempty"` + LagoItemID uuid.UUID `json:"lago_item_id,omitempty"` AmountCents int `json:"amount_cents,omitempty"` AmountCurrency Currency `json:"amount_currency,omitempty"` - BeforeVAT bool `json:"before_vat,omitempty"` + BeforeTaxes bool `json:"before_taxes,omitempty"` } type InvoiceAppliedTax struct { @@ -178,18 +178,6 @@ type Invoice struct { Fees []Fee `json:"fees,omitempty"` Credits []InvoiceCredit `json:"credits,omitempty"` AppliedTaxes []InvoiceAppliedTax `json:"applied_taxes,omitempty"` - - // Deprecated: Will be removed in the future - Legacy bool `json:"legacy,omitempty"` - AmountCurrency Currency `json:"amount_currency,omitempty"` - AmountCents int `json:"amount_cents,omitempty"` - CreditAmountCents int `json:"credit_amount_cents,omitempty"` - CreditAmountCurrency Currency `json:"credit_amount_currency,omitempty"` - TotalAmountCurrency Currency `json:"total_amount_currency,omitempty"` - VatAmountCents int `json:"vat_amount_cents,omitempty"` - VatAmountCurrency Currency `json:"vat_amount_currency,omitempty"` - SubTotalVatExcludedAmountCents int `json:"sub_total_vat_excluded_amount_cents,omitempty"` - SubTotalVatIncludedAmountCents int `json:"sub_total_vat_included_amount_cents,omitempty"` } type InvoicePaymentUrl struct { diff --git a/plan.go b/plan.go index 455a0e4..62f6b77 100644 --- a/plan.go +++ b/plan.go @@ -42,7 +42,6 @@ type PlanChargeInput struct { Prorated bool `json:"prorated,omitempty"` MinAmountCents int `json:"min_amount_cents,omitempty"` Properties map[string]interface{} `json:"properties"` - GroupProperties []GroupProperties `json:"group_properties,omitempty"` Filters []ChargeFilter `json:"filters,omitempty"` TaxCodes []string `json:"tax_codes,omitempty"` diff --git a/subscription.go b/subscription.go index a530b42..7f15fd0 100644 --- a/subscription.go +++ b/subscription.go @@ -45,7 +45,6 @@ type ChargeOverridesInput struct { InvoiceDisplayName string `json:"invoice_display_name,omitempty"` MinAmountCents int `json:"min_amount_cents,omitempty"` Properties map[string]interface{} `json:"properties"` - GroupProperties []GroupProperties `json:"group_properties,omitempty"` Filters []ChargeFilter `json:"filters,omitempty"` TaxCodes []string `json:"tax_codes,omitempty"` } diff --git a/wallet.go b/wallet.go index b09fcfc..991e38e 100644 --- a/wallet.go +++ b/wallet.go @@ -81,11 +81,10 @@ type Wallet struct { Name string `json:"name,omitempty"` RateAmount string `json:"rate_amount,omitempty"` CreditsBalance string `json:"credits_balance,omitempty"` - Balance string `json:"balance,omitempty"` // NOTE(legacy) BalanceCents int `json:"balance_cents,omitempty"` ConsumedCredits string `json:"consumed_credits,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` - ExpirationDate time.Time `json:"expiration_date,omitempty"` + ExpirationAt time.Time `json:"expiration_at,omitempty"` LastBalanceSyncAt time.Time `json:"last_balance_sync_at,omitempty"` LastConsumedCreditAt time.Time `json:"last_consumed_credit_at,omitempty"` TerminatedAt time.Time `json:"terminated_at,omitempty"`