TransInfo.fromJson constructor

TransInfo.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory TransInfo.fromJson(Map<String, dynamic> json) {
  List<BankPaymentMethod> bankPaymentMethodList = <BankPaymentMethod>[];
  if (json['bank_payment_method'] != null) {
    bankPaymentMethodList = List<BankPaymentMethod>.from(
        json['bank_payment_method']
            .map((model) => BankPaymentMethod.fromJson(model)));
  }
  return TransInfo(
    tranId: json['tran_id'] ?? '',
    identityCode: json['identity_code'] ?? '',
    tranNo: json['tran_no'],
    tranAmount: (json['tran_amount'] ?? '' as num).toDouble(),
    tranAmountDisplay: json['tran_amount_display'],
    totalAmount: (json['total_amount'] ?? '' as num).toDouble(),
    totalAmountDisplay: json['total_amount_display'] ?? '',
    feeAmount: (json['fee_amount'] ?? '' as num).toDouble(),
    feeAmountDisplay: json['fee_amount_display'] ?? '',
    currency: json['currency'] ?? '',
    isAllowFavorite: json['is_allow_favorite'] ?? '',
    customerCode: json['customer_code'] ?? '',
    customerName: json['customer_name'] ?? '',
    customerEmail: json['customer_email'] ?? '',
    customerPhone: json['customer_phone'] ?? '',
    tranDate: json['tran_date'] ?? '',
    expiredDate: json['expired_date'] ?? '',
    bankRefId: json['bank_ref_id'] ?? '',
    status: json['status'] ?? '',
    cancelUrl: json['cancel_url'] ?? '',
    redirectUrl: json['redirect_url'] ?? '',
    paymentLink: json['payment_link'] ?? '',
    language: json['language'] ?? '',
    khqrImage: json['khqr_image'] ?? '',
    khqrString: json['khqr_string'] ?? '',
    description: json['description'] ?? '',
    bankPaymentMethod: bankPaymentMethodList,
  );
}