Add entity null check for paymongo webhooks #761
This commit is contained in:
parent
ee021da453
commit
a002da6aad
2 changed files with 7 additions and 5 deletions
|
|
@ -63,9 +63,11 @@ class PayMongoController extends Controller
|
|||
$metadata = $event['attributes']['metadata'];
|
||||
$obj = $this->getTransaction($metadata['transaction_id']);
|
||||
|
||||
// mark as paid
|
||||
$obj->setStatus(TransactionStatus::PAID);
|
||||
$this->em->flush();
|
||||
if (!empty($obj)) {
|
||||
// mark as paid
|
||||
$obj->setStatus(TransactionStatus::PAID);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
return $this->json([
|
||||
'success' => true,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class GatewayTransactionListener
|
|||
'gateway_transaction' => $gt_obj,
|
||||
]);
|
||||
|
||||
if ($obj) {
|
||||
if (!empty($obj)) {
|
||||
// mark as paid
|
||||
$obj->setDatePay(new DateTime());
|
||||
$obj->setStatus(InsuranceApplicationStatus::PAID);
|
||||
|
|
@ -67,7 +67,7 @@ class GatewayTransactionListener
|
|||
|
||||
// flag on api as paid
|
||||
$result = $this->ic->tagApplicationPaid($obj->getID());
|
||||
if (!$result['success']) {
|
||||
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