SubscriptionScheduleUpdateOptions.fromJson constructor

SubscriptionScheduleUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory SubscriptionScheduleUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SubscriptionScheduleUpdateOptions(
    defaultSettings: map['default_settings'] == null
        ? null
        : SubscriptionScheduleDefaultSettings.fromJson(
            map['default_settings']),
    endBehavior: map['end_behavior'] == null
        ? null
        : SubscriptionScheduleEndBehavior.fromJson(map['end_behavior']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    phases: map['phases'] == null
        ? null
        : (map['phases'] as List<Object?>)
            .map((el) =>
                SubscriptionScheduleUpdateOptionsPhasesItem.fromJson(el))
            .toList(),
    prorationBehavior: map['proration_behavior'] == null
        ? null
        : PortalSubscriptionCancelProrationBehavior.fromJson(
            map['proration_behavior']),
  );
}