Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #1973

Merged
merged 11 commits into from
Feb 7, 2025
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 81.3.1 - 2025-02-03
* [#1980](https://github.com/stripe/stripe-go/pull/1980) Update generated code
* ⚠️ Fix acronym `JPY` in TerminalConfiguration that were not correctly capitalized

## 81.3.0 - 2025-01-27
* [#1965](https://github.com/stripe/stripe-go/pull/1965) Update generated code
* Add support for `Close` method on resource `Treasury.FinancialAccount`
* Add support for `PayByBankPayments` on `AccountCapabilitiesParams` and `AccountCapabilities`
* Add support for `DirectorshipDeclaration` and `OwnershipExemptionReason` on `AccountCompanyParams`, `AccountCompany`, and `TokenAccountCompanyParams`
* Add support for `ProofOfUltimateBeneficialOwnership` on `AccountDocumentsParams`
* Add support for `FinancialAccount` on `AccountSessionComponentsParams`, `AccountSessionComponents`, and `TreasuryOutboundTransferDestinationPaymentMethodDetails`
* Add support for `FinancialAccountTransactions`, `IssuingCard`, and `IssuingCardsList` on `AccountSessionComponentsParams` and `AccountSessionComponents`
* Add support for `AdviceCode` on `ChargeOutcome`, `InvoiceLastFinalizationError`, `PaymentIntentLastPaymentError`, `SetupAttemptSetupError`, `SetupIntentLastSetupError`, and `StripeError`
* Add support for `PayByBank` on `ChargePaymentMethodDetails`, `CheckoutSessionPaymentMethodOptionsParams`, `ConfirmationTokenPaymentMethodDataParams`, `ConfirmationTokenPaymentMethodPreview`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodConfigurationParams`, `PaymentMethodConfiguration`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams`
* Add support for `Country` on `ChargePaymentMethodDetailsPaypal`, `ConfirmationTokenPaymentMethodPreviewPaypal`, and `PaymentMethodPaypal`
* Add support for `Discounts` on `CheckoutSession`
* Add support for new value `SD` on enums `CheckoutSessionShippingAddressCollectionAllowedCountries` and `PaymentLinkShippingAddressCollectionAllowedCountries`
* Add support for new value `pay_by_bank` on enums `ConfirmationTokenPaymentMethodPreviewType` and `PaymentMethodType`
* Add support for `PhoneNumberCollection` on `PaymentLinkParams`
* Add support for new value `pay_by_bank` on enum `PaymentLinkPaymentMethodTypes`
* Add support for `Jpy` on `TerminalConfigurationTippingParams` and `TerminalConfigurationTipping`
* Add support for `Nickname` on `TreasuryFinancialAccountParams` and `TreasuryFinancialAccount`
* Add support for `ForwardingSettings` on `TreasuryFinancialAccountParams`
* Add support for `IsDefault` on `TreasuryFinancialAccount`
* Add support for `DestinationPaymentMethodData` on `TreasuryOutboundTransferParams`
* Change type of `TreasuryOutboundTransferDestinationPaymentMethodDetailsType` from `literal('us_bank_account')` to `enum('financial_account'|'us_bank_account')`
* Add support for `OutboundTransfer` on `TreasuryReceivedCreditLinkedFlowsSourceFlowDetails`
* Add support for new value `outbound_transfer` on enum `TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType`
* [#1970](https://github.com/stripe/stripe-go/pull/1970) fix justfile ordering bug
* [#1969](https://github.com/stripe/stripe-go/pull/1969) pin CI and fix formatting
* [#1964](https://github.com/stripe/stripe-go/pull/1964) add justfile, update readme, remove coveralls
* [#1967](https://github.com/stripe/stripe-go/pull/1967) Added CONTRIBUTING.md file
* [#1962](https://github.com/stripe/stripe-go/pull/1962) Added pull request template

## 81.3.0-beta.3 - 2025-01-23
* [#1971](https://github.com/stripe/stripe-go/pull/1971) Update generated code for beta
* Remove support for `StripeAccount` on `TerminalReaderActionCollectPaymentMethod`, `TerminalReaderActionConfirmPaymentIntent`, `TerminalReaderActionProcessPaymentIntent`, and `TerminalReaderActionRefundPayment`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1460
v1472
323 changes: 32 additions & 291 deletions account.go

Large diffs are not rendered by default.

49 changes: 2 additions & 47 deletions accountlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

package stripe

import (
"encoding/json"
"time"
)

// Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow.
type AccountLinkCollectionOptionsParams struct {
// Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). If you don't specify `collection_options`, the default value is `currently_due`.
Expand Down Expand Up @@ -68,51 +63,11 @@ func (p *AccountLinkParams) AddExpand(f string) {
type AccountLink struct {
APIResource
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created time.Time `json:"created"`
Created int64 `json:"created"`
// The timestamp at which this account link will expire.
ExpiresAt time.Time `json:"expires_at"`
ExpiresAt int64 `json:"expires_at"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
// The URL for the account link.
URL string `json:"url"`
}

// UnmarshalJSON handles deserialization of an AccountLink.
// This custom unmarshaling is needed to handle the time fields correctly.
func (a *AccountLink) UnmarshalJSON(data []byte) error {
type accountLink AccountLink
v := struct {
Created int64 `json:"created"`
ExpiresAt int64 `json:"expires_at"`
*accountLink
}{
accountLink: (*accountLink)(a),
}
if err := json.Unmarshal(data, &v); err != nil {
return err
}

a.Created = time.Unix(v.Created, 0)
a.ExpiresAt = time.Unix(v.ExpiresAt, 0)
return nil
}

// MarshalJSON handles serialization of an AccountLink.
// This custom marshaling is needed to handle the time fields correctly.
func (a AccountLink) MarshalJSON() ([]byte, error) {
type accountLink AccountLink
v := struct {
Created int64 `json:"created"`
ExpiresAt int64 `json:"expires_at"`
accountLink
}{
accountLink: (accountLink)(a),
Created: a.Created.Unix(),
ExpiresAt: a.ExpiresAt.Unix(),
}
b, err := json.Marshal(v)
if err != nil {
return nil, err
}
return b, err
}
7 changes: 1 addition & 6 deletions accountlink/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ func New(params *stripe.AccountLinkParams) (*stripe.AccountLink, error) {
func (c Client) New(params *stripe.AccountLinkParams) (*stripe.AccountLink, error) {
accountlink := &stripe.AccountLink{}
err := c.B.Call(
http.MethodPost,
"/v1/account_links",
c.Key,
params,
accountlink,
)
http.MethodPost, "/v1/account_links", c.Key, params, accountlink)
return accountlink, err
}

Expand Down
57 changes: 4 additions & 53 deletions accountnotice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

package stripe

import (
"encoding/json"
"time"
)

// Reason the notice is being sent. The reason determines what copy the notice must contain. See the [regulated customer notices](https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices) guide. All reasons might not apply to your integration, and Stripe might add new reasons in the future, so we recommend an internal warning when you receive an unknown reason.
type AccountNoticeReason string

Expand Down Expand Up @@ -55,7 +50,7 @@ type AccountNoticeParams struct {
// 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
Metadata map[string]string `form:"metadata"`
// Date when you sent the notice.
SentAt *time.Time `form:"sent_at"`
SentAt *int64 `form:"sent_at"`
}

// AddExpand appends a new field to expand.
Expand Down Expand Up @@ -108,9 +103,9 @@ type AccountNoticeLinkedObjects struct {
type AccountNotice struct {
APIResource
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created time.Time `json:"created"`
Created int64 `json:"created"`
// When present, the deadline for sending the notice to meet the relevant regulations.
Deadline time.Time `json:"deadline"`
Deadline int64 `json:"deadline"`
// Information about the email when sent.
Email *AccountNoticeEmail `json:"email"`
// Unique identifier for the object.
Expand All @@ -126,7 +121,7 @@ type AccountNotice struct {
// Reason the notice is being sent. The reason determines what copy the notice must contain. See the [regulated customer notices](https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices) guide. All reasons might not apply to your integration, and Stripe might add new reasons in the future, so we recommend an internal warning when you receive an unknown reason.
Reason AccountNoticeReason `json:"reason"`
// Date when the notice was sent. When absent, you must send the notice, update the content of the email and date when it was sent.
SentAt time.Time `json:"sent_at"`
SentAt int64 `json:"sent_at"`
}

// AccountNoticeList is a list of AccountNotices as retrieved from a list endpoint.
Expand All @@ -135,47 +130,3 @@ type AccountNoticeList struct {
ListMeta
Data []*AccountNotice `json:"data"`
}

// UnmarshalJSON handles deserialization of an AccountNotice.
// This custom unmarshaling is needed to handle the time fields correctly.
func (a *AccountNotice) UnmarshalJSON(data []byte) error {
type accountNotice AccountNotice
v := struct {
Created int64 `json:"created"`
Deadline int64 `json:"deadline"`
SentAt int64 `json:"sent_at"`
*accountNotice
}{
accountNotice: (*accountNotice)(a),
}
if err := json.Unmarshal(data, &v); err != nil {
return err
}

a.Created = time.Unix(v.Created, 0)
a.Deadline = time.Unix(v.Deadline, 0)
a.SentAt = time.Unix(v.SentAt, 0)
return nil
}

// MarshalJSON handles serialization of an AccountNotice.
// This custom marshaling is needed to handle the time fields correctly.
func (a AccountNotice) MarshalJSON() ([]byte, error) {
type accountNotice AccountNotice
v := struct {
Created int64 `json:"created"`
Deadline int64 `json:"deadline"`
SentAt int64 `json:"sent_at"`
accountNotice
}{
accountNotice: (accountNotice)(a),
Created: a.Created.Unix(),
Deadline: a.Deadline.Unix(),
SentAt: a.SentAt.Unix(),
}
b, err := json.Marshal(v)
if err != nil {
return nil, err
}
return b, err
}
56 changes: 14 additions & 42 deletions accountsession.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

package stripe

import (
"encoding/json"
"time"
)

// The list of features enabled in the embedded component.
type AccountSessionComponentsAccountManagementFeaturesParams struct {
// Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
Expand Down Expand Up @@ -323,6 +318,17 @@ type AccountSessionComponentsPayoutsListParams struct {
// The list of features enabled in the embedded component.
Features *AccountSessionComponentsPayoutsListFeaturesParams `form:"features"`
}

// The list of features enabled in the embedded component.
type AccountSessionComponentsProductTaxCodeSelectorFeaturesParams struct{}

// Configuration for the product tax code selector embedded component.
type AccountSessionComponentsProductTaxCodeSelectorParams struct {
// Whether the embedded component is enabled.
Enabled *bool `form:"enabled"`
// The list of features enabled in the embedded component.
Features *AccountSessionComponentsProductTaxCodeSelectorFeaturesParams `form:"features"`
}
type AccountSessionComponentsRecipientsFeaturesParams struct {
// Whether to allow sending money.
SendMoney *bool `form:"send_money"`
Expand Down Expand Up @@ -421,6 +427,8 @@ type AccountSessionComponentsParams struct {
Payouts *AccountSessionComponentsPayoutsParams `form:"payouts"`
// Configuration for the payouts list embedded component.
PayoutsList *AccountSessionComponentsPayoutsListParams `form:"payouts_list"`
// Configuration for the product tax code selector embedded component.
ProductTaxCodeSelector *AccountSessionComponentsProductTaxCodeSelectorParams `form:"product_tax_code_selector"`
// Configuration for the recipients component.
Recipients *AccountSessionComponentsRecipientsParams `form:"recipients"`
// Configuration for the reporting chart embedded component.
Expand Down Expand Up @@ -684,45 +692,9 @@ type AccountSession struct {
ClientSecret string `json:"client_secret"`
Components *AccountSessionComponents `json:"components"`
// The timestamp at which this AccountSession will expire.
ExpiresAt time.Time `json:"expires_at"`
ExpiresAt int64 `json:"expires_at"`
// 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"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
}

// UnmarshalJSON handles deserialization of an AccountSession.
// This custom unmarshaling is needed to handle the time fields correctly.
func (a *AccountSession) UnmarshalJSON(data []byte) error {
type accountSession AccountSession
v := struct {
ExpiresAt int64 `json:"expires_at"`
*accountSession
}{
accountSession: (*accountSession)(a),
}
if err := json.Unmarshal(data, &v); err != nil {
return err
}

a.ExpiresAt = time.Unix(v.ExpiresAt, 0)
return nil
}

// MarshalJSON handles serialization of an AccountSession.
// This custom marshaling is needed to handle the time fields correctly.
func (a AccountSession) MarshalJSON() ([]byte, error) {
type accountSession AccountSession
v := struct {
ExpiresAt int64 `json:"expires_at"`
accountSession
}{
accountSession: (accountSession)(a),
ExpiresAt: a.ExpiresAt.Unix(),
}
b, err := json.Marshal(v)
if err != nil {
return nil, err
}
return b, err
}
7 changes: 1 addition & 6 deletions accountsession/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ func New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) {
func (c Client) New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) {
accountsession := &stripe.AccountSession{}
err := c.B.Call(
http.MethodPost,
"/v1/account_sessions",
c.Key,
params,
accountsession,
)
http.MethodPost, "/v1/account_sessions", c.Key, params, accountsession)
return accountsession, err
}

Expand Down
47 changes: 3 additions & 44 deletions applepaydomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

package stripe

import (
"encoding/json"
"time"
)

// Delete an apple pay domain.
type ApplePayDomainParams struct {
Params `form:"*"`
Expand Down Expand Up @@ -40,9 +35,9 @@ func (p *ApplePayDomainListParams) AddExpand(f string) {
type ApplePayDomain struct {
APIResource
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created time.Time `json:"created"`
Deleted bool `json:"deleted"`
DomainName string `json:"domain_name"`
Created int64 `json:"created"`
Deleted bool `json:"deleted"`
DomainName string `json:"domain_name"`
// 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.
Expand All @@ -57,39 +52,3 @@ type ApplePayDomainList struct {
ListMeta
Data []*ApplePayDomain `json:"data"`
}

// UnmarshalJSON handles deserialization of an ApplePayDomain.
// This custom unmarshaling is needed to handle the time fields correctly.
func (a *ApplePayDomain) UnmarshalJSON(data []byte) error {
type applePayDomain ApplePayDomain
v := struct {
Created int64 `json:"created"`
*applePayDomain
}{
applePayDomain: (*applePayDomain)(a),
}
if err := json.Unmarshal(data, &v); err != nil {
return err
}

a.Created = time.Unix(v.Created, 0)
return nil
}

// MarshalJSON handles serialization of an ApplePayDomain.
// This custom marshaling is needed to handle the time fields correctly.
func (a ApplePayDomain) MarshalJSON() ([]byte, error) {
type applePayDomain ApplePayDomain
v := struct {
Created int64 `json:"created"`
applePayDomain
}{
applePayDomain: (applePayDomain)(a),
Created: a.Created.Unix(),
}
b, err := json.Marshal(v)
if err != nil {
return nil, err
}
return b, err
}
7 changes: 1 addition & 6 deletions applepaydomain/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ func New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {
func (c Client) New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {
applepaydomain := &stripe.ApplePayDomain{}
err := c.B.Call(
http.MethodPost,
"/v1/apple_pay/domains",
c.Key,
params,
applepaydomain,
)
http.MethodPost, "/v1/apple_pay/domains", c.Key, params, applepaydomain)
return applepaydomain, err
}

Expand Down
Loading