PromotionCodesResourceRestrictions.fromJson constructor

PromotionCodesResourceRestrictions.fromJson(
  1. Object? json
)

Implementation

factory PromotionCodesResourceRestrictions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PromotionCodesResourceRestrictions(
    currencyOptions: map['currency_options'] == null
        ? null
        : (map['currency_options'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  PromotionCodeCurrencyOption.fromJson(value),
                )),
    firstTimeTransaction: (map['first_time_transaction'] as bool),
    minimumAmount: map['minimum_amount'] == null
        ? null
        : (map['minimum_amount'] as num).toInt(),
    minimumAmountCurrency: map['minimum_amount_currency'] == null
        ? null
        : (map['minimum_amount_currency'] as String),
  );
}