Skip to content

Commit

Permalink
Merge pull request #1183 from stripe/remi-pm-oxxo-ga
Browse files Browse the repository at this point in the history
Add support for OXXO on `PaymentIntent` and `PaymentMethod`
  • Loading branch information
remi-stripe authored Sep 24, 2020
2 parents 2f744e5 + bbbb743 commit f64b16a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
6 changes: 6 additions & 0 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ type ChargePaymentMethodDetailsMultibanco struct {
Reference string `json:"reference"`
}

// ChargePaymentMethodDetailsOXXO represents details about the OXXO PaymentMethod.
type ChargePaymentMethodDetailsOXXO struct {
Number string `json:"number"`
}

// ChargePaymentMethodDetailsP24 represents details about the P24 PaymentMethod.
type ChargePaymentMethodDetailsP24 struct {
Reference string `json:"reference"`
Expand Down Expand Up @@ -526,6 +531,7 @@ type ChargePaymentMethodDetails struct {
Ideal *ChargePaymentMethodDetailsIdeal `json:"ideal"`
Klarna *ChargePaymentMethodDetailsKlarna `json:"klarna"`
Multibanco *ChargePaymentMethodDetailsMultibanco `json:"multibanco"`
OXXO *ChargePaymentMethodDetailsOXXO `json:"oxxo"`
P24 *ChargePaymentMethodDetailsP24 `json:"p24"`
SepaDebit *ChargePaymentMethodDetailsSepaDebit `json:"sepa_debit"`
Sofort *ChargePaymentMethodDetailsSofort `json:"sofort"`
Expand Down
28 changes: 27 additions & 1 deletion paymentintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ type PaymentIntentNextActionType string

// List of values that PaymentIntentNextActionType can take.
const (
PaymentIntentNextActionTypeRedirectToURL PaymentIntentNextActionType = "redirect_to_url"
PaymentIntentNextActionTypeAlipayHandleRedirect PaymentIntentNextActionType = "alipay_handle_redirect"
PaymentIntentNextActionTypeOXXODisplayDetails PaymentIntentNextActionType = "oxxo_display_details"
PaymentIntentNextActionTypeRedirectToURL PaymentIntentNextActionType = "redirect_to_url"
)

// PaymentIntentOffSession is the list of allowed values for types of off-session.
Expand Down Expand Up @@ -172,6 +174,7 @@ type PaymentIntentPaymentMethodDataParams struct {
Card *PaymentMethodCardParams `form:"card"`
FPX *PaymentMethodFPXParams `form:"fpx"`
Ideal *PaymentMethodIdealParams `form:"ideal"`
OXXO *PaymentMethodOXXOParams `form:"oxxo"`
SepaDebit *PaymentMethodSepaDebitParams `form:"sepa_debit"`
Type *string `form:"type"`
}
Expand Down Expand Up @@ -211,6 +214,12 @@ type PaymentIntentPaymentMethodOptionsCardParams struct {
RequestThreeDSecure *string `form:"request_three_d_secure"`
}

// PaymentIntentPaymentMethodOptionsOXXOParams represents the OXXO-specific options applied to a
// PaymentIntent.
type PaymentIntentPaymentMethodOptionsOXXOParams struct {
ExpiresAfterDays *int64 `form:"expires_after_days"`
}

// PaymentIntentPaymentMethodOptionsSofortParams represents the sofort-specific options applied to a
// PaymentIntent.
type PaymentIntentPaymentMethodOptionsSofortParams struct {
Expand All @@ -223,6 +232,7 @@ type PaymentIntentPaymentMethodOptionsParams struct {
Alipay *PaymentIntentPaymentMethodOptionsAlipayParams `form:"alipay"`
Bancontact *PaymentIntentPaymentMethodOptionsBancontactParams `form:"bancontact"`
Card *PaymentIntentPaymentMethodOptionsCardParams `form:"card"`
OXXO *PaymentIntentPaymentMethodOptionsOXXOParams `form:"oxxo"`
Sofort *PaymentIntentPaymentMethodOptionsSofortParams `form:"sofort"`
}

Expand Down Expand Up @@ -283,6 +293,14 @@ type PaymentIntentNextActionAlipayHandleRedirect struct {
URL string `json:"url"`
}

// PaymentIntentNextActionOXXODisplayDetails represents the resource for the next action of type
// "oxxo_display_details".
type PaymentIntentNextActionOXXODisplayDetails struct {
ExpiresAfter int64 `json:"expires_after"`
HostedVoucherURL string `json:"hosted_voucher_url"`
Number string `json:"number"`
}

// PaymentIntentNextActionRedirectToURL represents the resource for the next action of type
// "redirect_to_url".
type PaymentIntentNextActionRedirectToURL struct {
Expand All @@ -293,6 +311,7 @@ type PaymentIntentNextActionRedirectToURL struct {
// PaymentIntentNextAction represents the type of action to take on a payment intent.
type PaymentIntentNextAction struct {
AlipayHandleRedirect *PaymentIntentNextActionAlipayHandleRedirect `json:"alipay_handle_redirect"`
OXXODisplayDetails *PaymentIntentNextActionOXXODisplayDetails `json:"oxxo_display_details"`
RedirectToURL *PaymentIntentNextActionRedirectToURL `json:"redirect_to_url"`
Type PaymentIntentNextActionType `json:"type"`
}
Expand Down Expand Up @@ -331,6 +350,12 @@ type PaymentIntentPaymentMethodOptionsCard struct {
RequestThreeDSecure PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure `json:"request_three_d_secure"`
}

// PaymentIntentPaymentMethodOptionsOXXO is the set of OXXO-specific options associated
// with that payment intent.
type PaymentIntentPaymentMethodOptionsOXXO struct {
ExpiresAfterDays int64 `json:"expires_after_days"`
}

// PaymentIntentPaymentMethodOptionsSofort is the set of sofort-specific options associated
// with that payment intent.
type PaymentIntentPaymentMethodOptionsSofort struct {
Expand All @@ -343,6 +368,7 @@ type PaymentIntentPaymentMethodOptions struct {
Alipay *PaymentIntentPaymentMethodOptionsAlipay `json:"alipay"`
Bancontact *PaymentIntentPaymentMethodOptionsBancontact `json:"bancontact"`
Card *PaymentIntentPaymentMethodOptionsCard `json:"card"`
OXXO *PaymentIntentPaymentMethodOptionsOXXO `json:"oxxo"`
Sofort *PaymentIntentPaymentMethodOptionsSofort `json:"sofort"`
}

Expand Down
12 changes: 12 additions & 0 deletions paymentmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
PaymentMethodTypeFPX PaymentMethodType = "fpx"
PaymentMethodTypeIdeal PaymentMethodType = "ideal"
PaymentMethodTypeInteracPresent PaymentMethodType = "interac_present"
PaymentMethodTypeOXXO PaymentMethodType = "oxxo"
PaymentMethodTypeP24 PaymentMethodType = "p24"
PaymentMethodTypeSepaDebit PaymentMethodType = "sepa_debit"
PaymentMethodTypeSofort PaymentMethodType = "sofort"
Expand Down Expand Up @@ -145,6 +146,11 @@ type PaymentMethodIdealParams struct {
type PaymentMethodInteracPresentParams struct {
}

// PaymentMethodOXXOParams is the set of parameters allowed for the `oxxo` hash when creating a
// PaymentMethod of type OXXO.
type PaymentMethodOXXOParams struct {
}

// PaymentMethodP24Params is the set of parameters allowed for the `p24` hash when creating a
// PaymentMethod of type P24.
type PaymentMethodP24Params struct {
Expand Down Expand Up @@ -177,6 +183,7 @@ type PaymentMethodParams struct {
Giropay *PaymentMethodGiropayParams `form:"giropay"`
Ideal *PaymentMethodIdealParams `form:"ideal"`
InteracPresent *PaymentMethodInteracPresentParams `form:"interac_present"`
OXXO *PaymentMethodOXXOParams `form:"oxxo"`
P24 *PaymentMethodP24Params `form:"p24"`
SepaDebit *PaymentMethodSepaDebitParams `form:"sepa_debit"`
Sofort *PaymentMethodSofortParams `form:"sofort"`
Expand Down Expand Up @@ -312,6 +319,10 @@ type PaymentMethodIdeal struct {
type PaymentMethodInteracPresent struct {
}

// PaymentMethodOXXO represents the OXXO-specific properties.
type PaymentMethodOXXO struct {
}

// PaymentMethodP24 represents the P24 properties.
type PaymentMethodP24 struct {
}
Expand Down Expand Up @@ -351,6 +362,7 @@ type PaymentMethod struct {
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
Object string `json:"object"`
OXXO *PaymentMethodOXXO `json:"oxxo"`
P24 *PaymentMethodP24 `json:"p24"`
SepaDebit *PaymentMethodSepaDebit `json:"sepa_debit"`
Sofort *PaymentMethodSofort `json:"sofort"`
Expand Down

0 comments on commit f64b16a

Please sign in to comment.