From 05d18c23cc26b4d8a93f4101781f380a1f1f6afe Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Tue, 6 Feb 2024 11:54:02 +0100 Subject: [PATCH] support product IDs for the new Mac app (#2028) Co-authored-by: Son NK --- app/api/views/apple.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/api/views/apple.py b/app/api/views/apple.py index 8b5125bb..5e41e05a 100644 --- a/app/api/views/apple.py +++ b/app/api/views/apple.py @@ -17,9 +17,14 @@ from app.models import PlanEnum, AppleSubscription _MONTHLY_PRODUCT_ID = "io.simplelogin.ios_app.subscription.premium.monthly" _YEARLY_PRODUCT_ID = "io.simplelogin.ios_app.subscription.premium.yearly" +# SL Mac app used to be in SL account _MACAPP_MONTHLY_PRODUCT_ID = "io.simplelogin.macapp.subscription.premium.monthly" _MACAPP_YEARLY_PRODUCT_ID = "io.simplelogin.macapp.subscription.premium.yearly" +# SL Mac app is moved to Proton account +_MACAPP_MONTHLY_PRODUCT_ID_NEW = "me.proton.simplelogin.macos.premium.monthly" +_MACAPP_YEARLY_PRODUCT_ID_NEW = "me.proton.simplelogin.macos.premium.yearly" + # Apple API URL _SANDBOX_URL = "https://sandbox.itunes.apple.com/verifyReceipt" _PROD_URL = "https://buy.itunes.apple.com/verifyReceipt" @@ -263,7 +268,11 @@ def apple_update_notification(): plan = ( PlanEnum.monthly if transaction["product_id"] - in (_MONTHLY_PRODUCT_ID, _MACAPP_MONTHLY_PRODUCT_ID) + in ( + _MONTHLY_PRODUCT_ID, + _MACAPP_MONTHLY_PRODUCT_ID, + _MACAPP_MONTHLY_PRODUCT_ID_NEW, + ) else PlanEnum.yearly ) @@ -517,7 +526,11 @@ def verify_receipt(receipt_data, user, password) -> Optional[AppleSubscription]: plan = ( PlanEnum.monthly if latest_transaction["product_id"] - in (_MONTHLY_PRODUCT_ID, _MACAPP_MONTHLY_PRODUCT_ID) + in ( + _MONTHLY_PRODUCT_ID, + _MACAPP_MONTHLY_PRODUCT_ID, + _MACAPP_MONTHLY_PRODUCT_ID_NEW, + ) else PlanEnum.yearly )