CSR-1391 switch payment functionality
This commit is contained in:
parent
30243856b8
commit
1061ba8c34
1 changed files with 57 additions and 15 deletions
|
|
@ -20,6 +20,39 @@
|
||||||
scrolling="no">
|
scrolling="no">
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
|
<div>Switch payment to:</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
v-if="paymentType !== 'cc'"
|
||||||
|
ref="switchToCCButton"
|
||||||
|
type="button"
|
||||||
|
@mousedown="switchPIAMethod('cc')"
|
||||||
|
aria-label="Switch to Credit Card">
|
||||||
|
Switch to Credit Card
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="paymentType !== 'cc'">or</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
v-if="paymentType !== 'pp'"
|
||||||
|
ref="switchToPPButton"
|
||||||
|
type="button"
|
||||||
|
@mousedown="switchPIAMethod('pp')"
|
||||||
|
aria-label="Switch to PayPal">
|
||||||
|
Switch to PayPal
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="paymentType === 'cc'">or</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
v-if="paymentType !== 'ap'"
|
||||||
|
ref="switchToAPButton"
|
||||||
|
type="button"
|
||||||
|
@mousedown="switchPIAMethod('ap')"
|
||||||
|
aria-label="Switch to Afterpay">
|
||||||
|
Switch to Afterpay
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<navbar
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
isForwardActionDisabled="true"
|
isForwardActionDisabled="true"
|
||||||
|
|
@ -32,7 +65,7 @@
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
ref="myForm"
|
ref="hopForm"
|
||||||
id="card-data"
|
id="card-data"
|
||||||
:target="paypalPayment ? '_top' : 'card-frame'"
|
:target="paypalPayment ? '_top' : 'card-frame'"
|
||||||
method="POST"
|
method="POST"
|
||||||
|
|
@ -403,6 +436,28 @@ export default {
|
||||||
window.location = applicationConfig.PIA_CANCEL_URL;
|
window.location = applicationConfig.PIA_CANCEL_URL;
|
||||||
//this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
//this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
|
switchPIAMethod(payMethod) {
|
||||||
|
this.paymentType = payMethod;
|
||||||
|
this.submitHopForm();
|
||||||
|
},
|
||||||
|
submitHopForm() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.hopForm.submit();
|
||||||
|
|
||||||
|
const iframe = this.$refs.paymentFrame;
|
||||||
|
if (iframe) {
|
||||||
|
iframe.onload = () => {
|
||||||
|
if (iframe.contentWindow) {
|
||||||
|
if (this.paymentType == "cc") {
|
||||||
|
iframe.contentWindow.postMessage("CreditCardChosen", "*");
|
||||||
|
} else if (this.paymentType == "ap") {
|
||||||
|
iframe.contentWindow.postMessage("afterpay", "*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
async fetchSignatureInfo(signatureInfo) {
|
async fetchSignatureInfo(signatureInfo) {
|
||||||
if (this.isPaypal()) {
|
if (this.isPaypal()) {
|
||||||
this.$refs.loadingModal.showModal();
|
this.$refs.loadingModal.showModal();
|
||||||
|
|
@ -412,20 +467,7 @@ export default {
|
||||||
this.authSignature = signatureInfo.signature;
|
this.authSignature = signatureInfo.signature;
|
||||||
this.authSignatureStart = signatureInfo.startDate;
|
this.authSignatureStart = signatureInfo.startDate;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.submitHopForm();
|
||||||
this.$refs.myForm.submit();
|
|
||||||
|
|
||||||
if (this.paymentType == "ap") {
|
|
||||||
const iframe = this.$refs.paymentFrame;
|
|
||||||
if (iframe) {
|
|
||||||
iframe.onload = () => {
|
|
||||||
if (iframe.contentWindow) {
|
|
||||||
iframe.contentWindow.postMessage("afterpay", "*");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue