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

Support sepa_debit for bancontact, ideal, sofort #1199

Merged
merged 3 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
38 changes: 22 additions & 16 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,14 @@ type ChargePaymentMethodDetailsBACSDebit struct {

// ChargePaymentMethodDetailsBancontact represents details about the Bancontact PaymentMethod.
type ChargePaymentMethodDetailsBancontact struct {
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
IbanLast4 string `json:"iban_last4"`
PreferredLanguage string `json:"preferred_language"`
VerifiedName string `json:"verified_name"`
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
IbanLast4 string `json:"iban_last4"`
PreferredLanguage string `json:"preferred_language"`
VerifiedName string `json:"verified_name"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
}

// ChargePaymentMethodDetailsCardChecks represents the checks associated with the charge's Card
Expand Down Expand Up @@ -428,10 +430,12 @@ type ChargePaymentMethodDetailsGiropay struct {

// ChargePaymentMethodDetailsIdeal represents details about the Ideal PaymentMethod.
type ChargePaymentMethodDetailsIdeal struct {
Bank string `json:"bank"`
Bic string `json:"bic"`
IbanLast4 string `json:"iban_last4"`
VerifiedName string `json:"verified_name"`
Bank string `json:"bank"`
Bic string `json:"bic"`
IbanLast4 string `json:"iban_last4"`
VerifiedName string `json:"verified_name"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
}

// ChargePaymentMethodDetailsInteracPresent represents details about the InteracPresent PaymentMethod.
Expand Down Expand Up @@ -497,12 +501,14 @@ type ChargePaymentMethodDetailsSepaDebit struct {

// ChargePaymentMethodDetailsSofort represents details about the Sofort PaymentMethod.
type ChargePaymentMethodDetailsSofort struct {
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
Country string `json:"country"`
IbanLast4 string `json:"iban_last4"`
VerifiedName string `json:"verified_name"`
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
Country string `json:"country"`
IbanLast4 string `json:"iban_last4"`
VerifiedName string `json:"verified_name"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
}

// ChargePaymentMethodDetailsStripeAccount represents details about the StripeAccount PaymentMethod.
Expand Down
18 changes: 13 additions & 5 deletions paymentmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,21 @@ type PaymentMethodOXXO struct {
type PaymentMethodP24 struct {
}

// PaymentMethodSepaDebitGeneratedFrom represents information about the object
// that generated this PaymentMethod
type PaymentMethodSepaDebitGeneratedFrom struct {
Charge *Charge `json:"charge"`
SetupAttempt *SetupAttempt `json:"setup_attempt"`
}

// PaymentMethodSepaDebit represents the SEPA-debit-specific properties.
type PaymentMethodSepaDebit struct {
BankCode string `json:"bank_code"`
BranchCode string `json:"branch_code"`
Country string `json:"country"`
Fingerprint string `json:"fingerprint"`
Last4 string `json:"last4"`
BankCode string `json:"bank_code"`
BranchCode string `json:"branch_code"`
Country string `json:"country"`
Fingerprint string `json:"fingerprint"`
Last4 string `json:"last4"`
GeneratedFrom PaymentMethodSepaDebitGeneratedFrom `json:"generated_from"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this one also be a pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup good catch.

}

// PaymentMethodSofort represents the Sofort-specific properties.
Expand Down
41 changes: 39 additions & 2 deletions setupattempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,52 @@ type SetupAttemptPaymentMethodDetailsCardThreeDSecure struct {
Version string `json:"version"`
}

// SetupAttemptPaymentMethodDetailsBancontact represents details about the Bancontact PaymentMethod.
type SetupAttemptPaymentMethodDetailsBancontact struct {
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
IbanLast4 string `json:"iban_last4"`
PreferredLanguage string `json:"preferred_language"`
VerifiedName string `json:"verified_name"`
}

// SetupAttemptPaymentMethodDetailsCard represents details about the Card PaymentMethod.
type SetupAttemptPaymentMethodDetailsCard struct {
ThreeDSecure *SetupAttemptPaymentMethodDetailsCardThreeDSecure `json:"three_d_secure"`
}

// SetupAttemptPaymentMethodDetailsBancontact represents details about the Bancontact PaymentMethod.
type SetupAttemptPaymentMethodDetailsIdeal struct {
Bank string `json:"bank"`
Bic string `json:"bic"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
IbanLast4 string `json:"iban_last4"`
VerifiedName string `json:"verified_name"`
}

// SetupAttemptPaymentMethodDetailsBancontact represents details about the Bancontact PaymentMethod.
type SetupAttemptPaymentMethodDetailsSofort struct {
BankCode string `json:"bank_code"`
BankName string `json:"bank_name"`
Bic string `json:"bic"`
GeneratedSepaDebit *PaymentMethod `json:"generated_sepa_debit"`
GeneratedSepaDebitMandate *Mandate `json:"generated_sepa_debit_mandate"`
IbanLast4 string `json:"iban_last4"`
PreferredLanguage string `json:"preferred_language"`
VerifiedName string `json:"verified_name"`
}

// SetupAttemptPaymentMethodDetails represents the details about the PaymentMethod associated with the setup attempt.
type SetupAttemptPaymentMethodDetails struct {
Card *SetupAttemptPaymentMethodDetailsCard `json:"card"`
Type SetupAttemptPaymentMethodDetailsType `json:"type"`
Bancontact *SetupAttemptPaymentMethodDetailsBancontact `json:"bancontact"`
Card *SetupAttemptPaymentMethodDetailsCard `json:"card"`
Ideal *SetupAttemptPaymentMethodDetailsIdeal `json:"ideal"`
Sofort *SetupAttemptPaymentMethodDetailsSofort `json:"sofort"`
Type SetupAttemptPaymentMethodDetailsType `json:"type"`
}

// SetupAttempt is the resource representing a Stripe setup attempt.
Expand Down