ProductDefaultPriceData.fromJson constructor

ProductDefaultPriceData.fromJson(
  1. Object? json
)

Implementation

factory ProductDefaultPriceData.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ProductDefaultPriceData(
    currency: (map['currency'] as String),
    currencyOptions: map['currency_options'] == null
        ? null
        : (map['currency_options'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  PriceCurrencyOptionsValue.fromJson(value),
                )),
    recurring: map['recurring'] == null
        ? null
        : SessionRecurring.fromJson(map['recurring']),
    taxBehavior: map['tax_behavior'] == null
        ? null
        : ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
    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),
  );
}