TaxTransactionLineItem.fromJson constructor
TaxTransactionLineItem.fromJson(
- Object? json
Implementation
factory TaxTransactionLineItem.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return TaxTransactionLineItem(
amount: (map['amount'] as num).toInt(),
amountTax: (map['amount_tax'] as num).toInt(),
id: (map['id'] as String),
livemode: (map['livemode'] as bool),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
product: map['product'] == null ? null : (map['product'] as String),
quantity: (map['quantity'] as num).toInt(),
reference: (map['reference'] as String),
reversal: map['reversal'] == null
? null
: TaxTransactionLineItemReversal.fromJson(map['reversal']),
taxBehavior:
TaxCalculationShippingCostTaxBehavior.fromJson(map['tax_behavior']),
taxCode: (map['tax_code'] as String),
type: TaxTransactionType.fromJson(map['type']),
);
}