-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2422 from Adyen/fix-riverty-terms-urls
fix: correct the Riverty consent links
- Loading branch information
Showing
33 changed files
with
142 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@adyen/adyen-web": patch | ||
--- | ||
|
||
Correct the T&C links for Riverty, remove the B2B T&C link, and change the text from 'AfterPay' to 'Riverty'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
const AFTERPAY_CONSENT_URL_EN = 'https://www.afterpay.nl/en/algemeen/pay-with-afterpay/payment-conditions'; | ||
const AFTERPAY_CONSENT_URL_BE = 'https://www.afterpay.be/be/footer/betalen-met-afterpay/betalingsvoorwaarden'; | ||
const AFTERPAY_CONSENT_URL_NL = 'https://www.afterpay.nl/nl/algemeen/betalen-met-afterpay/betalingsvoorwaarden'; | ||
const AFTERPAY_B2B_CONSENT_URL = 'https://www.afterpay.nl/nl/algemeen/zakelijke-partners/betalingsvoorwaarden-zakelijk'; | ||
const ALLOWED_COUNTRIES = ['BE', 'NL']; | ||
|
||
export { AFTERPAY_CONSENT_URL_EN, AFTERPAY_CONSENT_URL_BE, AFTERPAY_CONSENT_URL_NL, AFTERPAY_B2B_CONSENT_URL, ALLOWED_COUNTRIES }; | ||
const rivertyConsentUrlMap = { | ||
be: { | ||
en: 'https://documents.riverty.com/terms_conditions/payment_methods/invoice/be_en', | ||
fr: 'https://documents.riverty.com/terms_conditions/payment_methods/invoice/be_fr', | ||
nl: 'https://documents.riverty.com/terms_conditions/payment_methods/invoice/be_nl' | ||
}, | ||
nl: { | ||
en: 'https://documents.riverty.com/terms_conditions/payment_methods/invoice/nl_en', | ||
nl: 'https://documents.riverty.com/terms_conditions/payment_methods/invoice/nl_nl' | ||
} | ||
}; | ||
export { ALLOWED_COUNTRIES, rivertyConsentUrlMap }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,41 @@ | ||
import { getConsentLinkUrl } from './utils'; | ||
import { AFTERPAY_CONSENT_URL_BE, AFTERPAY_CONSENT_URL_EN, AFTERPAY_CONSENT_URL_NL } from './config'; | ||
import { rivertyConsentUrlMap } from './config'; | ||
|
||
describe('getConsentLinkUrl', () => { | ||
test('returns the english URL if the locale is "en"', () => { | ||
expect(getConsentLinkUrl('', 'en')).toBe(AFTERPAY_CONSENT_URL_EN); | ||
expect(getConsentLinkUrl('', 'EN')).toBe(AFTERPAY_CONSENT_URL_EN); | ||
expect(getConsentLinkUrl('', 'en_US')).toBe(AFTERPAY_CONSENT_URL_EN); | ||
expect(getConsentLinkUrl('', 'en_GB')).toBe(AFTERPAY_CONSENT_URL_EN); | ||
describe('the country code is NL', () => { | ||
test('returns the english URL if the shopper locale is "en"', () => { | ||
expect(getConsentLinkUrl('nl', 'en')).toBe(rivertyConsentUrlMap.nl.en); | ||
}); | ||
test('returns the NL URL if the shopper locale is "nl"', () => { | ||
expect(getConsentLinkUrl('nl', 'nl')).toBe(rivertyConsentUrlMap.nl.nl); | ||
}); | ||
}); | ||
|
||
test('returns the english URL if the country code is "BE"', () => { | ||
expect(getConsentLinkUrl('BE', '')).toBe(AFTERPAY_CONSENT_URL_BE); | ||
expect(getConsentLinkUrl('be', '')).toBe(AFTERPAY_CONSENT_URL_BE); | ||
describe('the country code is BE', () => { | ||
test('returns the english URL if the shopper locale is "en"', () => { | ||
expect(getConsentLinkUrl('be', 'en')).toBe(rivertyConsentUrlMap.be.en); | ||
}); | ||
test('returns the NL URL if the shopper locale is "nl"', () => { | ||
expect(getConsentLinkUrl('be', 'nl')).toBe(rivertyConsentUrlMap.be.nl); | ||
}); | ||
test('returns the FR URL if the shopper locale is "fr"', () => { | ||
expect(getConsentLinkUrl('be', 'fr')).toBe(rivertyConsentUrlMap.be.fr); | ||
}); | ||
}); | ||
|
||
test('returns the URL for Netherlands otherwise', () => { | ||
expect(getConsentLinkUrl('', '')).toBe(AFTERPAY_CONSENT_URL_NL); | ||
expect(getConsentLinkUrl('es', 'ES')).toBe(AFTERPAY_CONSENT_URL_NL); | ||
describe('no supported country code & locale', () => { | ||
beforeEach(() => { | ||
console.warn = jest.fn(); | ||
}); | ||
test('should give a warning if no country code is provided', () => { | ||
getConsentLinkUrl(undefined, 'en'); | ||
expect(console.warn).toBeCalled(); | ||
}); | ||
test('should give a warning if wrong country code is provided', () => { | ||
getConsentLinkUrl('WRONG', 'en'); | ||
expect(console.warn).toBeCalled(); | ||
}); | ||
test('should give a warning if wrong locale is provided', () => { | ||
getConsentLinkUrl('nl', 'fr'); | ||
expect(console.warn).toBeCalled(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { AFTERPAY_CONSENT_URL_BE, AFTERPAY_CONSENT_URL_EN, AFTERPAY_CONSENT_URL_NL } from './config'; | ||
import { rivertyConsentUrlMap } from './config'; | ||
|
||
function getConsentLinkUrl(countryCode: string, locale: string): string { | ||
const languageCode = locale?.toLowerCase().slice(0, 2); | ||
if (languageCode === 'en') return AFTERPAY_CONSENT_URL_EN; | ||
if (countryCode?.toLowerCase() === 'be') return AFTERPAY_CONSENT_URL_BE; | ||
return AFTERPAY_CONSENT_URL_NL; | ||
const consentLink = rivertyConsentUrlMap[countryCode?.toLowerCase()]?.[languageCode]; | ||
if (!consentLink) { | ||
console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`); | ||
return; | ||
} | ||
return consentLink; | ||
} | ||
|
||
export { getConsentLinkUrl }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.