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

Add support for ACSS debit payment method #1275

Merged
merged 5 commits into from
Apr 12, 2021
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
7 changes: 7 additions & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ type AccountBusinessProfileParams struct {
URL *string `form:"url"`
}

// AccountCapabilitiesACSSDebitPaymentsParams represent allowed parameters to configure the ACSS Debit capability on an account.
type AccountCapabilitiesACSSDebitPaymentsParams struct {
Requested *bool `form:"requested"`
}

// AccountCapabilitiesAUBECSDebitPaymentsParams represent allowed parameters to configure the AU BECS Debit capability on an account.
type AccountCapabilitiesAUBECSDebitPaymentsParams struct {
Requested *bool `form:"requested"`
Expand Down Expand Up @@ -272,6 +277,7 @@ type AccountCapabilitiesTransfersParams struct {

// AccountCapabilitiesParams represent allowed parameters to configure capabilities on an account.
type AccountCapabilitiesParams struct {
ACSSDebitPayments *AccountCapabilitiesACSSDebitPaymentsParams `form:"acss_debit_payments"`
AUBECSDebitPayments *AccountCapabilitiesAUBECSDebitPaymentsParams `form:"au_becs_debit_payments"`
BACSDebitPayments *AccountCapabilitiesBACSDebitPaymentsParams `form:"bacs_debit_payments"`
BancontactPayments *AccountCapabilitiesBancontactPaymentsParams `form:"bancontact_payments"`
Expand Down Expand Up @@ -553,6 +559,7 @@ type AccountBusinessProfile struct {

// AccountCapabilities is the resource representing the capabilities enabled on that account.
type AccountCapabilities struct {
ACSSDebitPayments AccountCapabilityStatus `json:"acss_debit_payments"`
AUBECSDebitPayments AccountCapabilityStatus `json:"au_becs_debit_payments"`
BACSDebitPayments AccountCapabilityStatus `json:"bacs_debit_payments"`
BancontactPayments AccountCapabilityStatus `json:"bancontact_payments"`
Expand Down
71 changes: 71 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,35 @@ const (
CheckoutSessionModeSubscription CheckoutSessionMode = "subscription"
)

// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule is the list of allowed values for payment_schedule
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule string

// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleCombined CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "combined"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleInterval CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "interval"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleSporadic CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "sporadic"
)

// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType is the list of allowed values for transaction_type
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType string

// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypeBusiness CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "business"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypePersonal CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "personal"
)

// CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod is the list of allowed values for verification_method
type CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod string

// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodAutomatic CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "automatic"
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodInstant CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "instant"
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodMicrodeposits CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "microdeposits"
)

// CheckoutSessionPaymentStatus is the list of allowed values for the payment status on a Session.`
type CheckoutSessionPaymentStatus string

Expand Down Expand Up @@ -174,6 +203,26 @@ type CheckoutSessionPaymentIntentDataParams struct {
TransferGroup *string `form:"transfer_group"`
}

// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams is the set of parameters allowed for mandate_options for acss debit.
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams struct {
CustomMandateURL *string `form:"custom_mandate_url"`
IntervalDescription *string `form:"interval_description"`
PaymentSchedule *string `form:"payment_schedule"`
TransactionType *string `form:"transaction_type"`
}

// CheckoutSessionPaymentMethodOptionsACSSDebitParams is the set of parameters allowed for acss_debit on payment_method_options.
type CheckoutSessionPaymentMethodOptionsACSSDebitParams struct {
Currency *string `form:"currency"`
MandateOptions *CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams `form:"mandate_options"`
VerificationMethod *string `form:"verification_method"`
}

// CheckoutSessionPaymentMethodOptionsParams is the set of allowed parameters for payment_method_options on a checkout session.
type CheckoutSessionPaymentMethodOptionsParams struct {
ACSSDebit *CheckoutSessionPaymentMethodOptionsACSSDebitParams `form:"acss_debit"`
}

// CheckoutSessionSetupIntentDataParams is the set of parameters allowed for the setup intent
// creation on a checkout session.
type CheckoutSessionSetupIntentDataParams struct {
Expand Down Expand Up @@ -234,6 +283,7 @@ type CheckoutSessionParams struct {
Locale *string `form:"locale"`
Mode *string `form:"mode"`
PaymentIntentData *CheckoutSessionPaymentIntentDataParams `form:"payment_intent_data"`
PaymentMethodOptions *CheckoutSessionPaymentMethodOptionsParams `form:"payment_method_options"`
PaymentMethodTypes []*string `form:"payment_method_types"`
SetupIntentData *CheckoutSessionSetupIntentDataParams `form:"setup_intent_data"`
ShippingAddressCollection *CheckoutSessionShippingAddressCollectionParams `form:"shipping_address_collection"`
Expand Down Expand Up @@ -274,6 +324,26 @@ type CheckoutSessionCustomerDetails struct {
TaxIDs []*CheckoutSessionCustomerDetailsTaxIDs `json:"tax_ids"`
}

// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions represent mandate options for acss debit.
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions struct {
CustomMandateURL string `json:"custom_mandate_url"`
IntervalDescription string `json:"interval_description"`
PaymentSchedule CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule `json:"payment_schedule"`
TransactionType CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType `json:"transaction_type"`
}

// CheckoutSessionPaymentMethodOptionsACSSDebit represent the options for acss debit on payment_method_options.
type CheckoutSessionPaymentMethodOptionsACSSDebit struct {
Currency string `json:"currency"`
MandateOptions *CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions `json:"mandate_options"`
remi-stripe marked this conversation as resolved.
Show resolved Hide resolved
VerificationMethod CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod `json:"verification_method"`
}

// CheckoutSessionPaymentMethodOptions represent payment-method-specific options for a checkout session.
type CheckoutSessionPaymentMethodOptions struct {
ACSSDebit *CheckoutSessionPaymentMethodOptionsACSSDebit `json:"acss_debit"`
}

// CheckoutSessionShippingAddressCollection is the set of parameters allowed for the
// shipping address collection.
type CheckoutSessionShippingAddressCollection struct {
Expand Down Expand Up @@ -328,6 +398,7 @@ type CheckoutSession struct {
Mode CheckoutSessionMode `json:"mode"`
Object string `json:"object"`
PaymentIntent *PaymentIntent `json:"payment_intent"`
PaymentMethodOptions *CheckoutSessionPaymentMethodOptions `json:"payment_method_options"`
PaymentMethodTypes []string `json:"payment_method_types"`
PaymentStatus CheckoutSessionPaymentStatus `json:"payment_status"`
SetupIntent *SetupIntent `json:"setup_intent"`
Expand Down
27 changes: 27 additions & 0 deletions mandate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ const (
MandateStatusPending MandateStatus = "pending"
)

// MandatePaymentMethodDetailsACSSDebitPaymentSchedule is the list of allowed values for an acss debit payment_schedule on payment_method_details
type MandatePaymentMethodDetailsACSSDebitPaymentSchedule string

// List of values that MandatePaymentMethodDetailsACSSDebitPaymentSchedule can take
const (
MandatePaymentMethodDetailsACSSDebitPaymentScheduleCombined MandatePaymentMethodDetailsACSSDebitPaymentSchedule = "combined"
MandatePaymentMethodDetailsACSSDebitPaymentScheduleInterval MandatePaymentMethodDetailsACSSDebitPaymentSchedule = "interval"
MandatePaymentMethodDetailsACSSDebitPaymentScheduleSporadic MandatePaymentMethodDetailsACSSDebitPaymentSchedule = "sporadic"
)

// MandatePaymentMethodDetailsACSSDebitTransactionType is the list of allowed values for an acss debit transaction type
type MandatePaymentMethodDetailsACSSDebitTransactionType string

// List of values that MandatePaymentMethodDetailsACSSDebitTransactionType can take
const (
MandatePaymentMethodDetailsACSSDebitTransactionTypeBusiness MandatePaymentMethodDetailsACSSDebitTransactionType = "business"
MandatePaymentMethodDetailsACSSDebitTransactionTypePersonal MandatePaymentMethodDetailsACSSDebitTransactionType = "personal"
)

// MandatePaymentMethodDetailsBACSDebitNetworkStatus is the list of allowed values for the status
// with the network for a given mandate.
type MandatePaymentMethodDetailsBACSDebitNetworkStatus string
Expand Down Expand Up @@ -72,6 +91,13 @@ type MandateCustomerAcceptance struct {
type MandateMultiUse struct {
}

// MandatePaymentMethodDetailsACSSDebit represent details about the acss debit associated with this mandate.
type MandatePaymentMethodDetailsACSSDebit struct {
IntervalDescription string `json:"interval_description"`
PaymentSchedule MandatePaymentMethodDetailsACSSDebitPaymentSchedule `json:"payment_schedule"`
TransactionType MandatePaymentMethodDetailsACSSDebitTransactionType `json:"transaction_type"`
}

// MandatePaymentMethodDetailsAUBECSDebit represents details about the Australia BECS debit account
// associated with this mandate.
type MandatePaymentMethodDetailsAUBECSDebit struct {
Expand Down Expand Up @@ -100,6 +126,7 @@ type MandatePaymentMethodDetailsSepaDebit struct {
// MandatePaymentMethodDetails represents details about the payment method associated with this
// mandate.
type MandatePaymentMethodDetails struct {
ACSSDebit *MandatePaymentMethodDetailsACSSDebit `json:"acss_debit"`
AUBECSDebit *MandatePaymentMethodDetailsAUBECSDebit `json:"au_becs_debit"`
BACSDebit *MandatePaymentMethodDetailsBACSDebit `json:"bacs_debit"`
Card *MandatePaymentMethodDetailsCard `json:"card"`
Expand Down
Loading