PaymentMethodDetailsCardPresent.fromJson constructor

PaymentMethodDetailsCardPresent.fromJson(
  1. Object? json
)

Implementation

factory PaymentMethodDetailsCardPresent.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PaymentMethodDetailsCardPresent(
    amountAuthorized: map['amount_authorized'] == null
        ? null
        : (map['amount_authorized'] as num).toInt(),
    brand: map['brand'] == null ? null : (map['brand'] as String),
    captureBefore: map['capture_before'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['capture_before'] as int).toInt()),
    cardholderName: map['cardholder_name'] == null
        ? null
        : (map['cardholder_name'] as String),
    country: map['country'] == null ? null : (map['country'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    emvAuthData: map['emv_auth_data'] == null
        ? null
        : (map['emv_auth_data'] as String),
    expMonth: (map['exp_month'] as num).toInt(),
    expYear: (map['exp_year'] as num).toInt(),
    fingerprint:
        map['fingerprint'] == null ? null : (map['fingerprint'] as String),
    funding: map['funding'] == null ? null : (map['funding'] as String),
    generatedCard: map['generated_card'] == null
        ? null
        : (map['generated_card'] as String),
    iin: map['iin'] == null ? null : (map['iin'] as String),
    incrementalAuthorizationSupported:
        (map['incremental_authorization_supported'] as bool),
    issuer: map['issuer'] == null ? null : (map['issuer'] as String),
    last4: map['last4'] == null ? null : (map['last4'] as String),
    network: map['network'] == null ? null : (map['network'] as String),
    offline: map['offline'] == null
        ? null
        : PaymentMethodDetailsCardPresentOffline.fromJson(map['offline']),
    overcaptureSupported: (map['overcapture_supported'] as bool),
    readMethod: map['read_method'] == null
        ? null
        : PaymentMethodCardPresentReadMethod.fromJson(map['read_method']),
    receipt: map['receipt'] == null
        ? null
        : PaymentMethodDetailsCardPresentReceipt.fromJson(map['receipt']),
  );
}