SubscriptionSchedule.fromJson constructor
SubscriptionSchedule.fromJson(
- Object? json
Implementation
factory SubscriptionSchedule.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SubscriptionSchedule(
application: map['application'] == null
? null
: BillingPortalConfigurationApplicationOrId.fromJson(
map['application']),
canceledAt: map['canceled_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['canceled_at'] as int).toInt()),
completedAt: map['completed_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['completed_at'] as int).toInt()),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currentPhase: map['current_phase'] == null
? null
: SubscriptionScheduleCurrentPhase.fromJson(map['current_phase']),
customer: BankAccountCustomerOrId.fromJson(map['customer']),
defaultSettings: SubscriptionSchedulesResourceDefaultSettings.fromJson(
map['default_settings']),
endBehavior:
SubscriptionScheduleEndBehavior.fromJson(map['end_behavior']),
id: (map['id'] as String),
livemode: (map['livemode'] as bool),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
phases: (map['phases'] as List<Object?>)
.map((el) => SubscriptionSchedulePhaseConfiguration.fromJson(el))
.toList(),
releasedAt: map['released_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['released_at'] as int).toInt()),
releasedSubscription: map['released_subscription'] == null
? null
: (map['released_subscription'] as String),
status: SubscriptionScheduleStatus.fromJson(map['status']),
subscription: map['subscription'] == null
? null
: SubscriptionOrId.fromJson(map['subscription']),
testClock: map['test_clock'] == null
? null
: TestHelpersTestClockOrId.fromJson(map['test_clock']),
);
}