Skip to content

Commit 2c03dd2

Browse files
feat: dispatch card verification events and copy in tokenize-only che… (#278)
* feat: dispatch card verification events and copy in tokenize-only checkout * bump version
1 parent ca78ac8 commit 2c03dd2

28 files changed

Lines changed: 519 additions & 93 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "processout.js",
3-
"version": "1.9.10",
3+
"version": "1.9.11",
44
"description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.",
55
"scripts": {
66
"build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",

src/dynamic-checkout/config/payment-config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ module ProcessOut {
7070
this.invoiceDetails = invoiceDetails
7171
}
7272

73+
// Tokenize-only is exposed per payment method by the API, but it describes the whole
74+
// checkout: the shopper is verifying a card, not paying for the invoice.
75+
public isTokenizeOnly(): boolean {
76+
if (!this.invoiceDetails || !this.invoiceDetails.payment_methods) {
77+
return false
78+
}
79+
80+
return this.invoiceDetails.payment_methods.some(
81+
paymentMethod => paymentMethod.card && paymentMethod.card.tokenize_only,
82+
)
83+
}
84+
7385
public getAdditionalDataForGateway(gatewayName: string): Record<string, string> {
7486
return this.additionalData[gatewayName] || {}
7587
}

src/dynamic-checkout/dynamic-checkout.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ module ProcessOut {
9494
new DynamicCheckoutPaymentErrorView(
9595
this.processOutInstance,
9696
this.paymentConfig,
97-
Translations.getText("payment-error-generic-message", this.paymentConfig.locale),
97+
getStatusMessage("payment-error-generic-message", this.paymentConfig),
9898
).element,
9999
)
100100

@@ -106,12 +106,16 @@ module ProcessOut {
106106
)
107107
}
108108

109+
// Set before the status check below so the error view and event know whether this
110+
// checkout is a tokenize-only (card verification) one.
111+
this.paymentConfig.setInvoiceDetails(data.invoice)
112+
109113
if (data.invoice.transaction.status !== "waiting") {
110114
this.loadView(
111115
new DynamicCheckoutPaymentErrorView(
112116
this.processOutInstance,
113117
this.paymentConfig,
114-
Translations.getText("payment-error-generic-message", this.paymentConfig.locale),
118+
getStatusMessage("payment-error-generic-message", this.paymentConfig),
115119
).element,
116120
)
117121

@@ -125,11 +129,12 @@ module ProcessOut {
125129
undefined,
126130
undefined,
127131
data.invoice.return_url || null,
132+
undefined,
133+
undefined,
134+
this.paymentConfig.isTokenizeOnly(),
128135
)
129136
}
130137

131-
this.paymentConfig.setInvoiceDetails(data.invoice)
132-
133138
this.loadDynamicCheckoutView()
134139
}
135140

