SubscriptionsResourcePendingUpdate.fromJson constructor

SubscriptionsResourcePendingUpdate.fromJson(
  1. Object? json
)

Implementation

factory SubscriptionsResourcePendingUpdate.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SubscriptionsResourcePendingUpdate(
    billingCycleAnchor: map['billing_cycle_anchor'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['billing_cycle_anchor'] as int).toInt()),
    expiresAt: DateTime.fromMillisecondsSinceEpoch(
        (map['expires_at'] as int).toInt()),
    subscriptionItems: map['subscription_items'] == null
        ? null
        : (map['subscription_items'] as List<Object?>)
            .map((el) => SubscriptionItem.fromJson(el))
            .toList(),
    trialEnd: map['trial_end'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['trial_end'] as int).toInt()),
    trialFromPlan: map['trial_from_plan'] == null
        ? null
        : (map['trial_from_plan'] as bool),
  );
}