Prevent insurance applications from being flagged as paid more than once #801
This commit is contained in:
parent
ad841a7e25
commit
952122a39e
1 changed files with 9 additions and 6 deletions
|
|
@ -58,17 +58,20 @@ class GatewayTransactionListener
|
||||||
'gateway_transaction' => $gt_obj,
|
'gateway_transaction' => $gt_obj,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($obj)) {
|
// make sure the object exists and has not been processed yet
|
||||||
|
if (!empty($obj) && $obj->getStatus === InsuranceApplicationStatus::CREATED) {
|
||||||
// mark as paid
|
// mark as paid
|
||||||
$obj->setDatePay(new DateTime());
|
$obj->setDatePay(new DateTime());
|
||||||
$obj->setStatus(InsuranceApplicationStatus::PAID);
|
$obj->setStatus(InsuranceApplicationStatus::PAID);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
}
|
|
||||||
|
|
||||||
// flag on api as paid
|
// flag on api as paid
|
||||||
$result = $this->ic->tagApplicationPaid($obj->getExtTransactionId());
|
$result = $this->ic->tagApplicationPaid($obj->getExtTransactionId());
|
||||||
if (!$result['success'] || $result['response']['transaction_code'] !== 'GR004') {
|
|
||||||
error_log("INSURANCE MARK AS PAID FAILED FOR " . $obj->getID() . ": " . $result['error']['message']);
|
// something went wrong with insurance api
|
||||||
|
if (!$result['success'] || $result['response']['transaction_code'] !== 'GR004') {
|
||||||
|
error_log("INSURANCE MARK AS PAID FAILED FOR " . $obj->getID() . ": " . $result['error']['message']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue