PaymentIntentResponseAttributes.fromMap constructor
PaymentIntentResponseAttributes.fromMap(
- Map<String, dynamic> map
)
Implementation
factory PaymentIntentResponseAttributes.fromMap(Map<String, dynamic> map) {
return PaymentIntentResponseAttributes(
amount: map['amount'] ?? 0,
currency: map['currency'] ?? '',
description: map['description'] ?? '',
statementDescriptor: map['statement_descriptor'] ?? '',
status: map['status'] ?? '',
livemode: map['livemode'] ?? false,
clientKey: map['client_key'] ?? '',
createdAt: fromTimeStamp(map['created_at']) ?? DateTime.now(),
updatedAt: fromTimeStamp(map['updated_at']) ?? DateTime.now(),
lastPaymentError: map['last_payment_error'] ?? '',
paymentMethodAllowed:
List<String>.from(map['payment_method_allowed'] ?? const []),
payments: map['payments'] != null
? List<Map<String, dynamic>>.from(
map['payments'] ?? const [],
).map(PaymentsIntentResponse.fromMap).toList()
: [],
nextAction: map['next_action'] != null
? PaymentIntentNextAction.fromMap(map['next_action'])
: null,
paymentMethodOptions:
PaymentMethodOptions.fromMap(map['payment_method_options']),
metadata: Map<String, dynamic>.from(map['metadata'] ?? const {}),
);
}