-
Notifications
You must be signed in to change notification settings - Fork 463
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
Add payment_settings to invoice #1247
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,47 @@ const ( | |
InvoiceBillingReasonUpcoming InvoiceBillingReason = "upcoming" | ||
) | ||
|
||
// InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage is the | ||
// preferred language of the Bancontact authorization page that the customer is | ||
// redirected to. | ||
type InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage string | ||
|
||
// List of values that InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage can take. | ||
const ( | ||
InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguageDE InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage = "de" | ||
InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguageEN InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage = "en" | ||
InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguageFR InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage = "fr" | ||
InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguageNL InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage = "nl" | ||
) | ||
|
||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure represents | ||
// the options for requesting 3D Secure. | ||
type InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure string | ||
|
||
// List of values that InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure can take. | ||
const ( | ||
InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecureAny InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure = "any" | ||
InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecureAutomatic InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure = "automatic" | ||
) | ||
|
||
// InvoicePaymentSettingsPaymentMethodType represents the payment method type to provide to the invoice's PaymentIntent. | ||
type InvoicePaymentSettingsPaymentMethodType string | ||
|
||
const ( | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
InvoicePaymentSettingsPaymentMethodTypeAchCreditTransfer InvoicePaymentSettingsPaymentMethodType = "ach_credit_transfer" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be ACH, but it's Ach in other places and ACH does not exist anywhere. |
||
InvoicePaymentSettingsPaymentMethodTypeAchDebit InvoicePaymentSettingsPaymentMethodType = "ach_debit" | ||
InvoicePaymentSettingsPaymentMethodTypeAUBECSDebit InvoicePaymentSettingsPaymentMethodType = "au_becs_debit" | ||
InvoicePaymentSettingsPaymentMethodTypeBACSDebit InvoicePaymentSettingsPaymentMethodType = "bacs_debit" | ||
InvoicePaymentSettingsPaymentMethodTypeBancontact InvoicePaymentSettingsPaymentMethodType = "bancontact" | ||
InvoicePaymentSettingsPaymentMethodTypeCard InvoicePaymentSettingsPaymentMethodType = "card" | ||
InvoicePaymentSettingsPaymentMethodTypeFPX InvoicePaymentSettingsPaymentMethodType = "fpx" | ||
InvoicePaymentSettingsPaymentMethodTypeGiropay InvoicePaymentSettingsPaymentMethodType = "giropay" | ||
InvoicePaymentSettingsPaymentMethodTypeIdeal InvoicePaymentSettingsPaymentMethodType = "ideal" | ||
InvoicePaymentSettingsPaymentMethodTypeSepaCreditTransfer InvoicePaymentSettingsPaymentMethodType = "sepa_credit_transfer" | ||
InvoicePaymentSettingsPaymentMethodTypeSepaDebit InvoicePaymentSettingsPaymentMethodType = "sepa_debit" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fair, though that will increase the number of breaking changes once we codegen and fix this right? tbh I have no idea how we'll handle codegen-ing specific acronyms having to be in upper case 😓 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arg lol. Yeah, that seems okay. |
||
InvoicePaymentSettingsPaymentMethodTypeSofort InvoicePaymentSettingsPaymentMethodType = "sofort" | ||
) | ||
|
||
// InvoiceStatus is the reason why a given invoice was created | ||
type InvoiceStatus string | ||
|
||
|
@@ -88,6 +129,31 @@ type InvoiceDiscountParams struct { | |
Discount *string `form:"discount"` | ||
} | ||
|
||
// InvoicePaymentSettingsPaymentMethodOptionsBancontactParams is the set of parameters allowed for | ||
// bancontact on payment_method_options on payment_settings on an invoice. | ||
type InvoicePaymentSettingsPaymentMethodOptionsBancontactParams struct { | ||
PreferredLanguage *string `form:"preferred_language"` | ||
} | ||
|
||
// InvoicePaymentSettingsParams is the set of parameters allowed for card on payment_method_options on | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment references the wrong type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit nitpicky too, but I'd probably leave out things like I usually just keep the docs on these structs as simple as plausibly possible like "is the set of parameters for invoice payment settings". Not super useful I know, but pretty much no documentation will be unless we go for all-the-way API ref style docs (which might be possible with codegen). |
||
// payment_settings on an invoice. | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type InvoicePaymentSettingsPaymentMethodOptionsCardParams struct { | ||
RequestThreeDSecure *string `form:"request_three_d_secure"` | ||
} | ||
|
||
// InvoicePaymentSettingsParams is the set of parameters allowed for the payment_method_options on ther | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment references the wrong type |
||
// payment_settings on an invoice. | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type InvoicePaymentSettingsPaymentMethodOptionsParams struct { | ||
Bancontact *InvoicePaymentSettingsPaymentMethodOptionsBancontactParams `form:"bancontact"` | ||
Card *InvoicePaymentSettingsPaymentMethodOptionsCardParams `form:"card"` | ||
} | ||
|
||
// InvoicePaymentSettingsParams is the set of parameters allowed for the payment_settings on an invoice. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment references the wrong type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems right to me |
||
type InvoicePaymentSettingsParams struct { | ||
PaymentMethodOptions *InvoicePaymentSettingsPaymentMethodOptionsParams `form:"payment_method_options"` | ||
PaymentMethodTypes *[]*string `form:"payment_method_types"` | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// InvoiceTransferDataParams is the set of parameters allowed for the transfer_data hash. | ||
type InvoiceTransferDataParams struct { | ||
Amount *int64 `form:"amount"` | ||
|
@@ -98,24 +164,25 @@ type InvoiceTransferDataParams struct { | |
// For more details see https://stripe.com/docs/api#create_invoice, https://stripe.com/docs/api#update_invoice. | ||
type InvoiceParams struct { | ||
Params `form:"*"` | ||
AccountTaxIDs []*string `form:"account_tax_ids"` | ||
AutoAdvance *bool `form:"auto_advance"` | ||
ApplicationFeeAmount *int64 `form:"application_fee_amount"` | ||
CollectionMethod *string `form:"collection_method"` | ||
CustomFields []*InvoiceCustomFieldParams `form:"custom_fields"` | ||
Customer *string `form:"customer"` | ||
DaysUntilDue *int64 `form:"days_until_due"` | ||
DefaultPaymentMethod *string `form:"default_payment_method"` | ||
DefaultSource *string `form:"default_source"` | ||
DefaultTaxRates []*string `form:"default_tax_rates"` | ||
Description *string `form:"description"` | ||
Discounts []*InvoiceDiscountParams `form:"discounts"` | ||
DueDate *int64 `form:"due_date"` | ||
Footer *string `form:"footer"` | ||
Paid *bool `form:"paid"` | ||
StatementDescriptor *string `form:"statement_descriptor"` | ||
Subscription *string `form:"subscription"` | ||
TransferData *InvoiceTransferDataParams `form:"transfer_data"` | ||
AccountTaxIDs []*string `form:"account_tax_ids"` | ||
AutoAdvance *bool `form:"auto_advance"` | ||
ApplicationFeeAmount *int64 `form:"application_fee_amount"` | ||
CollectionMethod *string `form:"collection_method"` | ||
CustomFields []*InvoiceCustomFieldParams `form:"custom_fields"` | ||
Customer *string `form:"customer"` | ||
DaysUntilDue *int64 `form:"days_until_due"` | ||
DefaultPaymentMethod *string `form:"default_payment_method"` | ||
DefaultSource *string `form:"default_source"` | ||
DefaultTaxRates []*string `form:"default_tax_rates"` | ||
Description *string `form:"description"` | ||
Discounts []*InvoiceDiscountParams `form:"discounts"` | ||
DueDate *int64 `form:"due_date"` | ||
Footer *string `form:"footer"` | ||
Paid *bool `form:"paid"` | ||
PaymentSettings *InvoicePaymentSettingsParams `form:"payment_settings"` | ||
StatementDescriptor *string `form:"statement_descriptor"` | ||
Subscription *string `form:"subscription"` | ||
TransferData *InvoiceTransferDataParams `form:"transfer_data"` | ||
|
||
// These are all for exclusive use by GetNext. | ||
|
||
|
@@ -262,6 +329,7 @@ type Invoice struct { | |
Object string `json:"object"` | ||
Paid bool `json:"paid"` | ||
PaymentIntent *PaymentIntent `json:"payment_intent"` | ||
PaymentSettings *InvoicePaymentSettings `json:"payment_settings"` | ||
PeriodEnd int64 `json:"period_end"` | ||
PeriodStart int64 `json:"period_start"` | ||
PostPaymentCreditNotesAmount int64 `json:"post_payment_credit_notes_amount"` | ||
|
@@ -380,6 +448,30 @@ type InvoiceLineList struct { | |
Data []*InvoiceLine `json:"data"` | ||
} | ||
|
||
// InvoicePaymentSettingsPaymentMethodOptionsBancontact, if paying by `bancontact`, contains details about the Bancontact payment method options | ||
// to pass to the invoice's PaymentIntent. | ||
type InvoicePaymentSettingsPaymentMethodOptionsBancontact struct { | ||
PreferredLanguage InvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage `json:"preferred_language"` | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// InvoicePaymentSettingsPaymentMethodOptionsCard, if paying by `card`, contains details about the Card payment method options to pass to the | ||
// invoice's PaymentIntent. | ||
type InvoicePaymentSettingsPaymentMethodOptionsCard struct { | ||
RequestThreeDSecure InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure `json:"request_three_d_secure"` | ||
} | ||
|
||
// InvoicePaymentSettingsPaymentMethodOptions represents payment-method-specific configuration to provide to the invoice's PaymentIntent. | ||
type InvoicePaymentSettingsPaymentMethodOptions struct { | ||
Bancontact *InvoicePaymentSettingsPaymentMethodOptionsBancontact `json:"bancontact"` | ||
Card *InvoicePaymentSettingsPaymentMethodOptionsCard `json:"card"` | ||
} | ||
|
||
// InvoicePaymentSettings represents configuration settings to provide to the invoice's PaymentIntent. | ||
type InvoicePaymentSettings struct { | ||
PaymentMethodOptions *InvoicePaymentSettingsPaymentMethodOptions `json:"payment_method_options"` | ||
PaymentMethodTypes []InvoicePaymentSettingsPaymentMethodType `json:"payment_method_types"` | ||
} | ||
|
||
// InvoiceStatusTransitions are the timestamps at which the invoice status was updated. | ||
type InvoiceStatusTransitions struct { | ||
FinalizedAt int64 `json:"finalized_at"` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this -- the general rule is "define enums for resources, but not for params" but we don't seem to be explicit about "language" enums anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'd recommend punting on constants for languages today. I don't know who we'll handle once we codegen but until then keeping those as strings is easier (because there could be hundreds of constants otherwise, it's like
state
orcountry
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, IMO we should probably just make it a string because (1) it's documented as string as opposed to enum in the API ref, (2) this could potentially have a lot of different values, (3) if the product team added a new value without the library I'm not sure that we'd be able to handle it that well, and (4) it looks like it's a string on payment intent, setup attempt, and charge.
Thoughts?