PaymentMethod.fromJson constructor
PaymentMethod.fromJson(
- Object? json
Implementation
factory PaymentMethod.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return PaymentMethod(
acssDebit: map['acss_debit'] == null
? null
: PaymentMethodAcssDebit.fromJson(map['acss_debit']),
affirm: map['affirm'] == null
? null
: PaymentMethodAffirm.fromJson(map['affirm']),
afterpayClearpay: map['afterpay_clearpay'] == null
? null
: PaymentMethodAfterpayClearpay.fromJson(map['afterpay_clearpay']),
alipay: map['alipay'] == null
? null
: PaymentFlowsPrivatePaymentMethodsAlipay.fromJson(map['alipay']),
auBecsDebit: map['au_becs_debit'] == null
? null
: PaymentMethodAuBecsDebit.fromJson(map['au_becs_debit']),
bacsDebit: map['bacs_debit'] == null
? null
: PaymentMethodBacsDebit.fromJson(map['bacs_debit']),
bancontact: map['bancontact'] == null
? null
: PaymentMethodBancontact.fromJson(map['bancontact']),
billingDetails: BillingDetails.fromJson(map['billing_details']),
blik:
map['blik'] == null ? null : PaymentMethodBlik.fromJson(map['blik']),
boleto: map['boleto'] == null
? null
: PaymentMethodBoleto.fromJson(map['boleto']),
card:
map['card'] == null ? null : PaymentMethodCard.fromJson(map['card']),
cardPresent: map['card_present'] == null
? null
: PaymentMethodCardPresent.fromJson(map['card_present']),
cashapp: map['cashapp'] == null
? null
: PaymentMethodCashapp.fromJson(map['cashapp']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
customer: map['customer'] == null
? null
: CustomerOrId.fromJson(map['customer']),
customerBalance: map['customer_balance'] == null
? null
: PaymentMethodCustomerBalance.fromJson(map['customer_balance']),
eps: map['eps'] == null ? null : PaymentMethodEps.fromJson(map['eps']),
fpx: map['fpx'] == null ? null : PaymentMethodFpx.fromJson(map['fpx']),
giropay: map['giropay'] == null
? null
: PaymentMethodGiropay.fromJson(map['giropay']),
grabpay: map['grabpay'] == null
? null
: PaymentMethodGrabpay.fromJson(map['grabpay']),
id: (map['id'] as String),
ideal: map['ideal'] == null
? null
: PaymentMethodIdeal.fromJson(map['ideal']),
interacPresent: map['interac_present'] == null
? null
: PaymentMethodInteracPresent.fromJson(map['interac_present']),
klarna: map['klarna'] == null
? null
: PaymentMethodKlarna.fromJson(map['klarna']),
konbini: map['konbini'] == null
? null
: PaymentMethodKonbini.fromJson(map['konbini']),
link:
map['link'] == null ? null : PaymentMethodLink.fromJson(map['link']),
livemode: (map['livemode'] as bool),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
mobilepay: map['mobilepay'] == null
? null
: PaymentMethodMobilepay.fromJson(map['mobilepay']),
oxxo:
map['oxxo'] == null ? null : PaymentMethodOxxo.fromJson(map['oxxo']),
p24: map['p24'] == null ? null : PaymentMethodP24.fromJson(map['p24']),
paynow: map['paynow'] == null
? null
: PaymentMethodPaynow.fromJson(map['paynow']),
paypal: map['paypal'] == null
? null
: PaymentMethodPaypal.fromJson(map['paypal']),
pix: map['pix'] == null ? null : PaymentMethodPix.fromJson(map['pix']),
promptpay: map['promptpay'] == null
? null
: PaymentMethodPromptpay.fromJson(map['promptpay']),
radarOptions: map['radar_options'] == null
? null
: RadarRadarOptions.fromJson(map['radar_options']),
revolutPay: map['revolut_pay'] == null
? null
: PaymentMethodRevolutPay.fromJson(map['revolut_pay']),
sepaDebit: map['sepa_debit'] == null
? null
: PaymentMethodSepaDebit.fromJson(map['sepa_debit']),
sofort: map['sofort'] == null
? null
: PaymentMethodSofort.fromJson(map['sofort']),
swish: map['swish'] == null
? null
: PaymentMethodSwish.fromJson(map['swish']),
type: ConfirmationTokenPaymentMethodPreviewType.fromJson(map['type']),
usBankAccount: map['us_bank_account'] == null
? null
: PaymentMethodUsBankAccount.fromJson(map['us_bank_account']),
wechatPay: map['wechat_pay'] == null
? null
: PaymentMethodWechatPay.fromJson(map['wechat_pay']),
zip: map['zip'] == null ? null : PaymentMethodZip.fromJson(map['zip']),
);
}