SessionSubscriptionData.fromJson constructor
SessionSubscriptionData.fromJson(
- Object? json
Implementation
factory SessionSubscriptionData.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SessionSubscriptionData(
applicationFeePercent: map['application_fee_percent'] == null
? null
: (map['application_fee_percent'] as num).toDouble(),
billingCycleAnchor: map['billing_cycle_anchor'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['billing_cycle_anchor'] as int).toInt()),
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),
invoiceSettings: map['invoice_settings'] == null
? null
: SessionInvoiceSettings.fromJson(map['invoice_settings']),
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
: SessionProrationBehavior.fromJson(map['proration_behavior']),
transferData: map['transfer_data'] == null
? null
: SessionTransferData.fromJson(map['transfer_data']),
trialEnd: map['trial_end'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['trial_end'] as int).toInt()),
trialPeriodDays: map['trial_period_days'] == null
? null
: (map['trial_period_days'] as num).toInt(),
trialSettings: map['trial_settings'] == null
? null
: SessionTrialSettings.fromJson(map['trial_settings']),
);
}