Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processout.js",
"version": "1.9.7",
"version": "1.9.8",
"description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.",
"scripts": {
"build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic-checkout/dynamic-checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module ProcessOut {
this.widgetWrapper = document.createElement("div")
this.widgetWrapper.setAttribute("class", "dynamic-checkout-widget-wrapper")

if (this.paymentConfig.locale === "ar") {
if (Translations.isRtlLocale(this.paymentConfig.locale)) {
this.widgetWrapper.setAttribute("dir", "rtl")
}

Expand Down
24 changes: 14 additions & 10 deletions src/dynamic-checkout/payment-methods/apm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ module ProcessOut {
},
error => {
if (error.code === "customer.canceled") {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +180 to +185

DynamicCheckoutEventsUtils.dispatchPaymentCancelledEvent({
payment_method_name: apm.gateway_name,
Expand Down Expand Up @@ -365,12 +367,14 @@ module ProcessOut {
},
error => {
if (error.code === "customer.canceled") {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
}
Comment on lines +370 to +377

DynamicCheckoutEventsUtils.dispatchPaymentCancelledEvent({
payment_method_name: apm.gateway_name,
Expand Down
6 changes: 6 additions & 0 deletions src/dynamic-checkout/payment-methods/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ module ProcessOut {
fontSize: "14px",
}

if (Translations.isRtlLocale(this.paymentConfig.locale)) {
// Hosted field iframes don't inherit the widget's dir="rtl",
// so the direction has to be passed to them explicitly
options.style.direction = "rtl"
}

options.placeholder = ""
options.expiryAutoNext = false
options.cardNumberAutoNext = true
Expand Down
24 changes: 14 additions & 10 deletions src/dynamic-checkout/payment-methods/saved-apm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,14 @@ module ProcessOut {
},
error => {
if (error.code === "customer.canceled") {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
}
Comment on lines +165 to +172

DynamicCheckoutEventsUtils.dispatchPaymentCancelledEvent({
payment_method_name: apm_customer_token.gateway_name,
Expand Down Expand Up @@ -256,10 +258,12 @@ module ProcessOut {

private handlePaymentError(error) {
if (error.code === "customer.canceled") {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +261 to +266

DynamicCheckoutEventsUtils.dispatchPaymentCancelledEvent({
payment_method_name: this.paymentMethod.apm_customer_token
Expand Down
10 changes: 6 additions & 4 deletions src/dynamic-checkout/payment-methods/saved-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ module ProcessOut {

private handlePaymentError(error) {
if (error.code === "customer.canceled") {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +111 to +116

DynamicCheckoutEventsUtils.dispatchPaymentCancelledEvent({
payment_method_name: "card",
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic-checkout/styles/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ const defaultStyles = `
}

.dynamic-checkout-widget-wrapper[dir="rtl"] .dco-payment-method-card-form-input-cvc {
padding-right: 0;
padding-right: 8px;
padding-left: 40px;
}

Expand Down
6 changes: 6 additions & 0 deletions src/dynamic-checkout/utils/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ module ProcessOut {
vi: vi,
}

static rtlLocales = ["ar"]

static getText(key: string, locale: string) {
const keys =
Translations.localeTranslationsMap[locale] || Translations.localeTranslationsMap.en

return keys[key] || ""
}

static isRtlLocale(locale: string) {
return Translations.rtlLocales.indexOf(locale) !== -1
}
}
}
Loading