fromIosJson static method
iosç¨
Implementation
static AWProduct fromIosJson(Map<String, dynamic> json) {
final product = AWProduct();
product.productId = json["productIdentifier"];
product.price = json["localizedPrice"];
product.priceAmount = json["price"];
// product.priceCurrency = json["price_currency_code"];
product.title = json["localizedTitle"];
product.description = json["localizedDescription"];
if (json["type"] == AWProduct.PRODUCT_TYPE_SUBS) {
product.subscriptionPeriod = json["subscriptionPeriod"];
if (json["introductoryAmountPrice"] != null &&
json["price_currency_code"] != null &&
json["price_currency_code"].toString().length > 0 &&
json["introductoryPricePeriod"] != null &&
json["introductoryPricePeriod"].toString().length > 0 &&
json["introductoryPriceCycles"] != null)
product.introductDiscount = ProductDiscount.fromAndroidParams(
json["introductoryAmountPrice"],
json["price_currency_code"],
json["introductoryPricePeriod"],
json["introductoryPriceCycles"]);
product.discounts = json["freeTrialPeriod"] == null ||
json["freeTrialPeriod"].toString().length <= 0
? null
: [
ProductDiscount.fromAndroidParams(
0, json["price_currency_code"], json["freeTrialPeriod"], 1)
];
}
return product;
}