fromMap static method

CreditNoteRead? fromMap(
  1. Object? body
)

Implementation

static CreditNoteRead? fromMap(Object? body) {
  final source = readRecord(body, envelopeKey: 'credit_note');
  if (source == null) return null;
  return CreditNoteRead(
    account: CreditNoteReadAccount.fromMap(source['account']),
    code: readText(source['code']),
    createdBy: CreditNoteReadCreatedBy.fromMap(source['created_by']),
    createdOn: readText(source['created_on']),
    currency: CreditNoteReadCurrency.fromMap(source['currency']),
    customAttributes: readList<CreditNoteReadCustomAttribute>(
        source['custom_attributes'], CreditNoteReadCustomAttribute.fromMap),
    href: readText(source['href']),
    id: readText(source['id']),
    initialAmount: readText(source['initial_amount']),
    invoices: readList<CreditNoteReadInvoice>(
        source['invoices'], CreditNoteReadInvoice.fromMap),
    issueDate: readText(source['issue_date']),
    lastUpdatedBy:
        CreditNoteReadLastUpdatedBy.fromMap(source['last_updated_by']),
    lastUpdatedOn: readText(source['last_updated_on']),
    object: readText(source['object']),
    payment: CreditNoteReadPayment.fromMap(source['payment']),
    refundAmount: readText(source['refund_amount']),
    refundable: readFlag(source['refundable']),
    remainingAmount: readText(source['remaining_amount']),
    status: readText(source['status']),
    version: readInteger(source['version']),
  );
}