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 #1789

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v715
v734
23 changes: 20 additions & 3 deletions accountsession.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,22 @@ type AccountSessionComponentsPaymentsParams struct {
// The list of features enabled in the embedded component.
Features *AccountSessionComponentsPaymentsFeaturesParams `form:"features"`
}
type AccountSessionComponentsPayoutsFeaturesParams struct{}

// The list of features enabled in the embedded component.
type AccountSessionComponentsPayoutsFeaturesParams struct {
// Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
EditPayoutSchedule *bool `form:"edit_payout_schedule"`
// Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
InstantPayouts *bool `form:"instant_payouts"`
// Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
StandardPayouts *bool `form:"standard_payouts"`
}

// Configuration for the payouts embedded component.
type AccountSessionComponentsPayoutsParams struct {
// Whether the embedded component is enabled.
Enabled *bool `form:"enabled"`
Enabled *bool `form:"enabled"`
// The list of features enabled in the embedded component.
Features *AccountSessionComponentsPayoutsFeaturesParams `form:"features"`
}

Expand Down Expand Up @@ -121,7 +131,14 @@ type AccountSessionComponentsPayments struct {
Enabled bool `json:"enabled"`
Features *AccountSessionComponentsPaymentsFeatures `json:"features"`
}
type AccountSessionComponentsPayoutsFeatures struct{}
type AccountSessionComponentsPayoutsFeatures struct {
// Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
EditPayoutSchedule bool `json:"edit_payout_schedule"`
// Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
InstantPayouts bool `json:"instant_payouts"`
// Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
StandardPayouts bool `json:"standard_payouts"`
}
type AccountSessionComponentsPayouts struct {
// Whether the embedded component is enabled.
Enabled bool `json:"enabled"`
Expand Down
9 changes: 5 additions & 4 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetc

// List of values that CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch can take
const (
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchBalances CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "balances"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchBalances CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "balances"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchTransactions CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "transactions"
)

// Indicates that you intend to make future payments with this PaymentIntent's payment method.
Expand Down Expand Up @@ -698,7 +699,7 @@ const (
// Describes the type of transaction being performed by Checkout in order to customize
// relevant text on the page, such as the submit button. `submit_type` can only be
// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions
// in `subscription` or `setup` mode.
// in `subscription` or `setup` mode. Possible values are `auto`, `pay`, `book`, `donate`. If blank or `auto`, `pay` is used.
type CheckoutSessionSubmitType string

// List of values that CheckoutSessionSubmitType can take
Expand Down Expand Up @@ -1867,7 +1868,7 @@ type CheckoutSessionParams struct {
// Describes the type of transaction being performed by Checkout in order to customize
// relevant text on the page, such as the submit button. `submit_type` can only be
// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions
// in `subscription` or `setup` mode.
// in `subscription` or `setup` mode. Possible values are `auto`, `pay`, `book`, `donate`. If blank or `auto`, `pay` is used.
SubmitType *string `form:"submit_type"`
// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode.
SubscriptionData *CheckoutSessionSubscriptionDataParams `form:"subscription_data"`
Expand Down Expand Up @@ -2667,7 +2668,7 @@ type CheckoutSession struct {
// Describes the type of transaction being performed by Checkout in order to customize
// relevant text on the page, such as the submit button. `submit_type` can only be
// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions
// in `subscription` or `setup` mode.
// in `subscription` or `setup` mode. Possible values are `auto`, `pay`, `book`, `donate`. If blank or `auto`, `pay` is used.
SubmitType CheckoutSessionSubmitType `json:"submit_type"`
// The ID of the subscription for Checkout Sessions in `subscription` mode.
Subscription *Subscription `json:"subscription"`
Expand Down
4 changes: 4 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/stripe/stripe-go/v76/filelink"
financialconnectionsaccount "github.com/stripe/stripe-go/v76/financialconnections/account"
financialconnectionssession "github.com/stripe/stripe-go/v76/financialconnections/session"
financialconnectionstransaction "github.com/stripe/stripe-go/v76/financialconnections/transaction"
identityverificationreport "github.com/stripe/stripe-go/v76/identity/verificationreport"
identityverificationsession "github.com/stripe/stripe-go/v76/identity/verificationsession"
"github.com/stripe/stripe-go/v76/invoice"
Expand Down Expand Up @@ -194,6 +195,8 @@ type API struct {
FinancialConnectionsAccounts *financialconnectionsaccount.Client
// FinancialConnectionsSessions is the client used to invoke /financial_connections/sessions APIs.
FinancialConnectionsSessions *financialconnectionssession.Client
// FinancialConnectionsTransactions is the client used to invoke /financial_connections/transactions APIs.
FinancialConnectionsTransactions *financialconnectionstransaction.Client
// IdentityVerificationReports is the client used to invoke /identity/verification_reports APIs.
IdentityVerificationReports *identityverificationreport.Client
// IdentityVerificationSessions is the client used to invoke /identity/verification_sessions APIs.
Expand Down Expand Up @@ -403,6 +406,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.Files = &file.Client{B: backends.API, BUploads: backends.Uploads, Key: key}
a.FinancialConnectionsAccounts = &financialconnectionsaccount.Client{B: backends.API, Key: key}
a.FinancialConnectionsSessions = &financialconnectionssession.Client{B: backends.API, Key: key}
a.FinancialConnectionsTransactions = &financialconnectionstransaction.Client{B: backends.API, Key: key}
a.IdentityVerificationReports = &identityverificationreport.Client{B: backends.API, Key: key}
a.IdentityVerificationSessions = &identityverificationsession.Client{B: backends.API, Key: key}
a.InvoiceItems = &invoiceitem.Client{B: backends.API, Key: key}
Expand Down
1 change: 1 addition & 0 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const (
EventTypeFinancialConnectionsAccountDisconnected EventType = "financial_connections.account.disconnected"
EventTypeFinancialConnectionsAccountReactivated EventType = "financial_connections.account.reactivated"
EventTypeFinancialConnectionsAccountRefreshedBalance EventType = "financial_connections.account.refreshed_balance"
EventTypeFinancialConnectionsAccountRefreshedTransactions EventType = "financial_connections.account.refreshed_transactions"
EventTypeIdentityVerificationSessionCanceled EventType = "identity.verification_session.canceled"
EventTypeIdentityVerificationSessionCreated EventType = "identity.verification_session.created"
EventTypeIdentityVerificationSessionProcessing EventType = "identity.verification_session.processing"
Expand Down
54 changes: 54 additions & 0 deletions example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
feerefund "github.com/stripe/stripe-go/v76/feerefund"
financialconnections_account "github.com/stripe/stripe-go/v76/financialconnections/account"
financialconnections_session "github.com/stripe/stripe-go/v76/financialconnections/session"
financialconnections_transaction "github.com/stripe/stripe-go/v76/financialconnections/transaction"
identity_verificationreport "github.com/stripe/stripe-go/v76/identity/verificationreport"
identity_verificationsession "github.com/stripe/stripe-go/v76/identity/verificationsession"
invoice "github.com/stripe/stripe-go/v76/invoice"
Expand Down Expand Up @@ -71,6 +72,7 @@ import (
subscriptionitem "github.com/stripe/stripe-go/v76/subscriptionitem"
subscriptionschedule "github.com/stripe/stripe-go/v76/subscriptionschedule"
tax_calculation "github.com/stripe/stripe-go/v76/tax/calculation"
tax_settings "github.com/stripe/stripe-go/v76/tax/settings"
tax_transaction "github.com/stripe/stripe-go/v76/tax/transaction"
taxcode "github.com/stripe/stripe-go/v76/taxcode"
taxid "github.com/stripe/stripe-go/v76/taxid"
Expand Down Expand Up @@ -1049,6 +1051,24 @@ func TestFinancialConnectionsAccountsRefreshPost(t *testing.T) {
assert.Nil(t, err)
}

func TestFinancialConnectionsAccountsSubscribePost(t *testing.T) {
params := &stripe.FinancialConnectionsAccountSubscribeParams{
Features: []*string{stripe.String("transactions")},
}
result, err := financialconnections_account.Subscribe("fa_123", params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestFinancialConnectionsAccountsUnsubscribePost(t *testing.T) {
params := &stripe.FinancialConnectionsAccountUnsubscribeParams{
Features: []*string{stripe.String("transactions")},
}
result, err := financialconnections_account.Unsubscribe("fa_123", params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestFinancialConnectionsSessionsGet(t *testing.T) {
params := &stripe.FinancialConnectionsSessionParams{}
result, err := financialconnections_session.Get("fcsess_xyz", params)
Expand Down Expand Up @@ -1100,6 +1120,22 @@ func TestFinancialConnectionsSessionsPost2(t *testing.T) {
assert.Nil(t, err)
}

func TestFinancialConnectionsTransactionsGet(t *testing.T) {
params := &stripe.FinancialConnectionsTransactionParams{}
result, err := financialconnections_transaction.Get("tr_123", params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestFinancialConnectionsTransactionsGet2(t *testing.T) {
params := &stripe.FinancialConnectionsTransactionListParams{
Account: stripe.String("fca_xyz"),
}
result := financialconnections_transaction.List(params)
assert.NotNil(t, result)
assert.Nil(t, result.Err())
}

func TestIdentityVerificationReportsGet(t *testing.T) {
params := &stripe.IdentityVerificationReportListParams{}
params.Limit = stripe.Int64(3)
Expand Down Expand Up @@ -2704,6 +2740,24 @@ func TestTaxRatesPost2(t *testing.T) {
assert.Nil(t, err)
}

func TestTaxSettingsGet(t *testing.T) {
params := &stripe.TaxSettingsParams{}
result, err := tax_settings.Get(params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestTaxSettingsPost(t *testing.T) {
params := &stripe.TaxSettingsParams{
Defaults: &stripe.TaxSettingsDefaultsParams{
TaxCode: stripe.String("txcd_10000000"),
},
}
result, err := tax_settings.Update(params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestTaxTransactionsCreateFromCalculationPost(t *testing.T) {
params := &stripe.TaxTransactionCreateFromCalculationParams{
Calculation: stripe.String("xxx"),
Expand Down
2 changes: 1 addition & 1 deletion file.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (p *FileParams) AddExpand(f string) {
// This object represents files hosted on Stripe's servers. You can upload
// files with the [create file](https://stripe.com/docs/api#create_file) request
// (for example, when uploading dispute evidence). Stripe also
// creates files independetly (for example, the results of a [Sigma scheduled
// creates files independently (for example, the results of a [Sigma scheduled
// query](https://stripe.com/docs/api#scheduled_queries)).
//
// Related guide: [File upload guide](https://stripe.com/docs/file-upload)
Expand Down
32 changes: 32 additions & 0 deletions financialconnections/account/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,38 @@ func (c Client) Refresh(id string, params *stripe.FinancialConnectionsAccountRef
return account, err
}

// Subscribe is the method for the `POST /v1/financial_connections/accounts/{account}/subscribe` API.
func Subscribe(id string, params *stripe.FinancialConnectionsAccountSubscribeParams) (*stripe.FinancialConnectionsAccount, error) {
return getC().Subscribe(id, params)
}

// Subscribe is the method for the `POST /v1/financial_connections/accounts/{account}/subscribe` API.
func (c Client) Subscribe(id string, params *stripe.FinancialConnectionsAccountSubscribeParams) (*stripe.FinancialConnectionsAccount, error) {
path := stripe.FormatURLPath(
"/v1/financial_connections/accounts/%s/subscribe",
id,
)
account := &stripe.FinancialConnectionsAccount{}
err := c.B.Call(http.MethodPost, path, c.Key, params, account)
return account, err
}

// Unsubscribe is the method for the `POST /v1/financial_connections/accounts/{account}/unsubscribe` API.
func Unsubscribe(id string, params *stripe.FinancialConnectionsAccountUnsubscribeParams) (*stripe.FinancialConnectionsAccount, error) {
return getC().Unsubscribe(id, params)
}

// Unsubscribe is the method for the `POST /v1/financial_connections/accounts/{account}/unsubscribe` API.
func (c Client) Unsubscribe(id string, params *stripe.FinancialConnectionsAccountUnsubscribeParams) (*stripe.FinancialConnectionsAccount, error) {
path := stripe.FormatURLPath(
"/v1/financial_connections/accounts/%s/unsubscribe",
id,
)
account := &stripe.FinancialConnectionsAccount{}
err := c.B.Call(http.MethodPost, path, c.Key, params, account)
return account, err
}

// List returns a list of financial connections accounts.
func List(params *stripe.FinancialConnectionsAccountListParams) *Iter {
return getC().List(params)
Expand Down
77 changes: 77 additions & 0 deletions financialconnections/transaction/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package transaction provides the /financial_connections/transactions APIs
package transaction

import (
"net/http"

stripe "github.com/stripe/stripe-go/v76"
"github.com/stripe/stripe-go/v76/form"
)

// Client is used to invoke /financial_connections/transactions APIs.
type Client struct {
B stripe.Backend
Key string
}

// Get returns the details of a financial connections transaction.
func Get(id string, params *stripe.FinancialConnectionsTransactionParams) (*stripe.FinancialConnectionsTransaction, error) {
return getC().Get(id, params)
}

// Get returns the details of a financial connections transaction.
func (c Client) Get(id string, params *stripe.FinancialConnectionsTransactionParams) (*stripe.FinancialConnectionsTransaction, error) {
path := stripe.FormatURLPath("/v1/financial_connections/transactions/%s", id)
transaction := &stripe.FinancialConnectionsTransaction{}
err := c.B.Call(http.MethodGet, path, c.Key, params, transaction)
return transaction, err
}

// List returns a list of financial connections transactions.
func List(params *stripe.FinancialConnectionsTransactionListParams) *Iter {
return getC().List(params)
}

// List returns a list of financial connections transactions.
func (c Client) List(listParams *stripe.FinancialConnectionsTransactionListParams) *Iter {
return &Iter{
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
list := &stripe.FinancialConnectionsTransactionList{}
err := c.B.CallRaw(http.MethodGet, "/v1/financial_connections/transactions", 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 financial connections transactions.
type Iter struct {
*stripe.Iter
}

// FinancialConnectionsTransaction returns the financial connections transaction which the iterator is currently pointing to.
func (i *Iter) FinancialConnectionsTransaction() *stripe.FinancialConnectionsTransaction {
return i.Current().(*stripe.FinancialConnectionsTransaction)
}

// FinancialConnectionsTransactionList 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) FinancialConnectionsTransactionList() *stripe.FinancialConnectionsTransactionList {
return i.List().(*stripe.FinancialConnectionsTransactionList)
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
Loading
Loading