PaymentAttributesResponse.fromMap constructor
PaymentAttributesResponse.fromMap(
- Map<String, dynamic> map
)
Implementation
factory PaymentAttributesResponse.fromMap(Map<String, dynamic> map) {
return PaymentAttributesResponse(
accessUrl: map['access_url'],
amount: map['amount'] ?? 0,
balanceTransactionId: map['balance_transaction_id'] ?? '',
billing: map['billing'] != null
? PayMongoBilling.fromMap(map['billing'])
: null,
currency: map['currency'] ?? '',
description: map['description'] ?? '',
disputed: map['disputed'] ?? false,
externalReferenceNumber: map['external_reference_number'],
fee: map['fee'] ?? 0,
foreignFee: map['foreign_fee'] ?? 0,
livemode: map['livemode'] ?? false,
netAmount: map['net_amount'] ?? 0,
origin: map['origin'] ?? '',
paymentIntentId: map['payment_intent_id'] ?? '',
payout: map['payout'] ?? '',
source: map['source'] != null
? PaymentAttributeSourceResponse.fromMap(map['source'])
: null,
statementDescriptor: map['statement_descriptor'] ?? '',
status: map['status'] ?? '',
taxAmount: map['tax_amount'],
availableAt: map['available_at'] != null
? DateTime.fromMillisecondsSinceEpoch(map['available_at'])
: null,
createdAt: fromTimeStamp(map['created_at']),
updatedAt: fromTimeStamp(map['updated_at']),
paidAt: fromTimeStamp(map['paid_at']),
refunds: map['refunds'] != null
? List<Map<String, dynamic>>.from(
map['refunds'] ?? [],
).map(PaymentRefundResponse.fromMap).toList()
: null,
taxes: map['taxes'] != null
? List<Map<String, dynamic>>.from(
map['taxes'],
).map(PaymentTaxResponse.fromMap).toList()
: null,
);
}