Merge pull request #13934 from overleaf/tm-block-subscriptions-restricted-countries

Block web sales to restricted countries

GitOrigin-RevId: 47c0ac1d5dc387369bbadb67f5822d7fc6637d98
This commit is contained in:
Tim Down
2023-07-24 11:21:44 +01:00
committed by Copybot
parent f2b5ac23f8
commit 3aa0fcf464
5 changed files with 46 additions and 6 deletions

View File

@@ -213,6 +213,13 @@ async function paymentPage(req, res) {
currency = recommendedCurrency
}
// Block web sales to restricted countries
if (['CU', 'IR', 'KP', 'RU', 'SY', 'VE'].includes(countryCode)) {
return res.render('subscriptions/restricted-country', {
title: 'restricted',
})
}
res.render('subscriptions/new-react', {
title: 'subscribe',
currency,

View File

@@ -0,0 +1,11 @@
extends ../layout-marketing
block content
main.content.content-alt#main-content
.container
.error-container
.error-details
p.error-status #{translate("restricted")}
p.error-description !{translate("sorry_detected_sales_restricted_region", {link: "/contact"})}
p.error-actions
a.error-btn(href="/") #{translate("home")}

View File

@@ -64,7 +64,7 @@ const countries = <const>[
{ code: 'CR', name: 'Costa Rica' },
{ code: 'CI', name: 'Côte dIvoire' },
{ code: 'HR', name: 'Croatia' },
{ code: 'CU', name: 'Cuba' },
// { code: 'CU', name: 'Cuba' }, // blocked
{ code: 'CY', name: 'Cyprus' },
{ code: 'CZ', name: 'Czech Republic' },
{ code: 'DK', name: 'Denmark' },
@@ -115,7 +115,7 @@ const countries = <const>[
{ code: 'IS', name: 'Iceland' },
{ code: 'IN', name: 'India' },
{ code: 'ID', name: 'Indonesia' },
{ code: 'IR', name: 'Iran' },
// { code: 'IR', name: 'Iran' }, // blocked
{ code: 'IQ', name: 'Iraq' },
{ code: 'IE', name: 'Ireland' },
{ code: 'IM', name: 'Isle of Man' },
@@ -180,7 +180,7 @@ const countries = <const>[
{ code: 'NG', name: 'Nigeria' },
{ code: 'NU', name: 'Niue' },
{ code: 'NF', name: 'Norfolk Island' },
{ code: 'KP', name: 'North Korea' },
// { code: 'KP', name: 'North Korea' }, // blocked
{ code: 'VD', name: 'North Vietnam' },
{ code: 'MP', name: 'Northern Mariana Islands' },
{ code: 'NO', name: 'Norway' },
@@ -204,7 +204,7 @@ const countries = <const>[
{ code: 'QA', name: 'Qatar' },
{ code: 'RE', name: 'Réunion' },
{ code: 'RO', name: 'Romania' },
{ code: 'RU', name: 'Russia' },
// { code: 'RU', name: 'Russia' }, // blocked
{ code: 'RW', name: 'Rwanda' },
{ code: 'BL', name: 'Saint Barthélemy' },
{ code: 'SH', name: 'Saint Helena' },
@@ -238,7 +238,7 @@ const countries = <const>[
{ code: 'SZ', name: 'Swaziland' },
{ code: 'SE', name: 'Sweden' },
{ code: 'CH', name: 'Switzerland' },
{ code: 'SY', name: 'Syria' },
// { code: 'SY', name: 'Syria' }, // blocked
{ code: 'TW', name: 'Taiwan' },
{ code: 'TJ', name: 'Tajikistan' },
{ code: 'TZ', name: 'Tanzania' },
@@ -266,7 +266,7 @@ const countries = <const>[
{ code: 'UZ', name: 'Uzbekistan' },
{ code: 'VU', name: 'Vanuatu' },
{ code: 'VA', name: 'Vatican City' },
{ code: 'VE', name: 'Venezuela' },
// { code: 'VE', name: 'Venezuela' }, // blocked
{ code: 'VN', name: 'Vietnam' },
{ code: 'WK', name: 'Wake Island' },
{ code: 'WF', name: 'Wallis and Futuna' },

View File

@@ -1544,6 +1544,7 @@
"something_went_wrong_rendering_pdf_expected": "There was an issue displaying this PDF. <0>Please recompile</0>",
"something_went_wrong_server": "Something went wrong. Please try again.",
"somthing_went_wrong_compiling": "Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.",
"sorry_detected_sales_restricted_region": "Sorry, weve detected that you are in a region from which we cannot presently accept payments. If you think youve received this message in error, please <a href=\"__link__\">contact us</a> with details of your location, and we will look into this for you. We apologize for the inconvenience.",
"sorry_something_went_wrong_opening_the_document_please_try_again": "Sorry, an unexpected error occurred when trying to open this content on Overleaf. Please try again.",
"sorry_your_token_expired": "Sorry, your token expired",
"sort_by": "Sort by",

View File

@@ -393,6 +393,27 @@ describe('SubscriptionController', function () {
this.SubscriptionController.paymentPage(this.req, this.res)
})
})
describe('with a user from a restricted country', function () {
beforeEach(function () {
this.LimitationsManager.promises.userHasV1OrV2Subscription.resolves(
false
)
this.PlansLocator.findLocalPlanInSettings.returns({})
this.GeoIpLookup.promises.getCurrencyCode.resolves({
currencyCode: this.stubbedCurrencyCode,
countryCode: 'KP',
})
})
it('should render the restricted country page', function (done) {
this.res.render = (page, opts) => {
page.should.equal('subscriptions/restricted-country')
done()
}
this.SubscriptionController.paymentPage(this.req, this.res, done)
})
})
})
describe('successfulSubscription', function () {