Skip to content

Commit

Permalink
Merge pull request #1692 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
Update generated code for beta
  • Loading branch information
stripe-openapi[bot] authored Jul 25, 2023
2 parents 3ccb768 + 5cbd828 commit 806fb11
Show file tree
Hide file tree
Showing 11 changed files with 329 additions and 12 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v425
v431
22 changes: 20 additions & 2 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,20 @@ type AccountParams struct {
Type *string `form:"type"`
}

// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India.
type AccountBusinessProfileMonthlyEstimatedRevenueParams struct {
// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
Amount *int64 `form:"amount"`
// 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 *string `form:"currency"`
}

// Business information about the account.
type AccountBusinessProfileParams struct {
// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide.
MCC *string `form:"mcc"`
// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India.
MonthlyEstimatedRevenue *AccountBusinessProfileMonthlyEstimatedRevenueParams `form:"monthly_estimated_revenue"`
// The customer-facing business name.
Name *string `form:"name"`
// Internal-only description of the product sold by, or service provided by, the business. Used by Stripe for risk and underwriting purposes.
Expand Down Expand Up @@ -874,10 +884,18 @@ func (p *AccountExternalAccountParams) AppendTo(body *form.Values, keyParts []st
}
}

type AccountBusinessProfileMonthlyEstimatedRevenue struct {
// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
Amount int64 `json:"amount"`
// 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"`
}

