diff --git a/lib/ionia/ionia_merchant.dart b/lib/ionia/ionia_merchant.dart index 96e671652..6b85a18b3 100644 --- a/lib/ionia/ionia_merchant.dart +++ b/lib/ionia/ionia_merchant.dart @@ -168,5 +168,7 @@ class IoniaMerchant { final String acceptedCurrency; final String deepLink; final bool isPayLater; + + double get discount => level3; } diff --git a/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart b/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart index e5a085eb1..95202f472 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart @@ -35,8 +35,8 @@ class IoniaBuyGiftCardDetailPage extends BasePage { @override Widget trailing(BuildContext context) - => ioniaPurchaseViewModel.ioniaMerchant.minimumDiscount > 0 - ? DiscountBadge(percentage: ioniaPurchaseViewModel.ioniaMerchant.minimumDiscount) + => ioniaPurchaseViewModel.ioniaMerchant.discount > 0 + ? DiscountBadge(percentage: ioniaPurchaseViewModel.ioniaMerchant.discount) : null; @override @@ -130,7 +130,7 @@ class IoniaBuyGiftCardDetailPage extends BasePage { ), SizedBox(height: 4), Text( - '\$${ioniaPurchaseViewModel.amount.toStringAsFixed(2)}', + '\$${ioniaPurchaseViewModel.billAmount.toStringAsFixed(2)}', style: textLargeSemiBold(), ), ], diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index e84682559..899b1387d 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -146,7 +146,7 @@ class IoniaBuyGiftCardPage extends BasePage { child: CardItem( title: merchant.legalName, backgroundColor: Theme.of(context).accentTextTheme.display4.backgroundColor.withOpacity(0.1), - discount: merchant.minimumDiscount, + discount: merchant.discount, titleColor: Theme.of(context).accentTextTheme.display4.backgroundColor, subtitleColor: Theme.of(context).hintColor, subTitle: merchant.isOnline ? S.of(context).online : S.of(context).offline, diff --git a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart index 103ee64dd..656b8676b 100644 --- a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart +++ b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart @@ -216,17 +216,31 @@ class _IoniaManageCardsPageBodyState extends State { separatorBuilder: (_, __) => SizedBox(height: 4), itemBuilder: (_, index) { final merchant = merchantsList[index]; + var subTitle = ''; + + if (merchant.isOnline) { + subTitle += S.of(context).online; + } + + if (merchant.isPhysical) { + if (subTitle.isNotEmpty) { + subTitle = '$subTitle & '; + } + + subTitle = '${subTitle}${S.of(context).in_store}'; + } + return CardItem( logoUrl: merchant.logoUrl, onTap: () { Navigator.of(context).pushNamed(Routes.ioniaBuyGiftCardPage, arguments: [merchant]); }, title: merchant.legalName, - subTitle: merchant.isOnline ? S.of(context).online : S.of(context).offline, + subTitle: subTitle, backgroundColor: Theme.of(context).textTheme.title.backgroundColor, titleColor: Theme.of(context).accentTextTheme.display3.backgroundColor, subtitleColor: Theme.of(context).accentTextTheme.display2.backgroundColor, - discount: merchant.minimumDiscount, + discount: merchant.discount, ); }, ), diff --git a/lib/view_model/ionia/ionia_purchase_merch_view_model.dart b/lib/view_model/ionia/ionia_purchase_merch_view_model.dart index 7fc66bc37..b8c8eaa96 100644 --- a/lib/view_model/ionia/ionia_purchase_merch_view_model.dart +++ b/lib/view_model/ionia/ionia_purchase_merch_view_model.dart @@ -58,6 +58,9 @@ abstract class IoniaMerchPurchaseViewModelBase with Store { @computed double get giftCardAmount => double.parse((amount + tipAmount).toStringAsFixed(2)); + @computed + double get billAmount => double.parse((giftCardAmount * (1 - (ioniaMerchant.discount / 100))).toStringAsFixed(2)); + @observable double tipAmount;