TaxTransactionCreateReversalOptions.fromJson constructor

TaxTransactionCreateReversalOptions.fromJson(
  1. Object? json
)

Implementation

factory TaxTransactionCreateReversalOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TaxTransactionCreateReversalOptions(
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    flatAmount: map['flat_amount'] == null
        ? null
        : (map['flat_amount'] as num).toInt(),
    lineItems: map['line_items'] == null
        ? null
        : (map['line_items'] as List<Object?>)
            .map((el) => TransactionLineItemsItem.fromJson(el))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    mode: TransactionMode.fromJson(map['mode']),
    originalTransaction: (map['original_transaction'] as String),
    reference: (map['reference'] as String),
    shippingCost: map['shipping_cost'] == null
        ? null
        : TransactionShippingCost.fromJson(map['shipping_cost']),
  );
}