SumupPluginCheckoutResponse.fromMap constructor
SumupPluginCheckoutResponse.fromMap(
- Map response
Implementation
SumupPluginCheckoutResponse.fromMap(Map<dynamic, dynamic> response) {
success = response['success'];
transactionCode = response['transactionCode'];
amount = _parseDouble(response['amount']);
currency = response['currency'];
vatAmount = _parseDouble(response['vatAmount']);
tipAmount = _parseDouble(response['tipAmount']);
paymentType = response['paymentType'];
entryMode = response['entryMode'];
final rawInstallments = response['installments'];
installments = rawInstallments is num
? rawInstallments.toInt()
: int.tryParse(rawInstallments?.toString() ?? '');
cardType = response['cardType'];
cardLastDigits = response['cardLastDigits'];
userDismissedSuccessScreen = response['userDismissedSuccessScreen'] as bool?;
errors = response['errors']?.toString();
merchantCode = response['merchantCode']?.toString();
cardScheme = response['cardScheme']?.toString();
final rawProducts = response['products'];
if (rawProducts is List) {
products = rawProducts
.whereType<Map>()
.map((e) => SumupProduct.fromMap(e))
.toList();
}
foreignTransactionId = response['foreignTransactionId'];
receiptSent = response['receiptSent'];
}