QuickbooksPayment.fromMap constructor

QuickbooksPayment.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory QuickbooksPayment.fromMap(Map<String, dynamic> map) {
  return QuickbooksPayment(
    id: map['Id'],
    totalAmt: double.tryParse(map['totalAmt'].toString()) ?? 0,
    customerRef: QuickbooksReferenceType.fromMap(
        map['CustomerRef'] as Map<String, dynamic>),
    syncToken: map['SyncToken'],
    currencyRef: map['CurrencyRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['CurrencyRef'] as Map<String, dynamic>)
        : null,
    privateNote: map['PrivateNote'],
    paymentMethodRef: map['PaymentMethodRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['PaymentMethodRef'] as Map<String, dynamic>)
        : null,
    unappliedAmt: double.tryParse(map['UnappliedAmt'].toString()),
    depositToAccountRef: map['DepositToAccountRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['DepositToAccountRef'] as Map<String, dynamic>)
        : null,
    exchangeRate: double.tryParse(map['ExchangeRate'].toString()),
    line: map['Line'] != null
        ? List<QuickbooksPaymentLine>.from(
            (map['Line'] as List).map<QuickbooksPaymentLine?>(
              (x) => QuickbooksPaymentLine.fromMap(x as Map<String, dynamic>),
            ),
          )
        : null,
    txnSource: map['TxnSource'],
    ARAccountRef: map['ARAccountRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['ARAccountRef'] as Map<String, dynamic>)
        : null,
    txnDate: DateTime.tryParse(map['TxnDate'].toString()),
    creditCardPayment: map['CreditCardPayment'] != null
        ? QuickbooksCreditCardPayment.fromMap(
            map['CreditCardPayment'] as Map<String, dynamic>)
        : null,
    transactionLocationType: map['TransactionLocationType'],
    metaData: map['MetaData'],
    paymentRefNum: map['PaymentRefNum'],
    taxExemptionRef: map['TaxExemptionRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['TaxExemptionRef'] as Map<String, dynamic>)
        : null,
    active: map['Active'],
  );
}