mirror of
https://github.com/jlengrand/adyen-web.git
synced 2026-03-10 08:01:22 +00:00
fix: correct the Riverty consent links
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { h } from 'preact';
|
||||
import OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';
|
||||
import ConsentCheckboxLabel from './components/ConsentCheckboxLabel';
|
||||
import { AFTERPAY_B2B_CONSENT_URL, ALLOWED_COUNTRIES } from './config';
|
||||
import { ALLOWED_COUNTRIES } from './config';
|
||||
import { OpenInvoiceContainerProps } from '../helpers/OpenInvoiceContainer/OpenInvoiceContainer';
|
||||
|
||||
export default class AfterPayB2B extends OpenInvoiceContainer {
|
||||
@@ -21,8 +20,7 @@ export default class AfterPayB2B extends OpenInvoiceContainer {
|
||||
formatProps(props) {
|
||||
return {
|
||||
...super.formatProps(props),
|
||||
allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES,
|
||||
consentCheckboxLabel: <ConsentCheckboxLabel url={AFTERPAY_B2B_CONSENT_URL} />
|
||||
allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
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);
|
||||
});
|
||||
|
||||
test('returns the URL for Netherlands otherwise', () => {
|
||||
expect(getConsentLinkUrl('', '')).toBe(AFTERPAY_CONSENT_URL_NL);
|
||||
expect(getConsentLinkUrl('es', 'ES')).toBe(AFTERPAY_CONSENT_URL_NL);
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
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;
|
||||
return rivertyConsentUrlMap[countryCode?.toLowerCase()]?.[languageCode];
|
||||
}
|
||||
|
||||
export { getConsentLinkUrl };
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
"creditCard.cvcField.title.optional": "Security code (optional)",
|
||||
"issuerList.wallet.placeholder": "Select your wallet",
|
||||
"privacyPolicy": "Privacy policy",
|
||||
"afterPay.agreement": "I agree with the %@ of AfterPay",
|
||||
"afterPay.agreement": "I agree with the %@ of Riverty",
|
||||
"paymentConditions": "payment conditions",
|
||||
"openApp": "Open the app",
|
||||
"voucher.readInstructions": "Read instructions",
|
||||
|
||||
Reference in New Issue
Block a user