// Business information about the account.
type AccountBusinessProfile struct {
// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide.
MCC string `json:"mcc"`
MCC string `json:"mcc"`
MonthlyEstimatedRevenue *AccountBusinessProfileMonthlyEstimatedRevenue `json:"monthly_estimated_revenue"`
// The customer-facing business name.
Name string `json:"name"`
// Internal-only description of the product sold or service provided by the business. It's used by Stripe for risk and underwriting purposes.
Expand Down Expand Up @@ -1311,7 +1329,7 @@ type Account struct {
// This is an object representing a person associated with a Stripe account.
//
// A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
// See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform pre-filling and account onboarding steps.
// See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.
//
// Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information)
Individual *Person `json:"individual"`
Expand Down
12 changes: 12 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,8 @@ type CheckoutSessionParams struct {
//
// If you'd like information on how to collect a payment method outside of Checkout, read the guide on configuring [subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
PaymentMethodCollection *string `form:"payment_method_collection"`
// The ID of the payment method configuration to use with this Checkout session.
PaymentMethodConfiguration *string `form:"payment_method_configuration"`
// Payment-method-specific configuration.
PaymentMethodOptions *CheckoutSessionPaymentMethodOptionsParams `form:"payment_method_options"`
// A list of the types of payment methods (e.g., `card`) this Checkout Session can accept.
Expand Down Expand Up @@ -1945,6 +1947,14 @@ type CheckoutSessionInvoiceCreation struct {
Enabled bool `json:"enabled"`
InvoiceData *CheckoutSessionInvoiceCreationInvoiceData `json:"invoice_data"`
}

// Information about the payment method configuration used for this Checkout session.
type CheckoutSessionPaymentMethodConfigurationDetails struct {
// ID of the payment method configuration used.
ID string `json:"id"`
// ID of the parent payment method configuration used.
Parent string `json:"parent"`
}
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions struct {
// A URL for custom mandate text
CustomMandateURL string `json:"custom_mandate_url"`
Expand Down Expand Up @@ -2424,6 +2434,8 @@ type CheckoutSession struct {
PaymentLink *PaymentLink `json:"payment_link"`
// Configure whether a Checkout Session should collect a payment method.
PaymentMethodCollection CheckoutSessionPaymentMethodCollection `json:"payment_method_collection"`
// Information about the payment method configuration used for this Checkout session.
PaymentMethodConfigurationDetails *CheckoutSessionPaymentMethodConfigurationDetails `json:"payment_method_configuration_details"`
// Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
PaymentMethodOptions *CheckoutSessionPaymentMethodOptions `json:"payment_method_options"`
// A list of the types of payment methods (e.g. card) this Checkout
Expand Down
8 changes: 6 additions & 2 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import (
"github.com/stripe/stripe-go/v74/subscriptionitem"
"github.com/stripe/stripe-go/v74/subscriptionschedule"
taxcalculation "github.com/stripe/stripe-go/v74/tax/calculation"
taxform "github.com/stripe/stripe-go/v74/tax/form"
taxregistration "github.com/stripe/stripe-go/v74/tax/registration"
taxsettings "github.com/stripe/stripe-go/v74/tax/settings"
taxtransaction "github.com/stripe/stripe-go/v74/tax/transaction"
Expand Down Expand Up @@ -302,6 +303,8 @@ type API struct {
TaxCalculations *taxcalculation.Client
// TaxCodes is the client used to invoke /tax_codes APIs.
TaxCodes *taxcode.Client
// TaxForms is the client used to invoke /tax/forms APIs.
TaxForms *taxform.Client
// TaxIDs is the client used to invoke /customers/{customer}/tax_ids APIs.
TaxIDs *taxid.Client
// TaxRates is the client used to invoke /tax_rates APIs.
Expand Down Expand Up @@ -419,7 +422,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.Events = &event.Client{B: backends.API, Key: key}
a.FeeRefunds = &feerefund.Client{B: backends.API, Key: key}
a.FileLinks = &filelink.Client{B: backends.API, Key: key}
a.Files = &file.Client{B: backends.Uploads, Key: key}
a.Files = &file.Client{B: backends.API, BUploads: backends.Uploads, Key: key}
a.FinancialConnectionsAccounts = &financialconnectionsaccount.Client{B: backends.API, Key: key}
a.FinancialConnectionsInferredBalances = &financialconnectionsinferredbalance.Client{B: backends.API, Key: key}
a.FinancialConnectionsSessions = &financialconnectionssession.Client{B: backends.API, Key: key}
Expand Down Expand Up @@ -453,7 +456,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.Products = &product.Client{B: backends.API, Key: key}
a.PromotionCodes = &promotioncode.Client{B: backends.API, Key: key}
a.QuotePhases = &quotephase.Client{B: backends.API, Key: key}
a.Quotes = &quote.Client{B: backends.API, PDFBackend: backends.Uploads, Key: key}
a.Quotes = &quote.Client{B: backends.API, BUploads: backends.Uploads, Key: key}
a.RadarEarlyFraudWarnings = &radarearlyfraudwarning.Client{B: backends.API, Key: key}
a.RadarValueListItems = &radarvaluelistitem.Client{B: backends.API, Key: key}
a.RadarValueLists = &radarvaluelist.Client{B: backends.API, Key: key}
Expand All @@ -472,6 +475,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.SubscriptionSchedules = &subscriptionschedule.Client{B: backends.API, Key: key}
a.TaxCalculations = &taxcalculation.Client{B: backends.API, Key: key}
a.TaxCodes = &taxcode.Client{B: backends.API, Key: key}
a.TaxForms = &taxform.Client{B: backends.API, Key: key}
a.TaxIDs = &taxid.Client{B: backends.API, Key: key}
a.TaxRates = &taxrate.Client{B: backends.API, Key: key}
a.TaxRegistrations = &taxregistration.Client{B: backends.API, Key: key}
Expand Down
15 changes: 15 additions & 0 deletions example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
subscriptionitem "github.com/stripe/stripe-go/v74/subscriptionitem"
subscriptionschedule "github.com/stripe/stripe-go/v74/subscriptionschedule"
tax_calculation "github.com/stripe/stripe-go/v74/tax/calculation"
tax_form "github.com/stripe/stripe-go/v74/tax/form"
tax_transaction "github.com/stripe/stripe-go/v74/tax/transaction"
taxcode "github.com/stripe/stripe-go/v74/taxcode"
taxid "github.com/stripe/stripe-go/v74/taxid"
Expand Down Expand Up @@ -3261,3 +3262,17 @@ func TestTaxCalculationCreate(t *testing.T) {
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestQuotePDF(t *testing.T) {
params := &stripe.QuotePDFParams{}
result, err := quote.PDF("qt_xxxxxxxxxxxxx", params)
assert.NotNil(t, result)
assert.Nil(t, err)
}

func TestTaxFormPDF(t *testing.T) {
params := &stripe.TaxFormPDFParams{}
result, err := tax_form.PDF("form_xxxxxxxxxxxxx", params)
assert.NotNil(t, result)
assert.Nil(t, err)
}
9 changes: 5 additions & 4 deletions file/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (

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

// New creates a new file.
Expand All @@ -40,7 +41,7 @@ func (c Client) New(params *stripe.FileParams) (*stripe.File, error) {
}

file := &stripe.File{}
err = c.B.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)
err = c.BUploads.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)

return file, err
}
Expand Down Expand Up @@ -98,5 +99,5 @@ func (i *Iter) FileList() *stripe.FileList {
}

func getC() Client {
return Client{stripe.GetBackend(stripe.UploadsBackend), stripe.Key}
return Client{stripe.GetBackend(stripe.APIBackend), stripe.GetBackend(stripe.UploadsBackend), stripe.Key}
}
2 changes: 1 addition & 1 deletion person.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ type PersonVerification struct {
// This is an object representing a person associated with a Stripe account.
//
// A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
// See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform pre-filling and account onboarding steps.
// See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.
//
// Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information)
type Person struct {
Expand Down
10 changes: 8 additions & 2 deletions quote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
type Client struct {
B stripe.Backend
PDFBackend stripe.Backend
BUploads stripe.Backend
Key string
}

Expand Down Expand Up @@ -133,7 +134,7 @@ func PDF(id string, params *stripe.QuotePDFParams) (*stripe.APIStream, error) {
func (c Client) PDF(id string, params *stripe.QuotePDFParams) (*stripe.APIStream, error) {
path := stripe.FormatURLPath("/v1/quotes/%s/pdf", id)
stream := &stripe.APIStream{}
err := c.PDFBackend.CallStreaming(http.MethodGet, path, c.Key, params, stream)
err := c.BUploads.CallStreaming(http.MethodGet, path, c.Key, params, stream)
return stream, err
}

Expand Down Expand Up @@ -432,5 +433,10 @@ func (i *SubscriptionScheduleIter) SubscriptionScheduleList() *stripe.Subscripti
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.GetBackend(stripe.UploadsBackend), stripe.Key}
return Client{
stripe.GetBackend(stripe.APIBackend),
stripe.GetBackend(stripe.UploadsBackend),
stripe.GetBackend(stripe.UploadsBackend),
stripe.Key,
}
}
12 changes: 12 additions & 0 deletions setupintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ type SetupIntentParams struct {
OnBehalfOf *string `form:"on_behalf_of"`
// ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent.
PaymentMethod *string `form:"payment_method"`
// The ID of the payment method configuration to use with this SetupIntent.
PaymentMethodConfiguration *string `form:"payment_method_configuration"`
// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method)
// value in the SetupIntent.
PaymentMethodData *SetupIntentPaymentMethodDataParams `form:"payment_method_data"`
Expand Down Expand Up @@ -1110,6 +1112,14 @@ type SetupIntentNextAction struct {
UseStripeSDK *SetupIntentNextActionUseStripeSDK `json:"use_stripe_sdk"`
VerifyWithMicrodeposits *SetupIntentNextActionVerifyWithMicrodeposits `json:"verify_with_microdeposits"`
}

// Information about the payment method configuration used for this Setup Intent.
type SetupIntentPaymentMethodConfigurationDetails struct {
// ID of the payment method configuration used.
ID string `json:"id"`
// ID of the parent payment method configuration used.
Parent string `json:"parent"`
}
type SetupIntentPaymentMethodOptionsACSSDebitMandateOptions struct {
// A URL for custom mandate text
CustomMandateURL string `json:"custom_mandate_url"`
Expand Down Expand Up @@ -1295,6 +1305,8 @@ type SetupIntent struct {
OnBehalfOf *Account `json:"on_behalf_of"`
// ID of the payment method used with this SetupIntent.
PaymentMethod *PaymentMethod `json:"payment_method"`
// Information about the payment method configuration used for this Setup Intent.
PaymentMethodConfigurationDetails *SetupIntentPaymentMethodConfigurationDetails `json:"payment_method_configuration_details"`
// Payment-method-specific configuration for this SetupIntent.
PaymentMethodOptions *SetupIntentPaymentMethodOptions `json:"payment_method_options"`
// The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.
Expand Down
90 changes: 90 additions & 0 deletions tax/form/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package form provides the /tax/forms APIs
package form

import (
"net/http"

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

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

// Get returns the details of a tax form.
func Get(id string, params *stripe.TaxFormParams) (*stripe.TaxForm, error) {
return getC().Get(id, params)
}

// Get returns the details of a tax form.
func (c Client) Get(id string, params *stripe.TaxFormParams) (*stripe.TaxForm, error) {
path := stripe.FormatURLPath("/v1/tax/forms/%s", id)
form := &stripe.TaxForm{}
err := c.B.Call(http.MethodGet, path, c.Key, params, form)
return form, err
}

// PDF is the method for the `GET /v1/tax/forms/{id}/pdf` API.
func PDF(id string, params *stripe.TaxFormPDFParams) (*stripe.APIStream, error) {
return getC().PDF(id, params)
}

// PDF is the method for the `GET /v1/tax/forms/{id}/pdf` API.
func (c Client) PDF(id string, params *stripe.TaxFormPDFParams) (*stripe.APIStream, error) {
path := stripe.FormatURLPath("/v1/tax/forms/%s/pdf", id)
stream := &stripe.APIStream{}
err := c.B.CallStreaming(http.MethodGet, path, c.Key, params, stream)
return stream, err
}

// List returns a list of tax forms.
func List(params *stripe.TaxFormListParams) *Iter {
return getC().List(params)
}

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

// TaxForm returns the tax form which the iterator is currently pointing to.
func (i *Iter) TaxForm() *stripe.TaxForm {
return i.Current().(*stripe.TaxForm)
}

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

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

0 comments on commit 806fb11

Please sign in to comment.