IssuingAuthorizationRequest.fromJson constructor

IssuingAuthorizationRequest.fromJson(
  1. Object? json
)

Implementation

factory IssuingAuthorizationRequest.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return IssuingAuthorizationRequest(
    amount: (map['amount'] as num).toInt(),
    amountDetails: map['amount_details'] == null
        ? null
        : IssuingAuthorizationAmountDetails.fromJson(map['amount_details']),
    approved: (map['approved'] as bool),
    authorizationCode: map['authorization_code'] == null
        ? null
        : (map['authorization_code'] as String),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    merchantAmount: (map['merchant_amount'] as num).toInt(),
    merchantCurrency: (map['merchant_currency'] as String),
    networkRiskScore: map['network_risk_score'] == null
        ? null
        : (map['network_risk_score'] as num).toInt(),
    reason: IssuingAuthorizationRequestReason.fromJson(map['reason']),
    reasonMessage: map['reason_message'] == null
        ? null
        : (map['reason_message'] as String),
    requestedAt: map['requested_at'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['requested_at'] as int).toInt()),
  );
}