fromMap static method

CreditNote? fromMap(
  1. Object? body
)

Implementation

static CreditNote? fromMap(Object? body) {
  final source = readRecord(body);
  if (source == null) return null;
  return CreditNote(
    account: CreditNoteAccount.fromMap(source['account']),
    accountId: readText(source['account_id']),
    amount: readText(source['amount']),
    code: readText(source['code']),
    createdBy: readAny(source['created_by']),
    createdOn: readText(source['created_on']),
    currency: CreditNoteCurrency.fromMap(source['currency']),
    customAttributes: readList<CreditNoteCustomAttribute>(
        source['custom_attributes'], CreditNoteCustomAttribute.fromMap),
    customObjects: readList<Object>(source['custom_objects'], readAny),
    date: readText(source['date']),
    href: readText(source['href']),
    id: readText(source['id']),
    initialAmount: readText(source['initial_amount']),
    invoiceId: readText(source['invoice_id']),
    invoices: readList<CreditNoteInvoice>(
        source['invoices'], CreditNoteInvoice.fromMap),
    issueDate: readText(source['issue_date']),
    lastUpdatedBy: CreditNoteLastUpdatedBy.fromMap(source['last_updated_by']),
    lastUpdatedOn: readText(source['last_updated_on']),
    object: readText(source['object']),
    payment: CreditNotePayment.fromMap(source['payment']),
    paymentId: readText(source['payment_id']),
    refundAmount: readText(source['refund_amount']),
    refundable: readAny(source['refundable']),
    remainingAmount: readText(source['remaining_amount']),
    remainingBalance: readText(source['remaining_balance']),
    status: readText(source['status']),
    updatedBy: readText(source['updated_by']),
    updatedOn: readText(source['updated_on']),
    uuid: readText(source['uuid']),
    version: readAny(source['version']),
  );
}