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