IssuingAuthorization.fromJson constructor
IssuingAuthorization.fromJson(
- Object? json
Implementation
factory IssuingAuthorization.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return IssuingAuthorization(
amount: (map['amount'] as num).toInt(),
amountDetails: map['amount_details'] == null
? null
: IssuingAuthorizationAmountDetails.fromJson(map['amount_details']),
approved: (map['approved'] as bool),
authorizationMethod: IssuingAuthorizationAuthorizationMethod.fromJson(
map['authorization_method']),
balanceTransactions: (map['balance_transactions'] as List<Object?>)
.map((el) => BalanceTransaction.fromJson(el))
.toList(),
card: IssuingCard.fromJson(map['card']),
cardholder: map['cardholder'] == null
? null
: IssuingCardholderOrId.fromJson(map['cardholder']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
id: (map['id'] as String),
livemode: (map['livemode'] as bool),
merchantAmount: (map['merchant_amount'] as num).toInt(),
merchantCurrency: (map['merchant_currency'] as String),
merchantData:
IssuingAuthorizationMerchantData.fromJson(map['merchant_data']),
metadata: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
networkData: map['network_data'] == null
? null
: IssuingAuthorizationNetworkData.fromJson(map['network_data']),
pendingRequest: map['pending_request'] == null
? null
: IssuingAuthorizationPendingRequest.fromJson(map['pending_request']),
requestHistory: (map['request_history'] as List<Object?>)
.map((el) => IssuingAuthorizationRequest.fromJson(el))
.toList(),
status: IssuingAuthorizationStatus.fromJson(map['status']),
token:
map['token'] == null ? null : IssuingTokenOrId.fromJson(map['token']),
transactions: (map['transactions'] as List<Object?>)
.map((el) => IssuingTransaction.fromJson(el))
.toList(),
treasury: map['treasury'] == null
? null
: IssuingAuthorizationTreasury.fromJson(map['treasury']),
verificationData: IssuingAuthorizationVerificationData.fromJson(
map['verification_data']),
wallet: map['wallet'] == null ? null : (map['wallet'] as String),
);
}