SubscriptionResumeOptions.fromJson constructor

SubscriptionResumeOptions.fromJson(
  1. Object? json
)

Implementation

factory SubscriptionResumeOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SubscriptionResumeOptions(
    billingCycleAnchor: map['billing_cycle_anchor'] == null
        ? null
        : SubscriptionBillingCycleAnchor.fromJson(
            map['billing_cycle_anchor']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    prorationBehavior: map['proration_behavior'] == null
        ? null
        : PortalSubscriptionCancelProrationBehavior.fromJson(
            map['proration_behavior']),
    prorationDate: map['proration_date'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['proration_date'] as int).toInt()),
  );
}