TaxTransaction.fromJson constructor
TaxTransaction.fromJson(
- Object? json
Implementation
factory TaxTransaction.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return TaxTransaction(
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
customer: map['customer'] == null ? null : (map['customer'] as String),
customerDetails:
TaxProductResourceCustomerDetails.fromJson(map['customer_details']),
id: (map['id'] as String),
lineItems: map['line_items'] == null
? null
: TaxTransactionLineItems.fromJson(map['line_items']),
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),
)),
reference: (map['reference'] as String),
reversal: map['reversal'] == null
? null
: TaxTransactionReversal.fromJson(map['reversal']),
shippingCost: map['shipping_cost'] == null
? null
: TaxCalculationShippingCost.fromJson(map['shipping_cost']),
taxDate:
DateTime.fromMillisecondsSinceEpoch((map['tax_date'] as int).toInt()),
type: TaxTransactionType.fromJson(map['type']),
);
}