Skip to content

Commit

Permalink
Merge pull request #2422 from Adyen/fix-riverty-terms-urls
Browse files Browse the repository at this point in the history
fix: correct the Riverty consent links
  • Loading branch information
longyulongyu authored Nov 20, 2023
2 parents 996507d + 37c25db commit 639f69f
Show file tree
Hide file tree
Showing 33 changed files with 142 additions and 57 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-mugs-accept.md
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'.
3 changes: 2 additions & 1 deletion packages/lib/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rules": {
"no-descending-specificity": null,
"selector-class-pattern": null,
"scss/no-global-function-names": null
"scss/no-global-function-names": null,
"declaration-block-no-redundant-longhand-properties": null
}
}
7 changes: 2 additions & 5 deletions packages/lib/src/components/AfterPay/AfterPayB2B.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
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 {
Expand All @@ -21,8 +19,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
};
}
}
18 changes: 12 additions & 6 deletions packages/lib/src/components/AfterPay/config.ts
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 };
48 changes: 34 additions & 14 deletions packages/lib/src/components/AfterPay/utils.test.ts
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();
});
});
});
11 changes: 7 additions & 4 deletions packages/lib/src/components/AfterPay/utils.ts
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 };
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function CompanyDetails(props: CompanyDetailsProps) {
name={generateFieldName('companyName')}
>
<InputText
name={generateFieldName('companyName')}
name={generateFieldName('name')}
value={data.name}
classNameModifiers={['name']}
onInput={eventHandler('input')}
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "رمز الأمان (اختياري)",
"issuerList.wallet.placeholder": "حدد محفظتك",
"privacyPolicy": "سياسة الخصوصية",
"afterPay.agreement": "أوافق على %@ لشركة AfterPay",
"afterPay.agreement": "أوافق على ٪ @ لشركة Riverty",
"paymentConditions": "شروط الدفع",
"openApp": "فتح التطبيق",
"voucher.readInstructions": "قراءة التعليمات",
Expand Down Expand Up @@ -258,6 +258,8 @@
"ctp.otp.codeResent": "تم إرسال الرمز",
"ctp.otp.title": "تمتع بالوصول إلى بطاقات Click to Pay الخاصة بك",
"ctp.otp.subtitle": "أدخل الرمز %@ الذي أرسلناه إلى ٪@ للتحقق من هويتك.",
"ctp.otp.saveCookiesCheckbox.label": "تخطي التحقق في المرة القادمة",
"ctp.otp.saveCookiesCheckbox.information": "حدد حفظ البيانات على جهازك ومتصفحك في المتاجر المشاركة لإتمام عملية الدفع بشكل أسرع. لا يوصى به للأجهزة المشتركة.",
"ctp.emptyProfile.message": "لا توجد بطاقات مسجلة في هذا الملف التعريفي على Click to Pay",
"ctp.separatorText": "أو استخدم",
"ctp.cards.title": "أكمل الدفع باستخدام بطاقة Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Bezpečnostní kód (volitelný)",
"issuerList.wallet.placeholder": "Vyberte svou peněženku",
"privacyPolicy": "Zásady ochrany osobních údajů",
"afterPay.agreement": "Souhlasím s %@ společnosti AfterPay",
"afterPay.agreement": "Souhlasím s %@ of Riverty",
"paymentConditions": "platebními podmínkami",
"openApp": "Otevřete aplikaci",
"voucher.readInstructions": "Přečtěte si pokyny",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Kód odeslán",
"ctp.otp.title": "Získejte přístup ke svým kartám Click to Pay",
"ctp.otp.subtitle": "Zadejte kód %@, který jsme vám odeslali na %@ a ověřte sami sebe.",
"ctp.otp.saveCookiesCheckbox.label": "Příště přeskočte ověřování",
"ctp.otp.saveCookiesCheckbox.information": "Zvolte, že si je chcete zapamatovat ve svém zařízení a prohlížeči v zúčastněných obchodech, abyste se rychleji odhlásili. Nedoporučuje se pro sdílená zařízení.",
"ctp.emptyProfile.message": "V tomto profilu Click to Pay nejsou zaregistrovány žádné karty",
"ctp.separatorText": "nebo použijte",
"ctp.cards.title": "Dokončete platbu pomocí Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Sikkerhedskode (valgfrit)",
"issuerList.wallet.placeholder": "Vælg tegnebog",
"privacyPolicy": "Politik om privatlivets fred",
"afterPay.agreement": "Jeg accepterer AfterPays %@",
"afterPay.agreement": "Jeg accepterer %@ fra Riverty",
"paymentConditions": "betalingsbetingelser",
"openApp": "Åbn appen",
"voucher.readInstructions": "Læs anvisningerne",
Expand Down Expand Up @@ -258,6 +258,8 @@
"ctp.otp.codeResent": "Kode er sendt igen",
"ctp.otp.title": "Få adgang til dine Click to Pay-kort",
"ctp.otp.subtitle": "Indtast den kode, vi har sendt til %@ for at bekræfte, at det er dig.",
"ctp.otp.saveCookiesCheckbox.label": "Spring bekræftelse over næste gang",
"ctp.otp.saveCookiesCheckbox.information": "Vælg dette for at blive husket på din enhed og browser i deltagende butikker for hurtigere betaling. Anbefales ikke på delte enheder.",
"ctp.emptyProfile.message": "Ingen kort registreret i denne Click to Pay-profil",
"ctp.separatorText": "eller brug",
"ctp.cards.title": "Gennemfør betaling med Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Sicherheitscode (optional)",
"issuerList.wallet.placeholder": "Virtuelle Brieftasche auswählen",
"privacyPolicy": "Datenschutz",
"afterPay.agreement": "Ich bin mit den %@ von AfterPay einverstanden",
"afterPay.agreement": "Ich stimme den %@ von Riverty zu",
"paymentConditions": "Zahlungsbedingungen",
"openApp": "App öffnen",
"voucher.readInstructions": "Anweisungen lesen",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Code erneut gesendet",
"ctp.otp.title": "Zugriff auf Ihre Click-to-Pay-Karten",
"ctp.otp.subtitle": "Geben Sie den Code ein, der von %@ an %@ gesendet wurde, um Ihre Identität zu bestätigen.",
"ctp.otp.saveCookiesCheckbox.label": "Verifizierung beim nächsten Mal überspringen",
"ctp.otp.saveCookiesCheckbox.information": "Wählen Sie diese Option, um bei teilnehmenden Geschäften auf Ihrem Gerät und Browser gespeichert zu werden, um den Bestellvorgang zu beschleunigen. Nicht für gemeinsam genutzte Geräte empfohlen.",
"ctp.emptyProfile.message": "In diesem Click-to-Pay-Profil sind keine Karten registriert",
"ctp.separatorText": "oder verwenden",
"ctp.cards.title": "Zahlung mit Click to Pay abschließen",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Κωδικός ασφαλείας (προαιρετικό)",
"issuerList.wallet.placeholder": "Επιλέξτε το πορτοφόλι σας",
"privacyPolicy": "Πολιτική απορρήτου",
"afterPay.agreement": "Αποδέχομαι τους %@ του AfterPay",
"afterPay.agreement": "Αποδέχομαι τους %@ του Riverty",
"paymentConditions": "όρους πληρωμής",
"openApp": "Άνοιγμα της εφαρμογής",
"voucher.readInstructions": "Διαβάστε τις οδηγίες",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Ο κωδικός στάλθηκε εκ νέου",
"ctp.otp.title": "Πρόσβαση στις κάρτες Click to Pay σας",
"ctp.otp.subtitle": "Εισαγάγετε τον κωδικό %@ που στάλθηκε στο %@ για να επαληθεύσετε ότι είστε εσείς.",
"ctp.otp.saveCookiesCheckbox.label": "Παράβλεψη επαλήθευσης την επόμενη φορά",
"ctp.otp.saveCookiesCheckbox.information": "Επιλέξτε να απομνημονεύεται στη συσκευή και στο πρόγραμμα περιήγησής σας στα συμμετέχοντα καταστήματα για ταχύτερη ολοκλήρωση της πληρωμής. Δεν συνιστάται για κοινόχρηστες συσκευές.",
"ctp.emptyProfile.message": "Δεν υπάρχουν καταχωρισμένες κάρτες σε αυτό το προφίλ Click to Pay",
"ctp.separatorText": "ή χρησιμοποιήστε το",
"ctp.cards.title": "Ολοκληρώστε την πληρωμή με το Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -259,6 +259,8 @@
"ctp.otp.codeResent": "Code resent",
"ctp.otp.title": "Access your Click to Pay cards",
"ctp.otp.subtitle": "Enter the code %@ sent to %@ to verify it‘s you.",
"ctp.otp.saveCookiesCheckbox.label": "Skip verification next time",
"ctp.otp.saveCookiesCheckbox.information": "Select to be remembered on your device and browser at participating stores for faster checkout. Not recommended for shared devices.",
"ctp.emptyProfile.message": "No cards registered in this Click to Pay profile",
"ctp.separatorText": "or use",
"ctp.cards.title": "Complete payment with Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"creditCard.cvcField.title.optional": "Código de seguridad (opcional)",
"issuerList.wallet.placeholder": "Seleccione su monedero electrónico",
"privacyPolicy": "Política de privacidad",
"afterPay.agreement": "Sí, acepto las %@ de AfterPay",
"afterPay.agreement": "Sí, acepto las %@ de Riverty",
"paymentConditions": "condiciones de pago",
"openApp": "Abrir la aplicación",
"voucher.readInstructions": "Leer instrucciones",
Expand Down Expand Up @@ -252,6 +252,8 @@
"ctp.otp.codeResent": "Código reenviado",
"ctp.otp.title": "Acceda a sus tarjetas Click to Pay",
"ctp.otp.subtitle": "Introduzca el código %@ que le hemos enviado a %@ para verificar que es usted.",
"ctp.otp.saveCookiesCheckbox.label": "Omitir verificación la próxima vez",
"ctp.otp.saveCookiesCheckbox.information": "Seleccione esta opción para recordarle en su dispositivo y navegador en las tiendas participantes para agilizar el proceso de pago. No lo recomendamos para dispositivos compartidos.",
"ctp.emptyProfile.message": "No hay tarjetas registradas en este perfil de Click to Pay",
"ctp.separatorText": "o utilice",
"ctp.cards.title": "Completar el pago con Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Turvakoodi (valinnainen)",
"issuerList.wallet.placeholder": "Valitse lompakkosi",
"privacyPolicy": "Tietosuojamenettely",
"afterPay.agreement": "Hyväksyn AfterPayn %@",
"afterPay.agreement": "Hyväksyn Rivertyn %@",
"paymentConditions": "maksuehdot",
"openApp": "Avaa sovellus",
"voucher.readInstructions": "Lue ohjeet",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Koodi lähetetty uudelleen",
"ctp.otp.title": "Hanki pääsy Click to Pay -kortteihisi",
"ctp.otp.subtitle": "Syötä koodi, jonka %@ lähetti osoitteeseen %@ vahvistaaksesi, että kyseessä olet sinä.",
"ctp.otp.saveCookiesCheckbox.label": "Ohita vahvistus seuraavalla kerralla",
"ctp.otp.saveCookiesCheckbox.information": "Valitse, että sinut muistetaan laitteellasi ja selaimessa osallistuvissa myymälöissä, jotta voit maksaa nopeammin. Ei suositella jaetuilla laitteilla.",
"ctp.emptyProfile.message": "Tähän Click to Pay -profiiliin ei ole rekisteröity kortteja",
"ctp.separatorText": "tai käytä",
"ctp.cards.title": "Suorita maksu Click to Paylla",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Code de sécurité (facultatif)",
"issuerList.wallet.placeholder": "Sélectionnez votre portefeuille",
"privacyPolicy": "Politique de confidentialité",
"afterPay.agreement": "J'accepte les %@ de AfterPay",
"afterPay.agreement": "J'accepte les %@ de Riverty",
"paymentConditions": "conditions de paiement",
"openApp": "Ouvrir l'application",
"voucher.readInstructions": "Lire les instructions",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Code renvoyé",
"ctp.otp.title": "Accédez à vos cartes Click to Pay",
"ctp.otp.subtitle": "Saisissez le code %@ envoyé à %@ pour vérifier votre identité.",
"ctp.otp.saveCookiesCheckbox.label": "Ignorer la vérification la prochaine fois",
"ctp.otp.saveCookiesCheckbox.information": "Sélectionnez cette option pour mémoriser les informations sur votre appareil et votre navigateur afin d'accélérer le paiement dans les magasins participants. Non recommandé pour les appareils partagés.",
"ctp.emptyProfile.message": "Aucune carte enregistrée dans ce profil Click to Pay",
"ctp.separatorText": "ou utilisez",
"ctp.cards.title": "Terminez le paiement avec Click to Pay",
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/language/locales/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"creditCard.cvcField.title.optional": "Sigurnosni kôd (neobvezno)",
"issuerList.wallet.placeholder": "Odaberite svoju novčanik",
"privacyPolicy": "Politika privatnosti",
"afterPay.agreement": "Slažem se s %@ usluge AfterPay",
"afterPay.agreement": "Slažem se s %@ Rivertyja",
"paymentConditions": "uvjetima plaćanja",
"openApp": "Otvorite aplikaciju",
"voucher.readInstructions": "Pročitajte upute",
Expand Down Expand Up @@ -257,6 +257,8 @@
"ctp.otp.codeResent": "Kôd je ponovno poslan",
"ctp.otp.title": "Pristupite svojim karticama za uslugu Click to Pay",
"ctp.otp.subtitle": "Upišite kôd %@ koji smo poslali na %@ da bismo potvrdili da ste to vi.",
"ctp.otp.saveCookiesCheckbox.label": "Sljedeći puta preskoči provjeru",
"ctp.otp.saveCookiesCheckbox.information": "Odaberite kako biste bili zapamćeni na svom uređaju i pregledniku u uključenim trgovinama za bržu naplatu. Ne preporučuje se za zajedničke uređaje.",
"ctp.emptyProfile.message": "Nema kartica registriranih u sklopu ovog profila usluge Click to Pay",
"ctp.separatorText": "ili upotrijebite",
"ctp.cards.title": "Dovrši plaćanje uslugom Click to Pay",
Expand Down
Loading

0 comments on commit 639f69f

Please sign in to comment.