CustomerUpdateOptions.fromJson constructor
CustomerUpdateOptions.fromJson(
- Object? json
Implementation
factory CustomerUpdateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return CustomerUpdateOptions(
address: map['address'] == null
? null
: AccountSupportAddress.fromJson(map['address']),
balance: map['balance'] == null ? null : (map['balance'] as num).toInt(),
cashBalance: map['cash_balance'] == null
? null
: CustomerCashBalance.fromJson(map['cash_balance']),
coupon: map['coupon'] == null ? null : (map['coupon'] as String),
defaultSource: map['default_source'] == null
? null
: (map['default_source'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
email: map['email'] == null ? null : (map['email'] as String),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
invoicePrefix: map['invoice_prefix'] == null
? null
: (map['invoice_prefix'] as String),
invoiceSettings: map['invoice_settings'] == null
? null
: CustomerInvoiceSettings.fromJson(map['invoice_settings']),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
name: map['name'] == null ? null : (map['name'] as String),
nextInvoiceSequence: map['next_invoice_sequence'] == null
? null
: (map['next_invoice_sequence'] as num).toInt(),
phone: map['phone'] == null ? null : (map['phone'] as String),
preferredLocales: map['preferred_locales'] == null
? null
: (map['preferred_locales'] as List<Object?>)
.map((el) => (el as String))
.toList(),
promotionCode: map['promotion_code'] == null
? null
: (map['promotion_code'] as String),
shipping: map['shipping'] == null
? null
: CustomerShipping.fromJson(map['shipping']),
source: map['source'] == null ? null : (map['source'] as String),
tax: map['tax'] == null ? null : CustomerTax.fromJson(map['tax']),
taxExempt: map['tax_exempt'] == null
? null
: CustomerTaxExempt.fromJson(map['tax_exempt']),
validate: map['validate'] == null ? null : (map['validate'] as bool),
);
}