diff --git a/examples/dynamic-checkout/index.html b/examples/dynamic-checkout/index.html
index 3f5245df..dc5f39fb 100644
--- a/examples/dynamic-checkout/index.html
+++ b/examples/dynamic-checkout/index.html
@@ -11,7 +11,7 @@
document.addEventListener("DOMContentLoaded", function () {
// You need to replace these values with your own
const projectId = "test-proj_qEi1u5BwoYcZb6mOMKDWIm4mpqKCq6bN"
- const invoiceId = "iv_30JJHCq6bN6TX1rV260OFo1oARdK0eQu"
+ const invoiceId = "iv_36LHtCq6bNj5JR3yggvgO4cSjR6XGBNB"
const clientSecret = ""
const client = new ProcessOut.ProcessOut(projectId)
@@ -21,6 +21,7 @@
clientSecret,
capturePayments: false,
allowFallbackToSale: false,
+ showStatusMessage: false,
locale: "en",
})
diff --git a/package.json b/package.json
index 116d812a..a7a9a365 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "processout.js",
- "version": "1.6.3",
+ "version": "1.6.4",
"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",
diff --git a/src/dynamic-checkout/clients/apple-pay.ts b/src/dynamic-checkout/clients/apple-pay.ts
index 534b6ad2..1ba0ea5f 100644
--- a/src/dynamic-checkout/clients/apple-pay.ts
+++ b/src/dynamic-checkout/clients/apple-pay.ts
@@ -129,10 +129,12 @@ module ProcessOut {
allow_fallback_to_sale: this.paymentConfig.allowFallbackToSale,
},
invoiceId => {
- getViewContainer().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ getViewContainer().appendChild(
+ new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
invoiceId,
@@ -140,10 +142,12 @@ module ProcessOut {
})
},
error => {
- getViewContainer().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ getViewContainer().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
diff --git a/src/dynamic-checkout/clients/google-pay.ts b/src/dynamic-checkout/clients/google-pay.ts
index 6df07423..4621a62f 100644
--- a/src/dynamic-checkout/clients/google-pay.ts
+++ b/src/dynamic-checkout/clients/google-pay.ts
@@ -129,12 +129,14 @@ module ProcessOut {
allow_fallback_to_sale: this.paymentConfig.allowFallbackToSale,
},
invoiceId => {
- getViewContainer().appendChild(
- new DynamicCheckoutPaymentSuccessView(
- this.processOutInstance,
- this.paymentConfig,
- ).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ getViewContainer().appendChild(
+ new DynamicCheckoutPaymentSuccessView(
+ this.processOutInstance,
+ this.paymentConfig,
+ ).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
invoiceId,
@@ -142,10 +144,14 @@ module ProcessOut {
})
},
error => {
- getViewContainer().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ getViewContainer().appendChild(
+ new DynamicCheckoutPaymentErrorView(
+ this.processOutInstance,
+ this.paymentConfig,
+ ).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
diff --git a/src/dynamic-checkout/config/payment-config.ts b/src/dynamic-checkout/config/payment-config.ts
index 69948c70..235d27d1 100644
--- a/src/dynamic-checkout/config/payment-config.ts
+++ b/src/dynamic-checkout/config/payment-config.ts
@@ -8,6 +8,7 @@ module ProcessOut {
clientSecret?: string
capturePayments?: boolean
allowFallbackToSale?: boolean
+ showStatusMessage?: boolean
}
export type DynamicCheckoutInternalConfigType = {
@@ -24,10 +25,12 @@ module ProcessOut {
locale: DynamicCheckoutPublicConfigType["locale"] = "en"
capturePayments: DynamicCheckoutPublicConfigType["capturePayments"] = false
allowFallbackToSale: DynamicCheckoutPublicConfigType["allowFallbackToSale"] = false
+ showStatusMessage: DynamicCheckoutPublicConfigType["showStatusMessage"] = true
invoiceDetails: DynamicCheckoutInternalConfigType["invoiceDetails"]
constructor(config: DynamicCheckoutPublicConfigType) {
this.setInitialConfig(config)
+ console.log(this.showStatusMessage)
}
public getConfig(): DynamicCheckoutPublicConfigType & DynamicCheckoutInternalConfigType {
@@ -38,6 +41,7 @@ module ProcessOut {
invoiceDetails: this.invoiceDetails,
capturePayments: this.capturePayments,
allowFallbackToSale: this.allowFallbackToSale,
+ showStatusMessage: this.showStatusMessage,
}
}
@@ -58,6 +62,12 @@ module ProcessOut {
this.locale = config.locale || "en"
this.capturePayments = config.capturePayments || false
this.allowFallbackToSale = config.allowFallbackToSale || false
+
+ if (config.showStatusMessage !== undefined && config.showStatusMessage !== null) {
+ this.showStatusMessage = config.showStatusMessage
+ } else {
+ this.showStatusMessage = true
+ }
}
private isValidConfig(config: DynamicCheckoutPublicConfigType) {
diff --git a/src/dynamic-checkout/payment-methods/apm.ts b/src/dynamic-checkout/payment-methods/apm.ts
index 73988873..f5a0e799 100644
--- a/src/dynamic-checkout/payment-methods/apm.ts
+++ b/src/dynamic-checkout/payment-methods/apm.ts
@@ -105,10 +105,12 @@ module ProcessOut {
paymentToken,
cardPaymentOptions,
invoiceId => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent(invoiceId)
},
@@ -174,20 +176,26 @@ module ProcessOut {
paymentToken,
options,
invoiceId => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(
- this.processOutInstance,
- this.paymentConfig,
- ).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(
+ this.processOutInstance,
+ this.paymentConfig,
+ ).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent(invoiceId)
},
error => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(
+ this.processOutInstance,
+ this.paymentConfig,
+ ).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
@@ -195,10 +203,12 @@ module ProcessOut {
)
},
error => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
@@ -207,10 +217,12 @@ module ProcessOut {
)
},
error => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
diff --git a/src/dynamic-checkout/payment-methods/card.ts b/src/dynamic-checkout/payment-methods/card.ts
index b34bf2e7..8b6dad7d 100644
--- a/src/dynamic-checkout/payment-methods/card.ts
+++ b/src/dynamic-checkout/payment-methods/card.ts
@@ -142,9 +142,11 @@ module ProcessOut {
}
private handleCardPaymentSuccess(invoiceId: string) {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.procesoutInstance, this.paymentConfig).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(this.procesoutInstance, this.paymentConfig).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
invoiceId,
@@ -153,9 +155,11 @@ module ProcessOut {
}
private handleCardPaymentError(error) {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.procesoutInstance, this.paymentConfig).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.procesoutInstance, this.paymentConfig).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
}
diff --git a/src/dynamic-checkout/payment-methods/native-apm.ts b/src/dynamic-checkout/payment-methods/native-apm.ts
index 74b80c6b..17b340a3 100644
--- a/src/dynamic-checkout/payment-methods/native-apm.ts
+++ b/src/dynamic-checkout/payment-methods/native-apm.ts
@@ -63,10 +63,12 @@ module ProcessOut {
})
window.addEventListener(NATIVE_APM_EVENTS.PAYMENT_SUCCESS, () => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
invoiceId: this.paymentConfig.invoiceId,
@@ -75,9 +77,12 @@ module ProcessOut {
})
window.addEventListener(NATIVE_APM_EVENTS.PAYMENT_ERROR, e => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(e)
})
diff --git a/src/dynamic-checkout/payment-methods/saved-apm.ts b/src/dynamic-checkout/payment-methods/saved-apm.ts
index 04aa2ec8..02cff69d 100644
--- a/src/dynamic-checkout/payment-methods/saved-apm.ts
+++ b/src/dynamic-checkout/payment-methods/saved-apm.ts
@@ -118,18 +118,24 @@ module ProcessOut {
paymentToken,
cardPaymentOptions,
invoiceId => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(
+ this.processOutInstance,
+ this.paymentConfig,
+ ).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent(invoiceId)
},
error => {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
- .element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
},
diff --git a/src/dynamic-checkout/payment-methods/saved-card.ts b/src/dynamic-checkout/payment-methods/saved-card.ts
index 8dfd3ac8..800ed187 100644
--- a/src/dynamic-checkout/payment-methods/saved-card.ts
+++ b/src/dynamic-checkout/payment-methods/saved-card.ts
@@ -104,9 +104,12 @@ module ProcessOut {
}
private handlePaymentSuccess(invoiceId: string) {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
+ .element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
invoiceId,
@@ -115,9 +118,11 @@ module ProcessOut {
}
private handlePaymentError(error) {
- this.resetContainerHtml().appendChild(
- new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig).element,
- )
+ if (this.paymentConfig.showStatusMessage) {
+ this.resetContainerHtml().appendChild(
+ new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig).element,
+ )
+ }
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
}