Skip to content

Commit

Permalink
fix #1681 changing JsonKey to JsonValue and add unknownValue
Browse files Browse the repository at this point in the history
  • Loading branch information
dagyu committed Mar 28, 2024
1 parent 9a90fe4 commit 7d300ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ class PaymentIntent with _$PaymentIntent {

/// The list of payment method types (e.g. card) that this PaymentIntent
/// is allowed to use.
@JsonKey(name: "payment_method_types")
@JsonKey(
name: "payment_method_types",
unknownEnumValue: PaymentMethodType.unknown,
)
@Default([])
List<PaymentMethodType> paymentMethodTypes,

Expand Down
24 changes: 13 additions & 11 deletions packages/stripe_js/lib/src/api/payment_methods/payment_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ import 'package:freezed_annotation/freezed_annotation.dart';
/// type.
enum PaymentMethodType {
/// Pre-authorized debit payments are used to debit Canadian bank accounts through the Automated Clearing Settlement System (ACSS).
@JsonKey(name: "acss_debit")
@JsonValue("acss_debit")
acssDebit,

/// Affirm is a buy now, pay later payment method in the US.
affirm,

/// Afterpay / Clearpay is a buy now, pay later payment method used in Australia, Canada, France, New Zealand, Spain, the UK, and the US.
@JsonKey(name: "afterpay_clearpay")
@JsonValue("afterpay_clearpay")
afterpayClearpay,

/// Alipay is a digital wallet payment method used in China.
alipay,

/// BECS Direct Debit is used to debit Australian bank accounts through the Bulk Electronic Clearing System (BECS).
@JsonKey(name: "au_becs_debit")
@JsonValue("au_becs_debit")
auBecsDebit,

/// Bacs Direct Debit is used to debit UK bank accounts.
@JsonKey(name: "bacs_debit")
@JsonValue("bacs_debit")
bacsDebit,

/// Bancontact is a bank redirect payment method used in Belgium.
Expand All @@ -43,11 +43,11 @@ enum PaymentMethodType {
cashapp,

/// Stripe Terminal is used to collect in-person card payments.
@JsonKey(name: "bacs_debit")
@JsonValue("bacs_debit")
cardPresent,

/// Uses a customer’s cash balance for the payment.
@JsonKey(name: "customer_balance")
@JsonValue("customer_balance")
customerBalance,

/// EPS is an Austria-based bank redirect payment method.
Expand All @@ -66,7 +66,7 @@ enum PaymentMethodType {
ideal,

/// Stripe Terminal accepts Interac debit cards for in-person payments in Canada.
@JsonKey(name: "interac_present")
@JsonValue("interac_present")
interacPresent,

/// Klarna is a global buy now, pay later payment method.
Expand Down Expand Up @@ -94,17 +94,19 @@ enum PaymentMethodType {
promptpay,

/// SEPA Direct Debit is used to debit bank accounts within the Single Euro Payments Area (SEPA) region.
@JsonKey(name: "sepa_debit")
@JsonValue("sepa_debit")
sepaDebit,

/// Sofort is a bank redirect payment method used in Europe.
sofort,

/// ACH Direct Debit is used to debit US bank accounts through the Automated Clearing House (ACH) payments system.
@JsonKey(name: "us_bank_account")
@JsonValue("us_bank_account")
usBankAccount,

/// WeChat Pay is a digital wallet payment method based in China.
@JsonKey(name: "wechat_pay")
wechatPay
@JsonValue("wechat_pay")
wechatPay,

unknown
}

0 comments on commit 7d300ce

Please sign in to comment.