fromMap static method

Implementation

static SettingsDiscountProfileRead? fromMap(Object? body) {
  final source = readRecord(body, envelopeKey: 'discount_profile');
  if (source == null) return null;
  return SettingsDiscountProfileRead(
    accountingCode: SettingsDiscountProfileAccountingCode.fromMap(
        source['accounting_code']),
    createdBy: readAny(source['created_by']),
    createdOn: readText(source['created_on']),
    description: readText(source['description']),
    discountType: readText(source['discount_type']),
    displayName: readText(source['display_name']),
    endTime: readText(source['end_time']),
    fixedAmount: readDecimal(source['fixed_amount']),
    href: readText(source['href']),
    id: readText(source['id']),
    invoiceNote: readText(source['invoice_note']),
    lastUpdatedBy: readAny(source['last_updated_by']),
    lastUpdatedOn: readText(source['last_updated_on']),
    maxUsePerAccount: readInteger(source['max_use_per_account']),
    maxUsePerOrder: readInteger(source['max_use_per_order']),
    maxUseTotal: readInteger(source['max_use_total']),
    name: readText(source['name']),
    object: readText(source['object']),
    ownerType: readText(source['owner_type']),
    percentageAmount: readDecimal(source['percentage_amount']),
    priceIsInclusiveOfDiscount:
        readFlag(source['price_is_inclusive_of_discount']),
    priority: readInteger(source['priority']),
    redemptionRequired: readFlag(source['redemption_required']),
    stackable: readFlag(source['stackable']),
    startTime: readText(source['start_time']),
    status: readText(source['status']),
    taxCode: SettingsDiscountProfileTaxCode.fromMap(source['tax_code']),
    version: readInteger(source['version']),
  );
}