fromMap static method

PurchasePayment? fromMap(
  1. Object? body
)

Implementation

static PurchasePayment? fromMap(Object? body) {
  final source = readRecord(body);
  if (source == null) return null;
  return PurchasePayment(
    account: PurchasePaymentAccount.fromMap(source['account']),
    code: readText(source['code']),
    createdBy: readAny(source['created_by']),
    createdOn: readText(source['created_on']),
    creditNoteApplications: readList<PurchasePaymentCreditNoteApplication>(
        source['credit_note_applications'],
        PurchasePaymentCreditNoteApplication.fromMap),
    creditNoteTotal: readText(source['credit_note_total']),
    currency: PurchasePaymentCurrency.fromMap(source['currency']),
    customAttributes: readList<Object>(source['custom_attributes'], readAny),
    customObjects: readList<Object>(source['custom_objects'], readAny),
    href: readText(source['href']),
    id: readText(source['id']),
    lastUpdatedBy: readAny(source['last_updated_by']),
    lastUpdatedOn: readText(source['last_updated_on']),
    object: readText(source['object']),
    origin: readText(source['origin']),
    paidTotal: readText(source['paid_total']),
    paymentDate: readText(source['payment_date']),
    paymentMethodApplications:
        readList<PurchasePaymentPaymentMethodApplication>(
            source['payment_method_applications'],
            PurchasePaymentPaymentMethodApplication.fromMap),
    paymentNote: readText(source['payment_note']),
    paymentReference: readAny(source['payment_reference']),
    purchaseCreditApplied:
        readList<Object>(source['purchase_credit_applied'], readAny),
    purchaseInvoiceApplications:
        readList<PurchasePaymentPurchaseInvoiceApplication>(
            source['purchase_invoice_applications'],
            PurchasePaymentPurchaseInvoiceApplication.fromMap),
    purchaseInvoices: readList<Object>(source['purchase_invoices'], readAny),
    purchaseOrderId: readText(source['purchase_order_id']),
    purchasePaymentApplied:
        readList<Object>(source['purchase_payment_applied'], readAny),
    purchasePaymentDate: readText(source['purchase_payment_date']),
    purchasePaymentNote: readText(source['purchase_payment_note']),
    status: readText(source['status']),
    totalApplied: readText(source['total_applied']),
    uuid: readText(source['uuid']),
    version: readAny(source['version']),
  );
}