diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b3e855ec7..d2a9cb53a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 79.12.0 - 2024-09-18 +* [#1919](https://github.com/stripe/stripe-go/pull/1919) Update generated code + * Add support for new value `international_transaction` on enum `TreasuryReceivedDebitFailureCode` +* [#1918](https://github.com/stripe/stripe-go/pull/1918) Update generated code + * Add support for new value `verification_supportability` on enums `AccountFutureRequirementsErrorsCode`, `AccountRequirementsErrorsCode`, `BankAccountFutureRequirementsErrorsCode`, and `BankAccountRequirementsErrorsCode` + * Add support for new value `terminal_reader_invalid_location_for_activation` on enums `InvoiceLastFinalizationErrorCode`, `PaymentIntentLastPaymentErrorCode`, `SetupAttemptSetupErrorCode`, `SetupIntentLastSetupErrorCode`, and `StripeErrorCode` + * Add support for `PayerDetails` on `ChargePaymentMethodDetailsKlarna` + * Add support for `AmazonPay` on `DisputePaymentMethodDetails` + * Add support for new value `amazon_pay` on enum `DisputePaymentMethodDetailsType` + * Add support for `AutomaticallyFinalizesAt` on `Invoice` + * Add support for `StateSalesTax` on `TaxRegistrationCountryOptionsUsParams` and `TaxRegistrationCountryOptionsUs` + ## 79.12.0-beta.1 - 2024-09-13 * [#1911](https://github.com/stripe/stripe-go/pull/1911) Update generated code for beta * Add support for new resources `Issuing.DisputeSettlementDetail` and `Issuing.Settlement` @@ -9,6 +21,15 @@ * Add support for `Settlement` on `IssuingTransactionListParams` and `IssuingTransaction` * [#1915](https://github.com/stripe/stripe-go/pull/1915) Use pinned version of tools in Makefile and ci.yml (beta) +## 79.11.0 - 2024-09-12 +* [#1912](https://github.com/stripe/stripe-go/pull/1912) Update generated code + * Add support for new resource `InvoiceRenderingTemplate` + * Add support for `Archive`, `Get`, `List`, and `Unarchive` methods on resource `InvoiceRenderingTemplate` + * Add support for `Required` on `CheckoutSessionTaxIdCollectionParams`, `CheckoutSessionTaxIdCollection`, `PaymentLinkTaxIdCollectionParams`, and `PaymentLinkTaxIdCollection` + * Add support for `Template` on `CustomerInvoiceSettingsRenderingOptionsParams`, `CustomerInvoiceSettingsRenderingOptions`, `InvoiceRenderingParams`, and `InvoiceRendering` + * Add support for `TemplateVersion` on `InvoiceRenderingParams` and `InvoiceRendering` + * Add support for new value `submitted` on enum `IssuingCardShippingStatus` + ## 79.11.0-beta.1 - 2024-09-05 * [#1908](https://github.com/stripe/stripe-go/pull/1908) Update generated code for beta * Add support for new resources `Billing.MeterErrorReport` and `Terminal.ReaderCollectedData` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b39b96e379..5f5b311191 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1259 \ No newline at end of file +v1267 \ No newline at end of file diff --git a/accountsession.go b/accountsession.go index 821696ca86..991a9a2aa1 100644 --- a/accountsession.go +++ b/accountsession.go @@ -141,6 +141,10 @@ type AccountSessionComponentsFinancialAccountFeaturesParams struct { ExternalAccountCollection *bool `form:"external_account_collection"` // Whether to allow money movement features. MoneyMovement *bool `form:"money_movement"` + // Whether to allow sending money. + SendMoney *bool `form:"send_money"` + // Whether to allow transferring balance. + TransferBalance *bool `form:"transfer_balance"` } // Configuration for the financial account component. diff --git a/api_version.go b/api_version.go index d9aa27b04a..120303339b 100644 --- a/api_version.go +++ b/api_version.go @@ -8,5 +8,5 @@ package stripe const ( apiVersion string = "2024-06-20" - previewVersion string = "2024-09-05.preview-v2" + previewVersion string = "cs_ubb_launch" ) diff --git a/bankaccount.go b/bankaccount.go index 4f8ba10047..b5b7e2d45d 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -124,6 +124,7 @@ const ( BankAccountFutureRequirementsErrorCodeVerificationMissingOwners BankAccountFutureRequirementsErrorCode = "verification_missing_owners" BankAccountFutureRequirementsErrorCodeVerificationRequiresAdditionalMemorandumOfAssociations BankAccountFutureRequirementsErrorCode = "verification_requires_additional_memorandum_of_associations" BankAccountFutureRequirementsErrorCodeVerificationRequiresAdditionalProofOfRegistration BankAccountFutureRequirementsErrorCode = "verification_requires_additional_proof_of_registration" + BankAccountFutureRequirementsErrorCodeVerificationSupportability BankAccountFutureRequirementsErrorCode = "verification_supportability" ) // The code for the type of error. @@ -220,6 +221,7 @@ const ( BankAccountRequirementsErrorCodeVerificationMissingOwners BankAccountRequirementsErrorCode = "verification_missing_owners" BankAccountRequirementsErrorCodeVerificationRequiresAdditionalMemorandumOfAssociations BankAccountRequirementsErrorCode = "verification_requires_additional_memorandum_of_associations" BankAccountRequirementsErrorCodeVerificationRequiresAdditionalProofOfRegistration BankAccountRequirementsErrorCode = "verification_requires_additional_proof_of_registration" + BankAccountRequirementsErrorCodeVerificationSupportability BankAccountRequirementsErrorCode = "verification_supportability" ) // For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn't enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated. diff --git a/charge.go b/charge.go index e5c466e0c8..26cf70c5fd 100644 --- a/charge.go +++ b/charge.go @@ -1705,7 +1705,21 @@ type ChargePaymentMethodDetailsInteracPresent struct { // The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) Issuer string `json:"issuer"` } + +// The payer's address +type ChargePaymentMethodDetailsKlarnaPayerDetailsAddress struct { + // The payer address country + Country string `json:"country"` +} + +// The payer details for this transaction. +type ChargePaymentMethodDetailsKlarnaPayerDetails struct { + // The payer's address + Address *ChargePaymentMethodDetailsKlarnaPayerDetailsAddress `json:"address"` +} type ChargePaymentMethodDetailsKlarna struct { + // The payer details for this transaction. + PayerDetails *ChargePaymentMethodDetailsKlarnaPayerDetails `json:"payer_details"` // The Klarna payment method used for this transaction. // Can be one of `pay_later`, `pay_now`, `pay_with_financing`, or `pay_in_installments` PaymentMethodCategory ChargePaymentMethodDetailsKlarnaPaymentMethodCategory `json:"payment_method_category"` diff --git a/client/api.go b/client/api.go index 55275416a4..83a6a0554f 100644 --- a/client/api.go +++ b/client/api.go @@ -97,7 +97,6 @@ import ( "github.com/stripe/stripe-go/v79/productfeature" "github.com/stripe/stripe-go/v79/promotioncode" "github.com/stripe/stripe-go/v79/quote" - "github.com/stripe/stripe-go/v79/quotephase" "github.com/stripe/stripe-go/v79/quotepreviewinvoice" "github.com/stripe/stripe-go/v79/quotepreviewsubscriptionschedule" radarearlyfraudwarning "github.com/stripe/stripe-go/v79/radar/earlyfraudwarning" @@ -339,8 +338,6 @@ type API struct { Products *product.Client // PromotionCodes is the client used to invoke /promotion_codes APIs. PromotionCodes *promotioncode.Client - // QuotePhases is the client used to invoke /quote_phases APIs. - QuotePhases *quotephase.Client // QuotePreviewInvoices is the client used to invoke /quotes/{quote}/preview_invoices APIs. QuotePreviewInvoices *quotepreviewinvoice.Client // QuotePreviewSubscriptionSchedules is the client used to invoke /quotes/{quote}/preview_subscription_schedules APIs. @@ -568,7 +565,6 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.ProductFeatures = &productfeature.Client{B: backends.API, Key: key} a.Products = &product.Client{B: backends.API, Key: key} a.PromotionCodes = &promotioncode.Client{B: backends.API, Key: key} - a.QuotePhases = "ephase.Client{B: backends.API, Key: key} a.QuotePreviewInvoices = "epreviewinvoice.Client{B: backends.API, Key: key} a.QuotePreviewSubscriptionSchedules = "epreviewsubscriptionschedule.Client{B: backends.API, Key: key} a.Quotes = "e.Client{B: backends.API, BUploads: backends.Uploads, Key: key} diff --git a/dispute.go b/dispute.go index e33f3c10e0..76f31c6fc5 100644 --- a/dispute.go +++ b/dispute.go @@ -47,6 +47,15 @@ const ( DisputeEvidenceDetailsEnhancedEligibilityVisaCompellingEvidence3StatusRequiresAction DisputeEvidenceDetailsEnhancedEligibilityVisaCompellingEvidence3Status = "requires_action" ) +// The AmazonPay dispute type, chargeback or claim +type DisputePaymentMethodDetailsAmazonPayDisputeType string + +// List of values that DisputePaymentMethodDetailsAmazonPayDisputeType can take +const ( + DisputePaymentMethodDetailsAmazonPayDisputeTypeChargeback DisputePaymentMethodDetailsAmazonPayDisputeType = "chargeback" + DisputePaymentMethodDetailsAmazonPayDisputeTypeClaim DisputePaymentMethodDetailsAmazonPayDisputeType = "claim" +) + // The type of dispute opened. Different case types may have varying fees and financial impact. type DisputePaymentMethodDetailsCardCaseType string @@ -61,9 +70,10 @@ type DisputePaymentMethodDetailsType string // List of values that DisputePaymentMethodDetailsType can take const ( - DisputePaymentMethodDetailsTypeCard DisputePaymentMethodDetailsType = "card" - DisputePaymentMethodDetailsTypeKlarna DisputePaymentMethodDetailsType = "klarna" - DisputePaymentMethodDetailsTypePaypal DisputePaymentMethodDetailsType = "paypal" + DisputePaymentMethodDetailsTypeAmazonPay DisputePaymentMethodDetailsType = "amazon_pay" + DisputePaymentMethodDetailsTypeCard DisputePaymentMethodDetailsType = "card" + DisputePaymentMethodDetailsTypeKlarna DisputePaymentMethodDetailsType = "klarna" + DisputePaymentMethodDetailsTypePaypal DisputePaymentMethodDetailsType = "paypal" ) // Reason given by cardholder for dispute. Possible values are `bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Learn more about [dispute reasons](https://stripe.com/docs/disputes/categories). @@ -387,6 +397,10 @@ type DisputeEvidenceDetails struct { // The number of times evidence has been submitted. Typically, you may only submit evidence once. SubmissionCount int64 `json:"submission_count"` } +type DisputePaymentMethodDetailsAmazonPay struct { + // The AmazonPay dispute type, chargeback or claim + DisputeType DisputePaymentMethodDetailsAmazonPayDisputeType `json:"dispute_type"` +} type DisputePaymentMethodDetailsCard struct { // Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. Brand string `json:"brand"` @@ -406,9 +420,10 @@ type DisputePaymentMethodDetailsPaypal struct { ReasonCode string `json:"reason_code"` } type DisputePaymentMethodDetails struct { - Card *DisputePaymentMethodDetailsCard `json:"card"` - Klarna *DisputePaymentMethodDetailsKlarna `json:"klarna"` - Paypal *DisputePaymentMethodDetailsPaypal `json:"paypal"` + AmazonPay *DisputePaymentMethodDetailsAmazonPay `json:"amazon_pay"` + Card *DisputePaymentMethodDetailsCard `json:"card"` + Klarna *DisputePaymentMethodDetailsKlarna `json:"klarna"` + Paypal *DisputePaymentMethodDetailsPaypal `json:"paypal"` // Payment method type. Type DisputePaymentMethodDetailsType `json:"type"` } diff --git a/error.go b/error.go index 727cf59f76..41628a44d7 100644 --- a/error.go +++ b/error.go @@ -190,6 +190,7 @@ const ( ErrorCodeTerminalReaderBusy ErrorCode = "terminal_reader_busy" ErrorCodeTerminalReaderCollectedDataInvalid ErrorCode = "terminal_reader_collected_data_invalid" ErrorCodeTerminalReaderHardwareFault ErrorCode = "terminal_reader_hardware_fault" + ErrorCodeTerminalReaderInvalidLocationForActivation ErrorCode = "terminal_reader_invalid_location_for_activation" ErrorCodeTerminalReaderInvalidLocationForPayment ErrorCode = "terminal_reader_invalid_location_for_payment" ErrorCodeTerminalReaderOffline ErrorCode = "terminal_reader_offline" ErrorCodeTerminalReaderTimeout ErrorCode = "terminal_reader_timeout" diff --git a/invoice.go b/invoice.go index 9ca7d27348..666247fe2c 100644 --- a/invoice.go +++ b/invoice.go @@ -4927,8 +4927,10 @@ type Invoice struct { // Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users. Attempted bool `json:"attempted"` // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. - AutoAdvance bool `json:"auto_advance"` - AutomaticTax *InvoiceAutomaticTax `json:"automatic_tax"` + AutoAdvance bool `json:"auto_advance"` + // The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. + AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` + AutomaticTax *InvoiceAutomaticTax `json:"automatic_tax"` // Indicates the reason why the invoice was created. // // * `manual`: Unrelated to a subscription, for example, created via the invoice editor. diff --git a/invoicerenderingtemplate.go b/invoicerenderingtemplate.go index 9f038b6db4..e797719c45 100644 --- a/invoicerenderingtemplate.go +++ b/invoicerenderingtemplate.go @@ -65,6 +65,8 @@ func (p *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) } +// Invoice Rendering Templates are used to configure how invoices are rendered on surfaces like the PDF. Invoice Rendering Templates +// can be created from within the Dashboard, and they can be used over the API when creating invoices. type InvoiceRenderingTemplate struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/paymentlink.go b/paymentlink.go index 36cd3bfaa7..c5668bab46 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -161,6 +161,7 @@ const ( PaymentLinkPaymentMethodTypePayto PaymentLinkPaymentMethodType = "payto" PaymentLinkPaymentMethodTypePix PaymentLinkPaymentMethodType = "pix" PaymentLinkPaymentMethodTypePromptPay PaymentLinkPaymentMethodType = "promptpay" + PaymentLinkPaymentMethodTypeRechnung PaymentLinkPaymentMethodType = "rechnung" PaymentLinkPaymentMethodTypeSEPADebit PaymentLinkPaymentMethodType = "sepa_debit" PaymentLinkPaymentMethodTypeSofort PaymentLinkPaymentMethodType = "sofort" PaymentLinkPaymentMethodTypeSwish PaymentLinkPaymentMethodType = "swish" diff --git a/quotephase.go b/quotephase.go deleted file mode 100644 index 15b3aa2b9f..0000000000 --- a/quotephase.go +++ /dev/null @@ -1,165 +0,0 @@ -// -// -// File generated from our OpenAPI spec -// -// - -package stripe - -// If set to `reset`, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). -type QuotePhaseBillingCycleAnchor string - -// List of values that QuotePhaseBillingCycleAnchor can take -const ( - QuotePhaseBillingCycleAnchorReset QuotePhaseBillingCycleAnchor = "reset" -) - -// Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. -type QuotePhaseCollectionMethod string - -// List of values that QuotePhaseCollectionMethod can take -const ( - QuotePhaseCollectionMethodChargeAutomatically QuotePhaseCollectionMethod = "charge_automatically" - QuotePhaseCollectionMethodSendInvoice QuotePhaseCollectionMethod = "send_invoice" -) - -// If the quote will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. -type QuotePhaseProrationBehavior string - -// List of values that QuotePhaseProrationBehavior can take -const ( - QuotePhaseProrationBehaviorAlwaysInvoice QuotePhaseProrationBehavior = "always_invoice" - QuotePhaseProrationBehaviorCreateProrations QuotePhaseProrationBehavior = "create_prorations" - QuotePhaseProrationBehaviorNone QuotePhaseProrationBehavior = "none" -) - -// The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. -type QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason string - -// List of values that QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason can take -const ( - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" - QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" -) - -// Retrieves the quote phase with the given ID. -type QuotePhaseParams struct { - Params `form:"*"` - // Specifies which fields in the response should be expanded. - Expand []*string `form:"expand"` -} - -// AddExpand appends a new field to expand. -func (p *QuotePhaseParams) AddExpand(f string) { - p.Expand = append(p.Expand, &f) -} - -// When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. -type QuotePhaseListLineItemsParams struct { - ListParams `form:"*"` - QuotePhase *string `form:"-"` // Included in URL - // Specifies which fields in the response should be expanded. - Expand []*string `form:"expand"` -} - -// AddExpand appends a new field to expand. -func (p *QuotePhaseListLineItemsParams) AddExpand(f string) { - p.Expand = append(p.Expand, &f) -} - -// The invoice settings applicable during this phase. -type QuotePhaseInvoiceSettings struct { - // Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. - DaysUntilDue int64 `json:"days_until_due"` -} - -// The aggregated discounts. -type QuotePhaseTotalDetailsBreakdownDiscount struct { - // The amount discounted. - Amount int64 `json:"amount"` - // A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). - // It contains information about when the discount began, when it will end, and what it is applied to. - // - // Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) - Discount *Discount `json:"discount"` -} - -// The aggregated tax amounts by rate. -type QuotePhaseTotalDetailsBreakdownTax struct { - // Amount of tax applied for this rate. - Amount int64 `json:"amount"` - // Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. - // - // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) - Rate *TaxRate `json:"rate"` - // The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. - TaxabilityReason QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason `json:"taxability_reason"` - // The amount on which tax is calculated, in cents (or local equivalent). - TaxableAmount int64 `json:"taxable_amount"` -} -type QuotePhaseTotalDetailsBreakdown struct { - // The aggregated discounts. - Discounts []*QuotePhaseTotalDetailsBreakdownDiscount `json:"discounts"` - // The aggregated tax amounts by rate. - Taxes []*QuotePhaseTotalDetailsBreakdownTax `json:"taxes"` -} -type QuotePhaseTotalDetails struct { - // This is the sum of all the discounts. - AmountDiscount int64 `json:"amount_discount"` - // This is the sum of all the shipping amounts. - AmountShipping int64 `json:"amount_shipping"` - // This is the sum of all the tax amounts. - AmountTax int64 `json:"amount_tax"` - Breakdown *QuotePhaseTotalDetailsBreakdown `json:"breakdown"` -} - -// A quote phase describes the line items, coupons, and trialing status of a subscription for a predefined time period. -type QuotePhase struct { - APIResource - // Total before any discounts or taxes are applied. - AmountSubtotal int64 `json:"amount_subtotal"` - // Total after discounts and taxes are applied. - AmountTotal int64 `json:"amount_total"` - // If set to `reset`, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). - BillingCycleAnchor QuotePhaseBillingCycleAnchor `json:"billing_cycle_anchor"` - // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. - CollectionMethod QuotePhaseCollectionMethod `json:"collection_method"` - // The default tax rates to apply to the subscription during this phase of the quote. - DefaultTaxRates []*TaxRate `json:"default_tax_rates"` - // The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts. - Discounts []*Discount `json:"discounts"` - // The end of this phase of the quote - EndDate int64 `json:"end_date"` - // Unique identifier for the object. - ID string `json:"id"` - // The invoice settings applicable during this phase. - InvoiceSettings *QuotePhaseInvoiceSettings `json:"invoice_settings"` - // Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. - Iterations int64 `json:"iterations"` - // A list of items the customer is being quoted for. - LineItems *LineItemList `json:"line_items"` - // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on the subscription schedule's phases when the quote is accepted. - Metadata map[string]string `json:"metadata"` - // String representing the object's type. Objects of the same type share the same value. - Object string `json:"object"` - // If the quote will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. - ProrationBehavior QuotePhaseProrationBehavior `json:"proration_behavior"` - TotalDetails *QuotePhaseTotalDetails `json:"total_details"` - // If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees. - Trial bool `json:"trial"` - // When the trial ends within the phase. - TrialEnd int64 `json:"trial_end"` -} diff --git a/quotephase/client.go b/quotephase/client.go deleted file mode 100644 index cddcc82519..0000000000 --- a/quotephase/client.go +++ /dev/null @@ -1,81 +0,0 @@ -// -// -// File generated from our OpenAPI spec -// -// - -// Package quotephase provides the /quote_phases APIs -package quotephase - -import ( - "net/http" - - stripe "github.com/stripe/stripe-go/v79" - "github.com/stripe/stripe-go/v79/form" -) - -// Client is used to invoke /quote_phases APIs. -type Client struct { - B stripe.Backend - Key string -} - -// Retrieves the quote phase with the given ID. -func Get(id string, params *stripe.QuotePhaseParams) (*stripe.QuotePhase, error) { - return getC().Get(id, params) -} - -// Retrieves the quote phase with the given ID. -func (c Client) Get(id string, params *stripe.QuotePhaseParams) (*stripe.QuotePhase, error) { - path := stripe.FormatURLPath("/v1/quote_phases/%s", id) - quotephase := &stripe.QuotePhase{} - err := c.B.Call(http.MethodGet, path, c.Key, params, quotephase) - return quotephase, err -} - -// When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. -func ListLineItems(params *stripe.QuotePhaseListLineItemsParams) *LineItemIter { - return getC().ListLineItems(params) -} - -// When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. -func (c Client) ListLineItems(listParams *stripe.QuotePhaseListLineItemsParams) *LineItemIter { - path := stripe.FormatURLPath( - "/v1/quote_phases/%s/line_items", - stripe.StringValue(listParams.QuotePhase), - ) - return &LineItemIter{ - Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.LineItemList{} - err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list) - - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } - - return ret, list, err - }), - } -} - -// LineItemIter is an iterator for line items. -type LineItemIter struct { - *stripe.Iter -} - -// LineItem returns the line item which the iterator is currently pointing to. -func (i *LineItemIter) LineItem() *stripe.LineItem { - return i.Current().(*stripe.LineItem) -} - -// LineItemList returns the current list object which the iterator is -// currently using. List objects will change as new API calls are made to -// continue pagination. -func (i *LineItemIter) LineItemList() *stripe.LineItemList { - return i.List().(*stripe.LineItemList) -} - -func getC() Client { - return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} -} diff --git a/quotepreviewinvoice.go b/quotepreviewinvoice.go index 37946876fe..368e0455ec 100644 --- a/quotepreviewinvoice.go +++ b/quotepreviewinvoice.go @@ -758,8 +758,10 @@ type QuotePreviewInvoice struct { // Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. If a failure is returned with a non-retryable return code, the invoice can no longer be retried unless a new payment method is obtained. Retries will continue to be scheduled, and attempt_count will continue to increment, but retries will only be executed if a new payment method is obtained. AttemptCount int64 `json:"attempt_count"` // Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users. - Attempted bool `json:"attempted"` - AutomaticTax *QuotePreviewInvoiceAutomaticTax `json:"automatic_tax"` + Attempted bool `json:"attempted"` + // The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. + AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` + AutomaticTax *QuotePreviewInvoiceAutomaticTax `json:"automatic_tax"` // Indicates the reason why the invoice was created. // // * `manual`: Unrelated to a subscription, for example, created via the invoice editor. diff --git a/tax_registration.go b/tax_registration.go index 6ff44d5edf..9978bcb9fa 100644 --- a/tax_registration.go +++ b/tax_registration.go @@ -758,6 +758,16 @@ const ( TaxRegistrationCountryOptionsTRTypeSimplified TaxRegistrationCountryOptionsTRType = "simplified" ) +// The type of the election for the state sales tax registration. +type TaxRegistrationCountryOptionsUSStateSalesTaxElectionType string + +// List of values that TaxRegistrationCountryOptionsUSStateSalesTaxElectionType can take +const ( + TaxRegistrationCountryOptionsUSStateSalesTaxElectionTypeLocalUseTax TaxRegistrationCountryOptionsUSStateSalesTaxElectionType = "local_use_tax" + TaxRegistrationCountryOptionsUSStateSalesTaxElectionTypeSimplifiedSellersUseTax TaxRegistrationCountryOptionsUSStateSalesTaxElectionType = "simplified_sellers_use_tax" + TaxRegistrationCountryOptionsUSStateSalesTaxElectionTypeSingleLocalUseTax TaxRegistrationCountryOptionsUSStateSalesTaxElectionType = "single_local_use_tax" +) + // Type of registration in the US. type TaxRegistrationCountryOptionsUSType string @@ -1363,6 +1373,20 @@ type TaxRegistrationCountryOptionsUSLocalLeaseTaxParams struct { Jurisdiction *string `form:"jurisdiction"` } +// Elections for the state sales tax registration. +type TaxRegistrationCountryOptionsUSStateSalesTaxElectionParams struct { + // A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `003` (Allegheny County) and `60000` (Philadelphia City). + Jurisdiction *string `form:"jurisdiction"` + // The type of the election for the state sales tax registration. + Type *string `form:"type"` +} + +// Options for the state sales tax registration. +type TaxRegistrationCountryOptionsUSStateSalesTaxParams struct { + // Elections for the state sales tax registration. + Elections []*TaxRegistrationCountryOptionsUSStateSalesTaxElectionParams `form:"elections"` +} + // Options for the registration in US. type TaxRegistrationCountryOptionsUSParams struct { // Options for the local amusement tax registration. @@ -1371,6 +1395,8 @@ type TaxRegistrationCountryOptionsUSParams struct { LocalLeaseTax *TaxRegistrationCountryOptionsUSLocalLeaseTaxParams `form:"local_lease_tax"` // Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). State *string `form:"state"` + // Options for the state sales tax registration. + StateSalesTax *TaxRegistrationCountryOptionsUSStateSalesTaxParams `form:"state_sales_tax"` // Type of registration to be created in the US. Type *string `form:"type"` } @@ -1895,11 +1921,24 @@ type TaxRegistrationCountryOptionsUSLocalLeaseTax struct { // A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Jurisdiction string `json:"jurisdiction"` } + +// Elections for the state sales tax registration. +type TaxRegistrationCountryOptionsUSStateSalesTaxElection struct { + // A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. + Jurisdiction string `json:"jurisdiction"` + // The type of the election for the state sales tax registration. + Type TaxRegistrationCountryOptionsUSStateSalesTaxElectionType `json:"type"` +} +type TaxRegistrationCountryOptionsUSStateSalesTax struct { + // Elections for the state sales tax registration. + Elections []*TaxRegistrationCountryOptionsUSStateSalesTaxElection `json:"elections"` +} type TaxRegistrationCountryOptionsUS struct { LocalAmusementTax *TaxRegistrationCountryOptionsUSLocalAmusementTax `json:"local_amusement_tax"` LocalLeaseTax *TaxRegistrationCountryOptionsUSLocalLeaseTax `json:"local_lease_tax"` // Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). - State string `json:"state"` + State string `json:"state"` + StateSalesTax *TaxRegistrationCountryOptionsUSStateSalesTax `json:"state_sales_tax"` // Type of registration in the US. Type TaxRegistrationCountryOptionsUSType `json:"type"` } diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 2609904047..98baa98b74 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -11,10 +11,11 @@ type TreasuryReceivedDebitFailureCode string // List of values that TreasuryReceivedDebitFailureCode can take const ( - TreasuryReceivedDebitFailureCodeAccountClosed TreasuryReceivedDebitFailureCode = "account_closed" - TreasuryReceivedDebitFailureCodeAccountFrozen TreasuryReceivedDebitFailureCode = "account_frozen" - TreasuryReceivedDebitFailureCodeInsufficientFunds TreasuryReceivedDebitFailureCode = "insufficient_funds" - TreasuryReceivedDebitFailureCodeOther TreasuryReceivedDebitFailureCode = "other" + TreasuryReceivedDebitFailureCodeAccountClosed TreasuryReceivedDebitFailureCode = "account_closed" + TreasuryReceivedDebitFailureCodeAccountFrozen TreasuryReceivedDebitFailureCode = "account_frozen" + TreasuryReceivedDebitFailureCodeInsufficientFunds TreasuryReceivedDebitFailureCode = "insufficient_funds" + TreasuryReceivedDebitFailureCodeInternationalTransaction TreasuryReceivedDebitFailureCode = "international_transaction" + TreasuryReceivedDebitFailureCodeOther TreasuryReceivedDebitFailureCode = "other" ) // Set when `type` is `balance`.