diff --git a/packages/lib/src/components/AfterPay/AfterPayB2B.tsx b/packages/lib/src/components/AfterPay/AfterPayB2B.tsx index a9d0bef3..a4153041 100644 --- a/packages/lib/src/components/AfterPay/AfterPayB2B.tsx +++ b/packages/lib/src/components/AfterPay/AfterPayB2B.tsx @@ -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: + allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES }; } } diff --git a/packages/lib/src/components/AfterPay/config.ts b/packages/lib/src/components/AfterPay/config.ts index ffe4cacf..2b017e6d 100644 --- a/packages/lib/src/components/AfterPay/config.ts +++ b/packages/lib/src/components/AfterPay/config.ts @@ -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 }; diff --git a/packages/lib/src/components/AfterPay/utils.test.ts b/packages/lib/src/components/AfterPay/utils.test.ts index 337b2405..eb7b5012 100644 --- a/packages/lib/src/components/AfterPay/utils.test.ts +++ b/packages/lib/src/components/AfterPay/utils.test.ts @@ -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); + }); }); }); diff --git a/packages/lib/src/components/AfterPay/utils.ts b/packages/lib/src/components/AfterPay/utils.ts index 65f7fd35..97227452 100644 --- a/packages/lib/src/components/AfterPay/utils.ts +++ b/packages/lib/src/components/AfterPay/utils.ts @@ -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 }; diff --git a/packages/lib/src/language/locales/en-US.json b/packages/lib/src/language/locales/en-US.json index 35ca67a1..cf6b312e 100644 --- a/packages/lib/src/language/locales/en-US.json +++ b/packages/lib/src/language/locales/en-US.json @@ -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",