TransactionData.fromJson constructor

TransactionData.fromJson(
  1. dynamic data
)

Implementation

factory TransactionData.fromJson(dynamic data) {
  var json = DynamicJsonExtension.getJsonMap(data);
  var billingData = json['billing_data'] ?? json['billingData'];
  var amount = json['amount']?.toDouble();
  var externalActionMessage = List<String>.from(
      json['external_action_message'] ?? json["externalActionMessage"] ?? []);
  var amountCurrency = json['amount_currency'] ?? json['amountCurrency'];
  var id = json['id'];
  var methodName = json['method_name'] ?? json['methodName'];
  var method = json['method'];
  var createdDate = json['created_date'] ?? json['createdDate'];
  var status = json['status'];
  var customFields = json['custom_fields'] ?? json['customFields'];
  var providerTransactionFields = json['provider_transaction_fields'] ??
      json['providerTransactionFields'];
  var customFormAnswers =
      json['custom_form_answers'] ?? json['customFormAnswers'];

  return TransactionData(
    billingData: billingData.toString(),
    amount: amount,
    externalActionMessage: externalActionMessage,
    amountCurrency: amountCurrency,
    id: id.toString(),
    methodName: methodName,
    method: method,
    createdDate: createdDate,
    status: status,
    customFields: customFields?.toString(),
    providerTransactionFields: providerTransactionFields?.toString(),
    customFormAnswers: customFormAnswers?.toString(),
  );
}