src/dynamic-checkout/locales/ar.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ module ProcessOut {
2424
"payment-info-message": "نقوم بمعالجة عملية الدفع الخاصة بك. يمكنك الآن إغلاق هذه النافذة.",
2525
"payment-pending-message": "عملية الدفع الخاصة بك قيد الانتظار.",
2626
"payment-error-generic-message": "لم نتمكن من معالجة عملية الدفع الخاصة بك.",
27+
"verification-success-message": "اكتملت عملية التحقق هذه.",
28+
"verification-cancelled-message": "تم إلغاء عملية التحقق.",
29+
"verification-info-message":
30+
"نقوم بمعالجة عملية التحقق الخاصة بك. يمكنك الآن إغلاق هذه النافذة.",
31+
"verification-pending-message": "عملية التحقق الخاصة بك قيد الانتظار.",
32+
"verification-error-generic-message": "لم نتمكن من التحقق من بطاقتك.",
33+
"processing-verification-label": "جارٍ معالجة التحقق",
2734
"street1-label": "العنوان السطر 1",
2835
"street2-label": "العنوان السطر 2",
2936
"city-label": "المدينة",

src/dynamic-checkout/locales/de.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ module ProcessOut {
2525
"Wir verarbeiten Ihre Zahlung. Sie können dieses Fenster jetzt schließen.",
2626
"payment-pending-message": "Ihre Zahlung steht noch aus.",
2727
"payment-error-generic-message": "Wir konnten Ihre Zahlung nicht verarbeiten.",
28+
"verification-success-message": "Diese Verifizierung wurde abgeschlossen.",
29+
"verification-cancelled-message": "Die Verifizierung wurde abgebrochen.",
30+
"verification-info-message":
31+
"Wir verarbeiten Ihre Verifizierung. Sie können dieses Fenster jetzt schließen.",
32+
"verification-pending-message": "Ihre Verifizierung steht noch aus.",
33+
"verification-error-generic-message": "Wir konnten Ihre Karte nicht verifizieren.",
34+
"processing-verification-label": "Verifizierung wird verarbeitet",
2835
"street1-label": "Adresszeile 1",
2936
"street2-label": "Adresszeile 2",
3037
"city-label": "Stadt",

src/dynamic-checkout/locales/en.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ module ProcessOut {
2424
"payment-info-message": "We are processing your payment. You can now close this window.",
2525
"payment-pending-message": "Your payment is pending.",
2626
"payment-error-generic-message": "We were unable to process your payment.",
27+
"verification-success-message": "This verification is completed.",
28+
"verification-cancelled-message": "Verification has been cancelled.",
29+
"verification-info-message":
30+
"We are processing your verification. You can now close this window.",
31+
"verification-pending-message": "Your verification is pending.",
32+
"verification-error-generic-message": "We were unable to verify your card.",
33+
"processing-verification-label": "Processing verification",
2734
"street1-label": "Address line 1",
2835
"street2-label": "Address line 2",
2936
"city-label": "City",

src/dynamic-checkout/locales/es.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ module ProcessOut {
2424
"payment-info-message": "Estamos procesando su pago. Puede cerrar esta ventana.",
2525
"payment-pending-message": "Su pago está pendiente.",
2626
"payment-error-generic-message": "No pudimos procesar su pago.",
27+
"verification-success-message": "Esta verificación se ha completado.",
28+
"verification-cancelled-message": "La verificación ha sido cancelada.",
29+
"verification-info-message": "Estamos procesando su verificación. Puede cerrar esta ventana.",
30+
"verification-pending-message": "Su verificación está pendiente.",
31+
"verification-error-generic-message": "No pudimos verificar su tarjeta.",
32+
"processing-verification-label": "Procesando verificación",
2733
"street1-label": "Dirección, línea 1",
2834
"street2-label": "Dirección, línea 2",
2935
"city-label": "Ciudad",

src/dynamic-checkout/locales/fi.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ module ProcessOut {
2424
"payment-info-message": "Käsittelemme maksuasi. Voit nyt sulkea tämän ikkunan.",
2525
"payment-pending-message": "Maksusi on käsittelyssä.",
2626
"payment-error-generic-message": "Maksuasi ei voitu käsitellä.",
27+
"verification-success-message": "Tämä vahvistus on suoritettu.",
28+
"verification-cancelled-message": "Vahvistus on peruutettu.",
29+
"verification-info-message": "Käsittelemme vahvistustasi. Voit nyt sulkea tämän ikkunan.",
30+
"verification-pending-message": "Vahvistuksesi on käsittelyssä.",
31+
"verification-error-generic-message": "Korttiasi ei voitu vahvistaa.",
32+
"processing-verification-label": "Käsitellään vahvistusta",
2733
"street1-label": "Osoiterivi 1",
2834
"street2-label": "Osoiterivi 2",
2935
"city-label": "Kaupunki",

src/dynamic-checkout/locales/fr.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ module ProcessOut {
2525
"Nous travaillons sur votre paiement. Vous pouvez maintenant fermer cette fenêtre.",
2626
"payment-pending-message": "Votre paiement est en attente.",
2727
"payment-error-generic-message": "Nous n'avons pas pu traiter votre paiement.",
28+
"verification-success-message": "Cette vérification a été effectuée avec succès.",
29+
"verification-cancelled-message": "La vérification a été annulée.",
30+
"verification-info-message":
31+
"Nous travaillons sur votre vérification. Vous pouvez maintenant fermer cette fenêtre.",
32+
"verification-pending-message": "Votre vérification est en attente.",
33+
"verification-error-generic-message": "Nous n'avons pas pu vérifier votre carte.",
34+
"processing-verification-label": "Traitement de la vérification",
2835
"street1-label": "Adresse, ligne 1",
2936
"street2-label": "Adresse, ligne 2",
3037
"city-label": "Ville",

src/dynamic-checkout/locales/it.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ module ProcessOut {
2525
"Stiamo elaborando il tuo pagamento. Ora puoi chiudere questa finestra.",
2626
"payment-pending-message": "Il tuo pagamento è in sospeso.",
2727
"payment-error-generic-message": "Non è stato possibile elaborare il pagamento.",
28+
"verification-success-message": "La verifica è stata completata.",
29+
"verification-cancelled-message": "La verifica è stata annullata.",
30+
"verification-info-message":
31+
"Stiamo elaborando la tua verifica. Ora puoi chiudere questa finestra.",
32+
"verification-pending-message": "La tua verifica è in sospeso.",
33+
"verification-error-generic-message": "Non è stato possibile verificare la carta.",
34+
"processing-verification-label": "Elaborazione della verifica",
2835
"street1-label": "Indirizzo riga 1",
2936
"street2-label": "Indirizzo riga 2",
3037
"city-label": "Città",

0 commit comments

Comments
 (0)