mapFlutterPurchaseDiscountItemToPurchaseDiscountItem function
PurchaseDiscountItem
mapFlutterPurchaseDiscountItemToPurchaseDiscountItem(
- FlutterPurchaseDiscountItemWrapper flutterDiscountItem
Implementation
PurchaseDiscountItem mapFlutterPurchaseDiscountItemToPurchaseDiscountItem(
FlutterPurchaseDiscountItemWrapper flutterDiscountItem) {
final promotionDiscount = flutterDiscountItem.promotionDiscount;
if (promotionDiscount != null) {
return PromotionDiscount._(
discountValue: promotionDiscount.discountValue,
code: promotionDiscount.code,
);
}
final couponDiscount = flutterDiscountItem.couponDiscount;
if (couponDiscount != null) {
return CouponDiscount._(discountValue: couponDiscount.discountValue);
}
final unknownDiscount = flutterDiscountItem.unknownDiscount;
if (unknownDiscount != null) {
return UnknownDiscount._(discountValue: unknownDiscount.discountValue);
}
throw UnsupportedError('Unknown purchase discount type');
}