fixed the duplicate non-approval call from intellipay
This commit is contained in:
@@ -49,8 +49,6 @@ const CardPaymentModalComponent = ({
|
|||||||
document.documentElement.appendChild(node);
|
document.documentElement.appendChild(node);
|
||||||
window.intellipay.initialize();
|
window.intellipay.initialize();
|
||||||
|
|
||||||
// console.log("Declined Payments - Intellipay", window.intellipay);
|
|
||||||
|
|
||||||
window.intellipay.runOnClose(() => {
|
window.intellipay.runOnClose(() => {
|
||||||
window.intellipay.initialize();
|
window.intellipay.initialize();
|
||||||
});
|
});
|
||||||
@@ -63,22 +61,20 @@ const CardPaymentModalComponent = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.intellipay.runOnNonApproval(async function (response) {
|
window.intellipay.runOnNonApproval(async function (response) {
|
||||||
console.log("Declined Payments", response);
|
|
||||||
// Mutate unsuccessful payment
|
// Mutate unsuccessful payment
|
||||||
|
await insertPaymentResponse({
|
||||||
// await insertPaymentResponse({
|
variables: {
|
||||||
// variables: {
|
paymentResponse: {
|
||||||
// paymentResponse: {
|
amount: response.amount,
|
||||||
// amount: response.amount,
|
bodyshopid: bodyshop.id,
|
||||||
// bodyshopid: bodyshop.id,
|
jobid: jobid || context.jobid,
|
||||||
// jobid: jobid || context.jobid,
|
declinereason: response.declinereason,
|
||||||
// declinereason: response.declinereason,
|
ext_paymentid: response.paymentid.toString(),
|
||||||
// ext_paymentid: response.paymentid.toString(),
|
successful: false,
|
||||||
// successful: false,
|
response,
|
||||||
// response,
|
},
|
||||||
// },
|
},
|
||||||
// },
|
});
|
||||||
// });
|
|
||||||
|
|
||||||
// Insert failed payment to audit trail
|
// Insert failed payment to audit trail
|
||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
@@ -93,6 +89,18 @@ const CardPaymentModalComponent = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
form.setFieldValue("payer", t("payments.labels.customer"));
|
form.setFieldValue("payer", t("payments.labels.customer"));
|
||||||
|
|
||||||
|
function handleEvents(...props) {
|
||||||
|
const operation = props[0].data.operation;
|
||||||
|
|
||||||
|
if (operation === "updateform") {
|
||||||
|
props[0].stopImmediatePropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("message", handleEvents, false);
|
||||||
|
|
||||||
|
return () => window.removeEventListener("message", handleEvents, false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function CardPaymentModalContainer({
|
|||||||
Go Back
|
Go Back
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
width="50%"
|
width="60%"
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
>
|
>
|
||||||
<CardPaymentModalComponent bodyshop={bodyshop} context={context} />
|
<CardPaymentModalComponent bodyshop={bodyshop} context={context} />
|
||||||
|
|||||||
Reference in New Issue
Block a user