airwallex-payment-elements
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -48,11 +48,8 @@ import { css, html, LitElement } from 'lit-element'; | ||
if (event.origin === this.gatewayBaseurl && event.isTrusted) { | ||
console.info(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
this.handleEvent(event.data); | ||
if (event.data.code === 'AWX_CHECKOUT_SUCCESS') { | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
const status = event.data.status ? `status=${event.data.status}` : ''; | ||
const intentId = event.data.payment_intent_id ? `&intentId=${event.data.payment_intent_id}` : ''; | ||
const instrumentId = event.data.instrument_id ? `&instrumentId=${event.data.instrument_id}` : ''; | ||
const transactionId = event.data.payment_transaction_id | ||
? `&transactionId=${event.data.payment_transaction_id}` | ||
: ''; | ||
const parameters = `${status}${intentId}${instrumentId}${transactionId}`; | ||
const intentId = event.data.id ? `&intentId=${event.data.id}` : ''; | ||
const parameters = `${status}${intentId}`; | ||
if (this.successUrl) { | ||
@@ -64,23 +61,12 @@ window.location.href = | ||
} | ||
else { | ||
this.handleEvent(event.data); | ||
} | ||
} | ||
else if (event.data.code === 'AWX_CHECKOUT_CANCEL') { | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
if (this.cancelUrl) { | ||
window.location.href = this.cancelUrl; | ||
} | ||
else { | ||
this.handleEvent(event.data); | ||
} | ||
} | ||
else if (event.data.code === 'AWX_CHECKOUT_ERROR') { | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
if (this.errorUrl) { | ||
window.location.href = this.errorUrl; | ||
} | ||
else { | ||
this.handleEvent(event.data); | ||
} | ||
} | ||
@@ -87,0 +73,0 @@ else { |
{ | ||
"name": "airwallex-payment-elements", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
@@ -61,13 +61,8 @@ import { css, html, LitElement } from 'lit-element'; | ||
if (event.origin === this.gatewayBaseurl && event.isTrusted) { | ||
console.info(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
this.handleEvent(event.data); | ||
if (event.data.code === 'AWX_CHECKOUT_SUCCESS') { | ||
// tslint:disable-next-line: no-console | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
const status = event.data.status ? `status=${event.data.status}` : ''; | ||
const intentId = event.data.payment_intent_id ? `&intentId=${event.data.payment_intent_id}` : ''; | ||
const instrumentId = event.data.instrument_id ? `&instrumentId=${event.data.instrument_id}` : ''; | ||
const transactionId = event.data.payment_transaction_id | ||
? `&transactionId=${event.data.payment_transaction_id}` | ||
: ''; | ||
const parameters = `${status}${intentId}${instrumentId}${transactionId}`; | ||
const intentId = event.data.id ? `&intentId=${event.data.id}` : ''; | ||
const parameters = `${status}${intentId}`; | ||
if (this.successUrl) { | ||
@@ -78,20 +73,10 @@ window.location.href = | ||
: `${this.successUrl}&${parameters}`; | ||
} else { | ||
this.handleEvent(event.data); | ||
} | ||
} else if (event.data.code === 'AWX_CHECKOUT_CANCEL') { | ||
// tslint:disable-next-line: no-console | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
if (this.cancelUrl) { | ||
window.location.href = this.cancelUrl; | ||
} else { | ||
this.handleEvent(event.data); | ||
} | ||
} else if (event.data.code === 'AWX_CHECKOUT_ERROR') { | ||
// tslint:disable-next-line: no-console | ||
console.log(`Airwallex Checkout Message: [${JSON.stringify(event.data)}]`); | ||
if (this.errorUrl) { | ||
window.location.href = this.errorUrl; | ||
} else { | ||
this.handleEvent(event.data); | ||
} | ||
@@ -98,0 +83,0 @@ } else { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2848667
3082