Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert final plan IDs for new Premium and Bundle #2506

Merged
merged 8 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env-dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ TWILIO_AUTH_TOKEN=
TWILIO_SMS_APPLICATION_SID=
TWILIO_MAIN_NUMBER=
PREMIUM_PROD_ID=prod_K29ULZL9pUR9Fr
PERIODICAL_PREMIUM_PROD_ID=price_1LXUenJNcmPzuWtRw3rhjQNP
PHONE_PROD_ID=prod_LgQiSgNi4xL7dq
PERIODICAL_PREMIUM_PROD_ID=prod_KGizMiBqUJdYoY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (non-blocking): Is this the one for production or for stage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Production. (That's the one we want in here, right?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter too much - we'll have to override in local, dev, and stage. This is "safest" in case the .env-dist value is put into prod it'll still work.

PHONE_PROD_ID=prod_KGizMiBqUJdYoY
BUNDLE_PROD_ID=prod_MIex7Q079igFZJ
SUBSCRIPTIONS_WITH_UNLIMITED="monitor-unlimited,mozilla-one,guardian_vpn,premium-relay"
SUBSCRIPTIONS_WITH_PHONE="relay-phones,"
Expand Down
155 changes: 70 additions & 85 deletions privaterelay/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,23 @@ def _get_initial_middleware() -> list[str]:
MAX_NUM_FREE_ALIASES = config("MAX_NUM_FREE_ALIASES", 5, cast=int)
PREMIUM_PROD_ID = config("PREMIUM_PROD_ID", "", cast=str)
PERIODICAL_PREMIUM_PROD_ID = config("PERIODICAL_PREMIUM_PROD_ID", "", cast=str)
PREMIUM_PLAN_ID_US_MONTHLY = config(
"PREMIUM_PLAN_ID_US_MONTHLY", "price_1LXUcnJNcmPzuWtRpbNOajYS", cast=str
)
PREMIUM_PLAN_ID_US_YEARLY = config(
"PREMIUM_PLAN_ID_US_YEARLY", "price_1LXUdlJNcmPzuWtRKTYg7mpZ", cast=str
)
PHONE_PROD_ID = config("PHONE_PROD_ID", "", cast=str)
PHONE_PLAN_ID_US_MONTHLY = config(
"PHONE_PLAN_ID_US_MONTHLY", "price_1Li0w8JNcmPzuWtR2rGU80P3", cast=str
)
PHONE_PLAN_ID_US_YEARLY = config(
"PHONE_PLAN_ID_US_YEARLY", "price_1Li15WJNcmPzuWtRIh0F4VwP", cast=str
)
BUNDLE_PROD_ID = config("BUNDLE_PROD_ID", "", cast=str)
BUNDLE_PLAN_ID_US = config(
"BUNDLE_PLAN_ID_US", "price_1La3d7JNcmPzuWtRn0cg2EyH", cast=str
)
PREMIUM_PRICE_ID_OVERRIDE = config("PREMIUM_PRICE_ID_OVERRIDE", "", cast=str)
PREMIUM_PLAN_ID_MATRIX = {
"chf": {
Expand Down Expand Up @@ -447,155 +462,144 @@ def _get_initial_middleware() -> list[str]:
"de": {
"monthly": {
"id": "price_1LYCqOJNcmPzuWtRuIXpQRxi",
"price": "CHF ?.??",
"price": "CHF 2.00",
},
"yearly": {
"id": "price_1LYCqyJNcmPzuWtR3Um5qDPu",
"price": "CHF ?.??",
"price": "CHF 1.00",
},
},
"fr": {
"monthly": {
"id": "price_1LYCvpJNcmPzuWtRq9ci2gXi",
"price": "CHF ?.??",
"price": "CHF 2.00",
},
"yearly": {
"id": "price_1LYCwMJNcmPzuWtRm6ebmq2N",
"price": "CHF ?.??",
"price": "CHF 1.00",
},
},
"it": {
"monthly": {
"id": "price_1LYCiBJNcmPzuWtRxtI8D5Uy",
"price": "CHF ?.??",
"price": "CHF 2.00",
},
"yearly": {
"id": "price_1LYClxJNcmPzuWtRWjslDdkG",
"price": "CHF ?.??",
"price": "CHF 1.00",
},
},
},
"euro": {
# TODO: Get plan ID for Austria
# "at": {
# "monthly": {
# "id": "",
# "price": "?.?? €",
# },
# "yearly": {
# "id": "",
# "price": "?.?? €",
# },
# },
"de": {
"monthly": {
"id": "price_1LYC79JNcmPzuWtRU7Q238yL",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYC7xJNcmPzuWtRcdKXCVZp",
"price": "?.?? €",
"price": "0,99 €",
},
},
"es": {
"monthly": {
"id": "price_1LYCWmJNcmPzuWtRtopZog9E",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYCXNJNcmPzuWtRu586XOFf",
"price": "?.?? €",
"price": "0,99 €",
},
},
"fr": {
"monthly": {
"id": "price_1LYBuLJNcmPzuWtRn58XQcky",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYBwcJNcmPzuWtRpgoWcb03",
"price": "?.?? €",
"price": "0,99 €",
},
},
"it": {
"monthly": {
"id": "price_1LYCMrJNcmPzuWtRTP9vD8wY",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYCN2JNcmPzuWtRtWz7yMno",
"price": "?.?? €",
"price": "0,99 €",
},
},
"nl": {
"monthly": {
"id": "price_1LYCdLJNcmPzuWtR0J1EHoJ0",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYCdtJNcmPzuWtRVm4jLzq2",
"price": "?.?? €",
"price": "0,99 €",
},
},
"ie": {
"monthly": {
"id": "price_1LhdrkJNcmPzuWtRvCc4hsI2",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LhdprJNcmPzuWtR7HqzkXTS",
"price": "0,99 €",
},
},
# TODO: Get plan ID for Ireland
# "ie": {
# "monthly": {
# "id": "",
# "price": "?.?? €",
# },
# "yearly": {
# "id": "",
# "price": "?.?? €",
# },
# },
"sv": {
"monthly": {
"id": "price_1LYBblJNcmPzuWtRGRHIoYZ5",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYBeMJNcmPzuWtRT5A931WH",
"price": "?.?? €",
"price": "0,99 €",
},
},
"fi": {
"monthly": {
"id": "price_1LYBn9JNcmPzuWtRI3nvHgMi",
"price": "?.?? €",
"price": "1,99 €",
},
"yearly": {
"id": "price_1LYBq1JNcmPzuWtRmyEa08Wv",
"price": "?.?? €",
"price": "0,99 €",
},
},
},
"usd": {
"en": {
"monthly": {
"id": "price_1LXUcnJNcmPzuWtRpbNOajYS",
"price": "$?.??",
"id": PREMIUM_PLAN_ID_US_MONTHLY,
"price": "$1.99",
},
"yearly": {
"id": "price_1LXUdlJNcmPzuWtRKTYg7mpZ",
"price": "$?.??",
"id": PREMIUM_PLAN_ID_US_YEARLY,
"price": "$0.99",
},
},
"gb": {
"monthly": {
"id": "price_1LYCHpJNcmPzuWtRhrhSYOKB",
"price": "$?.??",
"price": "$1.99",
},
"yearly": {
"id": "price_1LYCIlJNcmPzuWtRQtYLA92j",
"price": "$?.??",
"price": "$0.99",
},
},
},
}
PERIODICAL_PREMIUM_PLAN_COUNTRY_LANG_MAPPING = {
# Austria
# Commented out; no plan ID known yet
# "at": {"de": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["at"]},
"at": {
"de": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["de"],
},
# Belgium
"be": {
"fr": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["fr"],
Expand All @@ -621,10 +625,9 @@ def _get_initial_middleware() -> list[str]:
"fr": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["fr"],
},
# Ireland
# Commented out; no plan ID known yet
# "ie": {
# "en": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["ie"],
# },
"ie": {
"en": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["ie"],
},
# Italy
"it": {
"it": PERIODICAL_PREMIUM_PLAN_ID_MATRIX["euro"]["it"],
Expand Down Expand Up @@ -665,62 +668,44 @@ def _get_initial_middleware() -> list[str]:
"usd": {
"en": {
"monthly": {
"id": "price_1LXUenJNcmPzuWtRw3rhjQNP",
"price": "$?.??",
"id": PHONE_PLAN_ID_US_MONTHLY,
"price": "$4.99",
},
"yearly": {
"id": "price_1LXUhcJNcmPzuWtRHUFHVk12",
"price": "$?.??",
"id": PHONE_PLAN_ID_US_YEARLY,
"price": "$3.99",
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
},
},
"ca": {
"monthly": {
"id": "price_1Li0w8JNcmPzuWtR2rGU80P3",
"price": "$4.99",
},
"yearly": {
"id": "price_1Li15WJNcmPzuWtRIh0F4VwP",
"price": "$3.99",
}
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I just mapped ca directly to the US entry, since that's what the current mapping does and they're explicitly the same plan, but I might have misunderstood when to give items their own entry in the PLAN_ID_MATRIX and when to map them to existing entries in PLAN_COUNTRY_LANG_MAPPING?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that seems fine. Let's go with it.

# TODO: Get plan ID for Canada
# "ca": {
# "monthly": {
# "id": "",
# "price": "$?.??",
# },
# "yearly": {
# "id": "",
# "price": "$?.??",
# },
# },
},
}
PHONE_PLAN_COUNTRY_LANG_MAPPING = {
"us": {
"en": PHONE_PLAN_ID_MATRIX["usd"]["en"],
},
# Commented out; no plan ID known yet
# "ca": {
# "en": PHONE_PLAN_ID_MATRIX["usd"]["ca"],
# },
"ca": {
"en": PHONE_PLAN_ID_MATRIX["usd"]["en"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "cad"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, plans will be in USD for Canadians.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh weird, okay! Just another frustration us Canadians need to deal with (most sites do this too :\ )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's even weirder is that people in the UK have to deal with this too! (But to be fair, at least they had the option of adopting the Euro :P)

},
}

BUNDLE_PLAN_ID_MATRIX = {
"usd": {
"en": {
"yearly": {
"id": "price_1La3d7JNcmPzuWtRn0cg2EyH",
# To allow testing the subscription flow on stage, we can set
# a custom plan ID via an environment variable:
"id": BUNDLE_PLAN_ID_US,
"price": "$?.??",
},
},
Comment on lines 693 to 699
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a monthly price? It's in the add on:
image

Copy link
Collaborator Author

@Vinnl Vinnl Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codemist "Monthly" and "yearly" refer to the billing period, but the value for price is the price per month. (So the actual price is 12 times that.)

Btw, note that in this follow-up PR, the price will be changed to a number, so this would look like:

            "yearly": {
                "id": BUNDLE_PLAN_ID_US,
                "price": 1337,
                "currency": "USD",
            },

This can then be formatted using Intl.NumberFormat.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay! Got it, thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a second I was confused about 1337 and then I googled it, lol.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha sorry, should've realised that maybe that wasn't a thing anymore in 2022 :P

# TODO: Get plan ID for Canada
# "ca": {
# "yearly": {
# "id": "",
# "price": "$?.??",
# },
# },
},
}
BUNDLE_PLAN_COUNTRY_LANG_MAPPING = {
"us": {
"en": BUNDLE_PLAN_ID_MATRIX["usd"]["en"],
},
# Commented out; no plan ID known yet
# "ca": {
# "en": BUNDLE_PLAN_ID_MATRIX["usd"]["ca"],
# },
"ca": {
"en": BUNDLE_PLAN_ID_MATRIX["usd"]["en"],
},
}

SUBSCRIPTIONS_WITH_UNLIMITED = config("SUBSCRIPTIONS_WITH_UNLIMITED", default="")
Expand Down