fromJson static method
Returns a new TransactionResponseV2 instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static TransactionResponseV2? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "TransactionResponseV2[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "TransactionResponseV2[$key]" has a null value in JSON.');
});
return true;
}());
return TransactionResponseV2(
publicId: mapValueOfType<String>(json, r'publicId'),
requestId: mapValueOfType<String>(json, r'requestId'),
codeEnvoi: mapValueOfType<String>(json, r'codeEnvoi'),
montant: mapValueOfType<double>(json, r'montant'),
fraisEnvoi: mapValueOfType<double>(json, r'fraisEnvoi'),
reduction: mapValueOfType<double>(json, r'reduction'),
fraisInclus: mapValueOfType<bool>(json, r'fraisInclus'),
total: mapValueOfType<double>(json, r'total'),
statusTransaction: mapValueOfType<String>(json, r'statusTransaction'),
typeTransaction: mapValueOfType<String>(json, r'typeTransaction'),
typeOperation: mapValueOfType<String>(json, r'typeOperation'),
nomExpediteur: mapValueOfType<String>(json, r'nomExpediteur'),
prenomExpediteur: mapValueOfType<String>(json, r'prenomExpediteur'),
telephoneExpediteur: mapValueOfType<String>(json, r'telephoneExpediteur'),
nomDestinataire: mapValueOfType<String>(json, r'nomDestinataire'),
prenomDestinataire: mapValueOfType<String>(json, r'prenomDestinataire'),
telephoneDestinataire: mapValueOfType<String>(json, r'telephoneDestinataire'),
villeDestinataire: mapValueOfType<String>(json, r'villeDestinataire'),
paysDestinataire: mapValueOfType<String>(json, r'paysDestinataire'),
dateTransaction: mapDateTime(json, r'dateTransaction', r''),
);
}
return null;
}