SubscriptionScheduleUpdateOptionsPhasesItem.fromJson constructor
SubscriptionScheduleUpdateOptionsPhasesItem.fromJson(
- Object? json
Implementation
factory SubscriptionScheduleUpdateOptionsPhasesItem.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SubscriptionScheduleUpdateOptionsPhasesItem(
addInvoiceItems: map['add_invoice_items'] == null
? null
: (map['add_invoice_items'] as List<Object?>)
.map((el) => SubscriptionScheduleAddInvoiceItemsItem.fromJson(el))
.toList(),
applicationFeePercent: map['application_fee_percent'] == null
? null
: (map['application_fee_percent'] as num).toDouble(),
automaticTax: map['automatic_tax'] == null
? null
: SessionAutomaticTax.fromJson(map['automatic_tax']),
billingCycleAnchor: map['billing_cycle_anchor'] == null
? null
: SubscriptionSchedulesResourceDefaultSettingsBillingCycleAnchor
.fromJson(map['billing_cycle_anchor']),
billingThresholds: map['billing_thresholds'] == null
? null
: SubscriptionScheduleBillingThresholds.fromJson(
map['billing_thresholds']),
collectionMethod: map['collection_method'] == null
? null
: InvoiceCollectionMethod.fromJson(map['collection_method']),
coupon: map['coupon'] == null ? null : (map['coupon'] as String),
currency: map['currency'] == null ? null : (map['currency'] as String),
defaultPaymentMethod: map['default_payment_method'] == null
? null
: (map['default_payment_method'] as String),
defaultTaxRates: map['default_tax_rates'] == null
? null
: (map['default_tax_rates'] as List<Object?>)
.map((el) => (el as String))
.toList(),
description:
map['description'] == null ? null : (map['description'] as String),
endDate: map['end_date'] == null
? null
: SubscriptionScheduleEndDate.fromJson(map['end_date']),
invoiceSettings: map['invoice_settings'] == null
? null
: SubscriptionScheduleInvoiceSettings.fromJson(
map['invoice_settings']),
items: (map['items'] as List<Object?>)
.map((el) => SubscriptionScheduleItemsItem.fromJson(el))
.toList(),
iterations:
map['iterations'] == null ? null : (map['iterations'] as num).toInt(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
onBehalfOf:
map['on_behalf_of'] == null ? null : (map['on_behalf_of'] as String),
prorationBehavior: map['proration_behavior'] == null
? null
: PortalSubscriptionCancelProrationBehavior.fromJson(
map['proration_behavior']),
startDate: map['start_date'] == null
? null
: SubscriptionScheduleStartDate.fromJson(map['start_date']),
transferData: map['transfer_data'] == null
? null
: SessionTransferData.fromJson(map['transfer_data']),
trial: map['trial'] == null ? null : (map['trial'] as bool),
trialEnd: map['trial_end'] == null
? null
: SubscriptionScheduleTrialEnd.fromJson(map['trial_end']),
);
}