InvoiceItemUpdateOptions.fromJson constructor
InvoiceItemUpdateOptions.fromJson(
- Object? json
Implementation
factory InvoiceItemUpdateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return InvoiceItemUpdateOptions(
amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
description:
map['description'] == null ? null : (map['description'] as String),
discountable:
map['discountable'] == null ? null : (map['discountable'] as bool),
discounts: map['discounts'] == null
? null
: (map['discounts'] as List<Object?>)
.map((el) => InvoiceItemDiscountsItem.fromJson(el))
.toList(),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
period: map['period'] == null
? null
: InvoiceLineItemPeriod.fromJson(map['period']),
price: map['price'] == null ? null : (map['price'] as String),
priceData: map['price_data'] == null
? null
: InvoiceItemPriceData.fromJson(map['price_data']),
quantity:
map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
taxBehavior: map['tax_behavior'] == null
? null
: ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
taxCode: map['tax_code'] == null ? null : (map['tax_code'] as String),
taxRates: map['tax_rates'] == null
? null
: (map['tax_rates'] as List<Object?>)
.map((el) => (el as String))
.toList(),
unitAmount: map['unit_amount'] == null
? null
: (map['unit_amount'] as num).toInt(),
unitAmountDecimal: map['unit_amount_decimal'] == null
? null
: (map['unit_amount_decimal'] as String),
);
}