IssuingCard.fromJson constructor
IssuingCard.fromJson(
- Object? json
Implementation
factory IssuingCard.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return IssuingCard(
brand: (map['brand'] as String),
cancellationReason: map['cancellation_reason'] == null
? null
: IssuingCardCancellationReason.fromJson(map['cancellation_reason']),
cardholder: IssuingCardholder.fromJson(map['cardholder']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
cvc: map['cvc'] == null ? null : (map['cvc'] as String),
expMonth: (map['exp_month'] as num).toInt(),
expYear: (map['exp_year'] as num).toInt(),
financialAccount: map['financial_account'] == null
? null
: (map['financial_account'] as String),
id: (map['id'] as String),
last4: (map['last4'] as String),
livemode: (map['livemode'] as bool),
metadata: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
number: map['number'] == null ? null : (map['number'] as String),
personalizationDesign: map['personalization_design'] == null
? null
: IssuingPersonalizationDesignOrId.fromJson(
map['personalization_design']),
replacedBy: map['replaced_by'] == null
? null
: IssuingCardOrId.fromJson(map['replaced_by']),
replacementFor: map['replacement_for'] == null
? null
: IssuingCardOrId.fromJson(map['replacement_for']),
replacementReason: map['replacement_reason'] == null
? null
: IssuingCardReplacementReason.fromJson(map['replacement_reason']),
shipping: map['shipping'] == null
? null
: IssuingCardShipping.fromJson(map['shipping']),
spendingControls:
IssuingCardAuthorizationControls.fromJson(map['spending_controls']),
status: IssuingCardStatus.fromJson(map['status']),
type: IssuingCardType.fromJson(map['type']),
wallets: map['wallets'] == null
? null
: IssuingCardWallets.fromJson(map['wallets']),
);
}