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 FPX PaymentMethod Support #955

Merged
merged 7 commits into from
Oct 3, 2019
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
9 changes: 9 additions & 0 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
ChargePaymentMethodDetailsTypeCard ChargePaymentMethodDetailsType = "card"
ChargePaymentMethodDetailsTypeCardPresent ChargePaymentMethodDetailsType = "card_present"
ChargePaymentMethodDetailsTypeEps ChargePaymentMethodDetailsType = "eps"
ChargePaymentMethodDetailsTypeFpx ChargePaymentMethodDetailsType = "fpx"
ChargePaymentMethodDetailsTypeGiropay ChargePaymentMethodDetailsType = "giropay"
ChargePaymentMethodDetailsTypeIdeal ChargePaymentMethodDetailsType = "ideal"
ChargePaymentMethodDetailsTypeKlarna ChargePaymentMethodDetailsType = "klarna"
Expand Down Expand Up @@ -344,6 +345,13 @@ type ChargePaymentMethodDetailsEps struct {
VerifiedName string `json:"verified_name"`
}

// ChargePaymentMethodDetailsFpx represents details about the FPX PaymentMethod.
type ChargePaymentMethodDetailsFpx struct {
AccountHolderType string `json:"account_holder_type"`
shengwei-stripe marked this conversation as resolved.
Show resolved Hide resolved
Bank string `json:"bank"`
TransactionId string `json:"transaction_id"`
}

// ChargePaymentMethodDetailsGiropay represents details about the Giropay PaymentMethod.
type ChargePaymentMethodDetailsGiropay struct {
BankCode string `json:"bank_code"`
Expand Down Expand Up @@ -415,6 +423,7 @@ type ChargePaymentMethodDetails struct {
Card *ChargePaymentMethodDetailsCard `json:"card"`
CardPresent *ChargePaymentMethodDetailsCardPresent `json:"card_present"`
Eps *ChargePaymentMethodDetailsEps `json:"eps"`
Fpx *ChargePaymentMethodDetailsFpx `json:"fpx"`
Giropay *ChargePaymentMethodDetailsGiropay `json:"giropay"`
Ideal *ChargePaymentMethodDetailsIdeal `json:"ideal"`
Klarna *ChargePaymentMethodDetailsKlarna `json:"klarna"`
Expand Down
15 changes: 15 additions & 0 deletions paymentmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,20 @@ type PaymentMethodCardParams struct {
Token *string `form:"token"`
}

// PaymentMethodFpxParams is the set of parameters allowed for the `fpx` hash when creating a
// PaymentMethod of type fpx.
type PaymentMethodFpxParams struct {
AccountHolderType *string `form:"account_holder_type"`
Bank *string `form:"bank"`
}

// PaymentMethodParams is the set of parameters that can be used when creating or updating a
// PaymentMethod.
type PaymentMethodParams struct {
Params `form:"*"`
BillingDetails *BillingDetailsParams `form:"billing_details"`
Card *PaymentMethodCardParams `form:"card"`
Fpx *PaymentMethodFpxParams `form:"fpx"`
PaymentMethod *string `form:"payment_method"`
Type *string `form:"type"`

Expand Down Expand Up @@ -146,13 +154,20 @@ type PaymentMethodCard struct {
type PaymentMethodCardPresent struct {
}

type PaymentMethodFpx struct {
AccountHolderType string `json:"account_holder_type"`
shengwei-stripe marked this conversation as resolved.
Show resolved Hide resolved
Bank string `json:"bank"`
TransactionId string `json:"transaction_id"`
}

// PaymentMethod is the resource representing a PaymentMethod.
type PaymentMethod struct {
BillingDetails *BillingDetails `json:"billing_details"`
Card *PaymentMethodCard `json:"card"`
CardPresent *PaymentMethodCardPresent `json:"card_present"`
Created int64 `json:"created"`
Customer *Customer `json:"customer"`
Fpx *PaymentMethodFpx `json:"fpx"`
ID string `json:"id"`
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
Expand Down