diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 671f3aaa46..38c594702c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,10 @@ jobs: strategy: matrix: go: + - "1.23" + - "1.22" + - "1.21" + - "1.20" - "1.19" - "1.18" - "1.17" diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c650b038a..eb02ae465b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,16 @@ * Add support for new value `mb_way` on enum `PaymentLinkPaymentMethodTypes` * Remove support for `Rechnung` on `PaymentMethodParams` +## 79.10.0 - 2024-09-05 +* [#1906](https://github.com/stripe/stripe-go/pull/1906) Update generated code + * Add support for `SubscriptionItem` and `Subscription` on `BillingAlertFilterParams` + +## 79.9.0 - 2024-08-29 +* [#1910](https://github.com/stripe/stripe-go/pull/1910) Generate SDK for OpenAPI spec version 1230 + * Add support for new value `hr_oib` on enums `CheckoutSessionCustomerDetailsTaxIdsType`, `InvoiceCustomerTaxIdsType`, `TaxCalculationCustomerDetailsTaxIdsType`, `TaxIdType`, and `TaxTransactionCustomerDetailsTaxIdsType` + * Add support for new value `issuing_regulatory_reporting` on enum `FilePurpose` + * Add support for `StatusDetails` on `TestHelpersTestClock` + ## 79.9.0-beta.2 - 2024-08-22 * [#1907](https://github.com/stripe/stripe-go/pull/1907) Update generated code for beta * Add support for `MbWayPayments` on `AccountCapabilitiesParams` and `AccountCapabilities` @@ -29,20 +39,6 @@ * Add support for `CollectedInformation` on `CheckoutSessionParams` and `CheckoutSession` * Add support for `ShippingOptions` on `CheckoutSessionParams` -## 79.8.0-beta.1 - 2024-08-12 -* [#1900](https://github.com/stripe/stripe-go/pull/1900) Update generated code for beta - * Add support for `CapitalFinancingApplication` and `CapitalFinancing` on `AccountSessionComponents` - * Add support for `Payto` on `CheckoutSessionPaymentMethodOptionsParams` and `CheckoutSessionPaymentMethodOptions` - * Add support for new value `custom` on enum `CheckoutSessionUiMode` - * ⚠️ Remove support for `RiskCorrelationID` on `PaymentIntentConfirmPaymentMethodOptionsRechnungParams`, `PaymentIntentPaymentMethodOptionsRechnungParams`, and `PaymentIntentPaymentMethodOptionsRechnung` - * Add support for new value `payto` on enum `PaymentLinkPaymentMethodTypes` - -## 79.9.0 - 2024-08-29 -* [#1910](https://github.com/stripe/stripe-go/pull/1910) Generate SDK for OpenAPI spec version 1230 - * Add support for new value `hr_oib` on enums `CheckoutSessionCustomerDetailsTaxIdsType`, `InvoiceCustomerTaxIdsType`, `TaxCalculationCustomerDetailsTaxIdsType`, `TaxIdType`, and `TaxTransactionCustomerDetailsTaxIdsType` - * Add support for new value `issuing_regulatory_reporting` on enum `FilePurpose` - * Add support for `StatusDetails` on `TestHelpersTestClock` - ## 79.8.0 - 2024-08-15 * [#1904](https://github.com/stripe/stripe-go/pull/1904) Update generated code * Add support for `AuthorizationCode` on `ChargePaymentMethodDetailsCard` @@ -52,6 +48,14 @@ * Add support for `Chips` on `TreasuryOutboundPaymentTrackingDetailsUsDomesticWireParams`, `TreasuryOutboundPaymentTrackingDetailsUsDomesticWire`, `TreasuryOutboundTransferTrackingDetailsUsDomesticWireParams`, and `TreasuryOutboundTransferTrackingDetailsUsDomesticWire` * [#1903](https://github.com/stripe/stripe-go/pull/1903) Use pinned version of staticcheck +## 79.8.0-beta.1 - 2024-08-12 +* [#1900](https://github.com/stripe/stripe-go/pull/1900) Update generated code for beta + * Add support for `CapitalFinancingApplication` and `CapitalFinancing` on `AccountSessionComponents` + * Add support for `Payto` on `CheckoutSessionPaymentMethodOptionsParams` and `CheckoutSessionPaymentMethodOptions` + * Add support for new value `custom` on enum `CheckoutSessionUiMode` + * ⚠️ Remove support for `RiskCorrelationID` on `PaymentIntentConfirmPaymentMethodOptionsRechnungParams`, `PaymentIntentPaymentMethodOptionsRechnungParams`, and `PaymentIntentPaymentMethodOptionsRechnung` + * Add support for new value `payto` on enum `PaymentLinkPaymentMethodTypes` + ## 79.7.0 - 2024-08-08 * [#1899](https://github.com/stripe/stripe-go/pull/1899) Update generated code * Add support for `Activate`, `Archive`, `Deactivate`, `Get`, `List`, and `New` methods on resource `Billing.Alert` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b7ea530dbb..b39b96e379 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1247 \ No newline at end of file +v1259 \ No newline at end of file diff --git a/checkout_session.go b/checkout_session.go index a88120b2bd..e75ba68c93 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -1055,6 +1055,15 @@ const ( CheckoutSessionSubmitTypePay CheckoutSessionSubmitType = "pay" ) +// Indicates whether a tax ID is required on the payment page +type CheckoutSessionTaxIDCollectionRequired string + +// List of values that CheckoutSessionTaxIDCollectionRequired can take +const ( + CheckoutSessionTaxIDCollectionRequiredIfSupported CheckoutSessionTaxIDCollectionRequired = "if_supported" + CheckoutSessionTaxIDCollectionRequiredNever CheckoutSessionTaxIDCollectionRequired = "never" +) + // 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 CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason string @@ -2311,6 +2320,8 @@ func (p *CheckoutSessionSubscriptionDataParams) AddMetadata(key string, value st type CheckoutSessionTaxIDCollectionParams struct { // Enable tax ID collection during checkout. Defaults to `false`. Enabled *bool `form:"enabled"` + // Describes whether a tax ID is required during checkout. Defaults to `never`. + Required *string `form:"required"` } // Creates a Session object. @@ -3309,6 +3320,8 @@ type CheckoutSessionShippingOption struct { type CheckoutSessionTaxIDCollection struct { // Indicates whether tax ID collection is enabled for the session Enabled bool `json:"enabled"` + // Indicates whether a tax ID is required on the payment page + Required CheckoutSessionTaxIDCollectionRequired `json:"required"` } // The aggregated discounts. diff --git a/client/api.go b/client/api.go index ce9039295f..55275416a4 100644 --- a/client/api.go +++ b/client/api.go @@ -67,11 +67,13 @@ import ( "github.com/stripe/stripe-go/v79/invoiceitem" "github.com/stripe/stripe-go/v79/invoicelineitem" "github.com/stripe/stripe-go/v79/invoicepayment" + "github.com/stripe/stripe-go/v79/invoicerenderingtemplate" issuingauthorization "github.com/stripe/stripe-go/v79/issuing/authorization" issuingcard "github.com/stripe/stripe-go/v79/issuing/card" issuingcardholder "github.com/stripe/stripe-go/v79/issuing/cardholder" issuingcreditunderwritingrecord "github.com/stripe/stripe-go/v79/issuing/creditunderwritingrecord" issuingdispute "github.com/stripe/stripe-go/v79/issuing/dispute" + issuingdisputesettlementdetail "github.com/stripe/stripe-go/v79/issuing/disputesettlementdetail" issuingpersonalizationdesign "github.com/stripe/stripe-go/v79/issuing/personalizationdesign" issuingphysicalbundle "github.com/stripe/stripe-go/v79/issuing/physicalbundle" issuingtoken "github.com/stripe/stripe-go/v79/issuing/token" @@ -277,6 +279,8 @@ type API struct { InvoiceLineItems *invoicelineitem.Client // InvoicePayments is the client used to invoke /invoices/{invoice}/payments APIs. InvoicePayments *invoicepayment.Client + // InvoiceRenderingTemplates is the client used to invoke /invoice_rendering_templates APIs. + InvoiceRenderingTemplates *invoicerenderingtemplate.Client // Invoices is the client used to invoke /invoices APIs. Invoices *invoice.Client // IssuingAuthorizations is the client used to invoke /issuing/authorizations APIs. @@ -289,6 +293,8 @@ type API struct { IssuingCreditUnderwritingRecords *issuingcreditunderwritingrecord.Client // IssuingDisputes is the client used to invoke /issuing/disputes APIs. IssuingDisputes *issuingdispute.Client + // IssuingDisputeSettlementDetails is the client used to invoke /issuing/dispute_settlement_details APIs. + IssuingDisputeSettlementDetails *issuingdisputesettlementdetail.Client // IssuingPersonalizationDesigns is the client used to invoke /issuing/personalization_designs APIs. IssuingPersonalizationDesigns *issuingpersonalizationdesign.Client // IssuingPhysicalBundles is the client used to invoke /issuing/physical_bundles APIs. @@ -532,12 +538,14 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.InvoiceItems = &invoiceitem.Client{B: backends.API, Key: key} a.InvoiceLineItems = &invoicelineitem.Client{B: backends.API, Key: key} a.InvoicePayments = &invoicepayment.Client{B: backends.API, Key: key} + a.InvoiceRenderingTemplates = &invoicerenderingtemplate.Client{B: backends.API, Key: key} a.Invoices = &invoice.Client{B: backends.API, Key: key} a.IssuingAuthorizations = &issuingauthorization.Client{B: backends.API, Key: key} a.IssuingCardholders = &issuingcardholder.Client{B: backends.API, Key: key} a.IssuingCards = &issuingcard.Client{B: backends.API, Key: key} a.IssuingCreditUnderwritingRecords = &issuingcreditunderwritingrecord.Client{B: backends.API, Key: key} a.IssuingDisputes = &issuingdispute.Client{B: backends.API, Key: key} + a.IssuingDisputeSettlementDetails = &issuingdisputesettlementdetail.Client{B: backends.API, Key: key} a.IssuingPersonalizationDesigns = &issuingpersonalizationdesign.Client{B: backends.API, Key: key} a.IssuingPhysicalBundles = &issuingphysicalbundle.Client{B: backends.API, Key: key} a.IssuingTokens = &issuingtoken.Client{B: backends.API, Key: key} diff --git a/customer.go b/customer.go index 37a7746776..4958a6eddd 100644 --- a/customer.go +++ b/customer.go @@ -133,6 +133,8 @@ type CustomerInvoiceSettingsCustomFieldParams struct { type CustomerInvoiceSettingsRenderingOptionsParams struct { // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. AmountTaxDisplay *string `form:"amount_tax_display"` + // ID of the invoice rendering template to use for future invoices. + Template *string `form:"template"` } // Default invoice settings for this customer. @@ -295,6 +297,8 @@ type CustomerInvoiceSettingsCustomField struct { type CustomerInvoiceSettingsRenderingOptions struct { // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. AmountTaxDisplay string `json:"amount_tax_display"` + // ID of the invoice rendering template to be used for this customer's invoices. If set, the template will be used on all invoices for this customer unless a template is set directly on the invoice. + Template string `json:"template"` } type CustomerInvoiceSettings struct { // Default custom fields to be displayed on invoices for this customer. diff --git a/event.go b/event.go index bd6bd51c4c..566135b165 100644 --- a/event.go +++ b/event.go @@ -166,10 +166,14 @@ const ( EventTypeIssuingDisputeFundsRescinded EventType = "issuing_dispute.funds_rescinded" EventTypeIssuingDisputeSubmitted EventType = "issuing_dispute.submitted" EventTypeIssuingDisputeUpdated EventType = "issuing_dispute.updated" + EventTypeIssuingDisputeSettlementDetailCreated EventType = "issuing_dispute_settlement_detail.created" + EventTypeIssuingDisputeSettlementDetailUpdated EventType = "issuing_dispute_settlement_detail.updated" EventTypeIssuingPersonalizationDesignActivated EventType = "issuing_personalization_design.activated" EventTypeIssuingPersonalizationDesignDeactivated EventType = "issuing_personalization_design.deactivated" EventTypeIssuingPersonalizationDesignRejected EventType = "issuing_personalization_design.rejected" EventTypeIssuingPersonalizationDesignUpdated EventType = "issuing_personalization_design.updated" + EventTypeIssuingSettlementCreated EventType = "issuing_settlement.created" + EventTypeIssuingSettlementUpdated EventType = "issuing_settlement.updated" EventTypeIssuingTokenCreated EventType = "issuing_token.created" EventTypeIssuingTokenUpdated EventType = "issuing_token.updated" EventTypeIssuingTransactionCreated EventType = "issuing_transaction.created" diff --git a/invoice.go b/invoice.go index c002496f4f..9ca7d27348 100644 --- a/invoice.go +++ b/invoice.go @@ -580,6 +580,10 @@ type InvoiceRenderingParams struct { AmountTaxDisplay *string `form:"amount_tax_display"` // Invoice pdf rendering options PDF *InvoiceRenderingPDFParams `form:"pdf"` + // ID of the invoice rendering template to use for this invoice. + Template *string `form:"template"` + // The specific version of invoice rendering template to use for this invoice. + TemplateVersion *int64 `form:"template_version"` } // The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. @@ -4751,6 +4755,10 @@ type InvoiceRendering struct { AmountTaxDisplay string `json:"amount_tax_display"` // Invoice pdf rendering options PDF *InvoiceRenderingPDF `json:"pdf"` + // ID of the rendering template that the invoice is formatted by. + Template string `json:"template"` + // Version of the rendering template that the invoice is using. + TemplateVersion int64 `json:"template_version"` } // The taxes applied to the shipping rate. diff --git a/invoicerenderingtemplate.go b/invoicerenderingtemplate.go new file mode 100644 index 0000000000..9f038b6db4 --- /dev/null +++ b/invoicerenderingtemplate.go @@ -0,0 +1,93 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +// The status of the template, one of `active` or `archived`. +type InvoiceRenderingTemplateStatus string + +// List of values that InvoiceRenderingTemplateStatus can take +const ( + InvoiceRenderingTemplateStatusActive InvoiceRenderingTemplateStatus = "active" + InvoiceRenderingTemplateStatusArchived InvoiceRenderingTemplateStatus = "archived" +) + +// List all templates, ordered by creation date, with the most recently created template appearing first. +type InvoiceRenderingTemplateListParams struct { + ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + Status *string `form:"status"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceRenderingTemplateListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. +type InvoiceRenderingTemplateParams struct { + Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + Version *int64 `form:"version"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceRenderingTemplateParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. +type InvoiceRenderingTemplateArchiveParams 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 *InvoiceRenderingTemplateArchiveParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// Unarchive an invoice rendering template so it can be used on new Stripe objects again. +type InvoiceRenderingTemplateUnarchiveParams 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 *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +type InvoiceRenderingTemplate struct { + APIResource + // Time at which the object was created. Measured in seconds since the Unix epoch. + Created int64 `json:"created"` + // Unique identifier for the object. + ID string `json:"id"` + // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + Livemode bool `json:"livemode"` + // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + Metadata map[string]string `json:"metadata"` + // A brief description of the template, hidden from customers + Nickname string `json:"nickname"` + // String representing the object's type. Objects of the same type share the same value. + Object string `json:"object"` + // The status of the template, one of `active` or `archived`. + Status InvoiceRenderingTemplateStatus `json:"status"` + // Version of this template; version increases by one when an update on the template changes any field that controls invoice rendering + Version int64 `json:"version"` +} + +// InvoiceRenderingTemplateList is a list of InvoiceRenderingTemplates as retrieved from a list endpoint. +type InvoiceRenderingTemplateList struct { + APIResource + ListMeta + Data []*InvoiceRenderingTemplate `json:"data"` +} diff --git a/invoicerenderingtemplate/client.go b/invoicerenderingtemplate/client.go new file mode 100644 index 0000000000..bd77ff5f1a --- /dev/null +++ b/invoicerenderingtemplate/client.go @@ -0,0 +1,118 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package invoicerenderingtemplate provides the /invoice_rendering_templates APIs +package invoicerenderingtemplate + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v79" + "github.com/stripe/stripe-go/v79/form" +) + +// Client is used to invoke /invoice_rendering_templates APIs. +type Client struct { + B stripe.Backend + Key string +} + +// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. +func Get(id string, params *stripe.InvoiceRenderingTemplateParams) (*stripe.InvoiceRenderingTemplate, error) { + return getC().Get(id, params) +} + +// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. +func (c Client) Get(id string, params *stripe.InvoiceRenderingTemplateParams) (*stripe.InvoiceRenderingTemplate, error) { + path := stripe.FormatURLPath("/v1/invoice_rendering_templates/%s", id) + invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} + err := c.B.Call(http.MethodGet, path, c.Key, params, invoicerenderingtemplate) + return invoicerenderingtemplate, err +} + +// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. +func Archive(id string, params *stripe.InvoiceRenderingTemplateArchiveParams) (*stripe.InvoiceRenderingTemplate, error) { + return getC().Archive(id, params) +} + +// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. +func (c Client) Archive(id string, params *stripe.InvoiceRenderingTemplateArchiveParams) (*stripe.InvoiceRenderingTemplate, error) { + path := stripe.FormatURLPath("/v1/invoice_rendering_templates/%s/archive", id) + invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} + err := c.B.Call( + http.MethodPost, + path, + c.Key, + params, + invoicerenderingtemplate, + ) + return invoicerenderingtemplate, err +} + +// Unarchive an invoice rendering template so it can be used on new Stripe objects again. +func Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams) (*stripe.InvoiceRenderingTemplate, error) { + return getC().Unarchive(id, params) +} + +// Unarchive an invoice rendering template so it can be used on new Stripe objects again. +func (c Client) Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams) (*stripe.InvoiceRenderingTemplate, error) { + path := stripe.FormatURLPath( + "/v1/invoice_rendering_templates/%s/unarchive", + id, + ) + invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} + err := c.B.Call( + http.MethodPost, + path, + c.Key, + params, + invoicerenderingtemplate, + ) + return invoicerenderingtemplate, err +} + +// List all templates, ordered by creation date, with the most recently created template appearing first. +func List(params *stripe.InvoiceRenderingTemplateListParams) *Iter { + return getC().List(params) +} + +// List all templates, ordered by creation date, with the most recently created template appearing first. +func (c Client) List(listParams *stripe.InvoiceRenderingTemplateListParams) *Iter { + return &Iter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.InvoiceRenderingTemplateList{} + err := c.B.CallRaw(http.MethodGet, "/v1/invoice_rendering_templates", c.Key, b, p, list) + + ret := make([]interface{}, len(list.Data)) + for i, v := range list.Data { + ret[i] = v + } + + return ret, list, err + }), + } +} + +// Iter is an iterator for invoice rendering templates. +type Iter struct { + *stripe.Iter +} + +// InvoiceRenderingTemplate returns the invoice rendering template which the iterator is currently pointing to. +func (i *Iter) InvoiceRenderingTemplate() *stripe.InvoiceRenderingTemplate { + return i.Current().(*stripe.InvoiceRenderingTemplate) +} + +// InvoiceRenderingTemplateList 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 *Iter) InvoiceRenderingTemplateList() *stripe.InvoiceRenderingTemplateList { + return i.List().(*stripe.InvoiceRenderingTemplateList) +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/issuing/disputesettlementdetail/client.go b/issuing/disputesettlementdetail/client.go new file mode 100644 index 0000000000..a83f4ffa2b --- /dev/null +++ b/issuing/disputesettlementdetail/client.go @@ -0,0 +1,77 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package disputesettlementdetail provides the /issuing/dispute_settlement_details APIs +package disputesettlementdetail + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v79" + "github.com/stripe/stripe-go/v79/form" +) + +// Client is used to invoke /issuing/dispute_settlement_details APIs. +type Client struct { + B stripe.Backend + Key string +} + +// Retrieves an Issuing DisputeSettlementDetail object. +func Get(id string, params *stripe.IssuingDisputeSettlementDetailParams) (*stripe.IssuingDisputeSettlementDetail, error) { + return getC().Get(id, params) +} + +// Retrieves an Issuing DisputeSettlementDetail object. +func (c Client) Get(id string, params *stripe.IssuingDisputeSettlementDetailParams) (*stripe.IssuingDisputeSettlementDetail, error) { + path := stripe.FormatURLPath("/v1/issuing/dispute_settlement_details/%s", id) + disputesettlementdetail := &stripe.IssuingDisputeSettlementDetail{} + err := c.B.Call(http.MethodGet, path, c.Key, params, disputesettlementdetail) + return disputesettlementdetail, err +} + +// Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. +func List(params *stripe.IssuingDisputeSettlementDetailListParams) *Iter { + return getC().List(params) +} + +// Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. +func (c Client) List(listParams *stripe.IssuingDisputeSettlementDetailListParams) *Iter { + return &Iter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.IssuingDisputeSettlementDetailList{} + err := c.B.CallRaw(http.MethodGet, "/v1/issuing/dispute_settlement_details", c.Key, b, p, list) + + ret := make([]interface{}, len(list.Data)) + for i, v := range list.Data { + ret[i] = v + } + + return ret, list, err + }), + } +} + +// Iter is an iterator for issuing dispute settlement details. +type Iter struct { + *stripe.Iter +} + +// IssuingDisputeSettlementDetail returns the issuing dispute settlement detail which the iterator is currently pointing to. +func (i *Iter) IssuingDisputeSettlementDetail() *stripe.IssuingDisputeSettlementDetail { + return i.Current().(*stripe.IssuingDisputeSettlementDetail) +} + +// IssuingDisputeSettlementDetailList 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 *Iter) IssuingDisputeSettlementDetailList() *stripe.IssuingDisputeSettlementDetailList { + return i.List().(*stripe.IssuingDisputeSettlementDetailList) +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/issuing_card.go b/issuing_card.go index 5f7fc53de1..c69bb47221 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -81,6 +81,7 @@ const ( IssuingCardShippingStatusPending IssuingCardShippingStatus = "pending" IssuingCardShippingStatusReturned IssuingCardShippingStatus = "returned" IssuingCardShippingStatusShipped IssuingCardShippingStatus = "shipped" + IssuingCardShippingStatusSubmitted IssuingCardShippingStatus = "submitted" ) // Packaging options. diff --git a/issuing_disputesettlementdetail.go b/issuing_disputesettlementdetail.go new file mode 100644 index 0000000000..d5992004cd --- /dev/null +++ b/issuing_disputesettlementdetail.go @@ -0,0 +1,88 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +// The type of event corresponding to this dispute settlement detail, representing the stage in the dispute network lifecycle. +type IssuingDisputeSettlementDetailEventType string + +// List of values that IssuingDisputeSettlementDetailEventType can take +const ( + IssuingDisputeSettlementDetailEventTypeFiling IssuingDisputeSettlementDetailEventType = "filing" + IssuingDisputeSettlementDetailEventTypeLoss IssuingDisputeSettlementDetailEventType = "loss" + IssuingDisputeSettlementDetailEventTypeRepresentment IssuingDisputeSettlementDetailEventType = "representment" + IssuingDisputeSettlementDetailEventTypeWin IssuingDisputeSettlementDetailEventType = "win" +) + +// The card network for this dispute settlement detail. One of ["visa", "mastercard", "maestro"] +type IssuingDisputeSettlementDetailNetwork string + +// List of values that IssuingDisputeSettlementDetailNetwork can take +const ( + IssuingDisputeSettlementDetailNetworkMaestro IssuingDisputeSettlementDetailNetwork = "maestro" + IssuingDisputeSettlementDetailNetworkMastercard IssuingDisputeSettlementDetailNetwork = "mastercard" + IssuingDisputeSettlementDetailNetworkVisa IssuingDisputeSettlementDetailNetwork = "visa" +) + +// Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. +type IssuingDisputeSettlementDetailListParams struct { + ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + // Select the Issuing dispute settlement details for the given settlement. + Settlement *string `form:"settlement"` +} + +// AddExpand appends a new field to expand. +func (p *IssuingDisputeSettlementDetailListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// Retrieves an Issuing DisputeSettlementDetail object. +type IssuingDisputeSettlementDetailParams 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 *IssuingDisputeSettlementDetailParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// Represents a record from the card network of a money movement or change in state for an Issuing dispute. These records are included in the settlement reports that we receive from networks and expose to users as Settlement objects. +type IssuingDisputeSettlementDetail struct { + APIResource + // Disputed amount in the card's currency and in the smallest currency unit. Usually the amount of the transaction, but can differ (usually because of currency fluctuation). + Amount int64 `json:"amount"` + // The card used to make the original transaction. + Card string `json:"card"` + // Time at which the object was created. Measured in seconds since the Unix epoch. + Created int64 `json:"created"` + // The currency the original transaction was made in. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + Currency Currency `json:"currency"` + // The ID of the linked dispute. + Dispute string `json:"dispute"` + // The type of event corresponding to this dispute settlement detail, representing the stage in the dispute network lifecycle. + EventType IssuingDisputeSettlementDetailEventType `json:"event_type"` + // Unique identifier for the object. + ID string `json:"id"` + // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + Livemode bool `json:"livemode"` + // The card network for this dispute settlement detail. One of ["visa", "mastercard", "maestro"] + Network IssuingDisputeSettlementDetailNetwork `json:"network"` + // String representing the object's type. Objects of the same type share the same value. + Object string `json:"object"` + // The ID of the linked card network settlement. + Settlement string `json:"settlement"` +} + +// IssuingDisputeSettlementDetailList is a list of DisputeSettlementDetails as retrieved from a list endpoint. +type IssuingDisputeSettlementDetailList struct { + APIResource + ListMeta + Data []*IssuingDisputeSettlementDetail `json:"data"` +} diff --git a/issuing_settlement.go b/issuing_settlement.go new file mode 100644 index 0000000000..389c1c41d6 --- /dev/null +++ b/issuing_settlement.go @@ -0,0 +1,84 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +import "encoding/json" + +// The card network for this settlement report. One of ["visa", "maestro"] +type IssuingSettlementNetwork string + +// List of values that IssuingSettlementNetwork can take +const ( + IssuingSettlementNetworkMaestro IssuingSettlementNetwork = "maestro" + IssuingSettlementNetworkVisa IssuingSettlementNetwork = "visa" +) + +// The current processing status of this settlement. +type IssuingSettlementStatus string + +// List of values that IssuingSettlementStatus can take +const ( + IssuingSettlementStatusComplete IssuingSettlementStatus = "complete" + IssuingSettlementStatusPending IssuingSettlementStatus = "pending" +) + +// When a non-stripe BIN is used, any use of an [issued card](https://stripe.com/docs/issuing) must be settled directly with the card network. The net amount owed is represented by an Issuing `Settlement` object. +type IssuingSettlement struct { + // The Bank Identification Number reflecting this settlement record. + Bin string `json:"bin"` + // The date that the transactions are cleared and posted to user's accounts. + ClearingDate int64 `json:"clearing_date"` + // Time at which the object was created. Measured in seconds since the Unix epoch. + Created int64 `json:"created"` + // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + Currency Currency `json:"currency"` + // Unique identifier for the object. + ID string `json:"id"` + // The total interchange received as reimbursement for the transactions. + InterchangeFees int64 `json:"interchange_fees"` + // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + Livemode bool `json:"livemode"` + // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + Metadata map[string]string `json:"metadata"` + // The total net amount required to settle with the network. + NetTotal int64 `json:"net_total"` + // The card network for this settlement report. One of ["visa", "maestro"] + Network IssuingSettlementNetwork `json:"network"` + // The total amount of fees owed to the network. + NetworkFees int64 `json:"network_fees"` + // The Settlement Identification Number assigned by the network. + NetworkSettlementIdentifier string `json:"network_settlement_identifier"` + // String representing the object's type. Objects of the same type share the same value. + Object string `json:"object"` + // One of `international` or `uk_national_net`. + SettlementService string `json:"settlement_service"` + // The current processing status of this settlement. + Status IssuingSettlementStatus `json:"status"` + // The total number of transactions reflected in this settlement. + TransactionCount int64 `json:"transaction_count"` + // The total transaction amount reflected in this settlement. + TransactionVolume int64 `json:"transaction_volume"` +} + +// UnmarshalJSON handles deserialization of an IssuingSettlement. +// This custom unmarshaling is needed because the resulting +// property may be an id or the full struct if it was expanded. +func (i *IssuingSettlement) UnmarshalJSON(data []byte) error { + if id, ok := ParseID(data); ok { + i.ID = id + return nil + } + + type issuingSettlement IssuingSettlement + var v issuingSettlement + if err := json.Unmarshal(data, &v); err != nil { + return err + } + + *i = IssuingSettlement(v) + return nil +} diff --git a/issuing_transaction.go b/issuing_transaction.go index afc1b7839f..e1dcdb3590 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -67,6 +67,8 @@ type IssuingTransactionListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` + // Only return transactions that are associated with the given settlement. + Settlement *string `form:"settlement"` // Only return transactions that have the given type. One of `capture` or `refund`. Type *string `form:"type"` } @@ -303,6 +305,7 @@ type IssuingTransaction struct { Object string `json:"object"` // Additional purchase information that is optionally provided by the merchant. PurchaseDetails *IssuingTransactionPurchaseDetails `json:"purchase_details"` + Settlement *IssuingSettlement `json:"settlement"` // [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null. Token *IssuingToken `json:"token"` // [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts diff --git a/paymentlink.go b/paymentlink.go index be8bba5c7e..36cd3bfaa7 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -200,6 +200,14 @@ const ( PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethodPause PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod = "pause" ) +type PaymentLinkTaxIDCollectionRequired string + +// List of values that PaymentLinkTaxIDCollectionRequired can take +const ( + PaymentLinkTaxIDCollectionRequiredIfSupported PaymentLinkTaxIDCollectionRequired = "if_supported" + PaymentLinkTaxIDCollectionRequiredNever PaymentLinkTaxIDCollectionRequired = "never" +) + // Returns a list of your payment links. type PaymentLinkListParams struct { ListParams `form:"*"` @@ -568,6 +576,8 @@ func (p *PaymentLinkSubscriptionDataParams) AddMetadata(key string, value string type PaymentLinkTaxIDCollectionParams struct { // Enable tax ID collection during checkout. Defaults to `false`. Enabled *bool `form:"enabled"` + // Describes whether a tax ID is required during checkout. Defaults to `never`. + Required *string `form:"required"` } // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. @@ -932,7 +942,8 @@ type PaymentLinkSubscriptionData struct { } type PaymentLinkTaxIDCollection struct { // Indicates whether tax ID collection is enabled for the session. - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` + Required PaymentLinkTaxIDCollectionRequired `json:"required"` } // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. diff --git a/quote.go b/quote.go index 76a5027296..b209c5c843 100644 --- a/quote.go +++ b/quote.go @@ -393,7 +393,7 @@ type QuoteDiscountDiscountEndParams struct { Type *string `form:"type"` } -// The discounts applied to the quote. You can only set up to one discount. +// The discounts applied to the quote. type QuoteDiscountParams struct { // ID of the coupon to create a new discount for. Coupon *string `form:"coupon"` @@ -1045,7 +1045,7 @@ type QuoteParams struct { DefaultTaxRates []*string `form:"default_tax_rates"` // A description that will be displayed on the quote PDF. If no value is passed, the default description configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. Description *string `form:"description"` - // The discounts applied to the quote. You can only set up to one discount. + // The discounts applied to the quote. Discounts []*QuoteDiscountParams `form:"discounts"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/quotephase.go b/quotephase.go index 6e6a1f15f1..15b3aa2b9f 100644 --- a/quotephase.go +++ b/quotephase.go @@ -55,20 +55,6 @@ const ( QuotePhaseTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuotePhaseTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" ) -// Returns a list of quote phases. -type QuotePhaseListParams struct { - ListParams `form:"*"` - // Specifies which fields in the response should be expanded. - Expand []*string `form:"expand"` - // The ID of the quote whose phases will be retrieved. - Quote *string `form:"quote"` -} - -// AddExpand appends a new field to expand. -func (p *QuotePhaseListParams) AddExpand(f string) { - p.Expand = append(p.Expand, &f) -} - // Retrieves the quote phase with the given ID. type QuotePhaseParams struct { Params `form:"*"` @@ -177,10 +163,3 @@ type QuotePhase struct { // When the trial ends within the phase. TrialEnd int64 `json:"trial_end"` } - -// QuotePhaseList is a list of QuotePhases as retrieved from a list endpoint. -type QuotePhaseList struct { - APIResource - ListMeta - Data []*QuotePhase `json:"data"` -} diff --git a/quotephase/client.go b/quotephase/client.go index d4c8fa0516..cddcc82519 100644 --- a/quotephase/client.go +++ b/quotephase/client.go @@ -33,45 +33,6 @@ func (c Client) Get(id string, params *stripe.QuotePhaseParams) (*stripe.QuotePh return quotephase, err } -// Returns a list of quote phases. -func List(params *stripe.QuotePhaseListParams) *Iter { - return getC().List(params) -} - -// Returns a list of quote phases. -func (c Client) List(listParams *stripe.QuotePhaseListParams) *Iter { - return &Iter{ - Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.QuotePhaseList{} - err := c.B.CallRaw(http.MethodGet, "/v1/quote_phases", c.Key, b, p, list) - - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } - - return ret, list, err - }), - } -} - -// Iter is an iterator for quote phases. -type Iter struct { - *stripe.Iter -} - -// QuotePhase returns the quote phase which the iterator is currently pointing to. -func (i *Iter) QuotePhase() *stripe.QuotePhase { - return i.Current().(*stripe.QuotePhase) -} - -// QuotePhaseList 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 *Iter) QuotePhaseList() *stripe.QuotePhaseList { - return i.List().(*stripe.QuotePhaseList) -} - // 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) diff --git a/quotepreviewinvoice.go b/quotepreviewinvoice.go index 0440f86cb5..37946876fe 100644 --- a/quotepreviewinvoice.go +++ b/quotepreviewinvoice.go @@ -588,6 +588,10 @@ type QuotePreviewInvoiceRendering struct { AmountTaxDisplay string `json:"amount_tax_display"` // Invoice pdf rendering options PDF *QuotePreviewInvoiceRenderingPDF `json:"pdf"` + // ID of the rendering template that the invoice is formatted by. + Template string `json:"template"` + // Version of the rendering template that the invoice is using. + TemplateVersion int64 `json:"template_version"` } // The taxes applied to the shipping rate. diff --git a/subscription.go b/subscription.go index 7bb833f439..6e9afbd73d 100644 --- a/subscription.go +++ b/subscription.go @@ -788,10 +788,14 @@ type SubscriptionListParams struct { // Only return subscriptions that were created during the given date interval. Created *int64 `form:"created"` // Only return subscriptions that were created during the given date interval. - CreatedRange *RangeQueryParams `form:"created"` - CurrentPeriodEnd *int64 `form:"current_period_end"` - CurrentPeriodEndRange *RangeQueryParams `form:"current_period_end"` - CurrentPeriodStart *int64 `form:"current_period_start"` + CreatedRange *RangeQueryParams `form:"created"` + // Only return subscriptions whose current_period_end falls within the given date interval. + CurrentPeriodEnd *int64 `form:"current_period_end"` + // Only return subscriptions whose current_period_end falls within the given date interval. + CurrentPeriodEndRange *RangeQueryParams `form:"current_period_end"` + // Only return subscriptions whose current_period_start falls within the given date interval. + CurrentPeriodStart *int64 `form:"current_period_start"` + // Only return subscriptions whose current_period_start falls within the given date interval. CurrentPeriodStartRange *RangeQueryParams `form:"current_period_start"` // The ID of the customer whose subscriptions will be retrieved. Customer *string `form:"customer"` diff --git a/terminal_location.go b/terminal_location.go index dbbceaebb5..1b8cecd221 100644 --- a/terminal_location.go +++ b/terminal_location.go @@ -15,7 +15,7 @@ type TerminalLocationParams struct { Address *AddressParams `form:"address"` // The ID of a configuration that will be used to customize all readers in this location. ConfigurationOverrides *string `form:"configuration_overrides"` - // A name for the location. + // A name for the location. Maximum length is 1000 characters. DisplayName *string `form:"display_name"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"`