PriceCreateOptions.fromJson constructor
PriceCreateOptions.fromJson(
- Object? json
Implementation
factory PriceCreateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return PriceCreateOptions(
active: map['active'] == null ? null : (map['active'] as bool),
billingScheme: map['billing_scheme'] == null
? null
: InvoiceitemPlanBillingScheme.fromJson(map['billing_scheme']),
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),
)),
customUnitAmount: map['custom_unit_amount'] == null
? null
: PriceCustomUnitAmount.fromJson(map['custom_unit_amount']),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
lookupKey:
map['lookup_key'] == null ? null : (map['lookup_key'] as String),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
nickname: map['nickname'] == null ? null : (map['nickname'] as String),
product: map['product'] == null ? null : (map['product'] as String),
productData: map['product_data'] == null
? null
: PlanProductInlineProductParams.fromJson(map['product_data']),
recurring: map['recurring'] == null
? null
: PriceRecurring.fromJson(map['recurring']),
taxBehavior: map['tax_behavior'] == null
? null
: ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
tiers: map['tiers'] == null
? null
: (map['tiers'] as List<Object?>)
.map((el) => PlanTiersItem.fromJson(el))
.toList(),
tiersMode: map['tiers_mode'] == null
? null
: PlanTiersMode.fromJson(map['tiers_mode']),
transferLookupKey: map['transfer_lookup_key'] == null
? null
: (map['transfer_lookup_key'] as bool),
transformQuantity: map['transform_quantity'] == null
? null
: TransformUsage.fromJson(map['transform_quantity']),
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),
);
}