Skip to content

Commit

Permalink
made formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsharma1100 committed Jul 21, 2022
1 parent a8e42f5 commit bc112d5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
7 changes: 4 additions & 3 deletions Controller/Payment/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ protected function authorize(array $post)
$order->addStatusHistoryComment(
__(
'Actual Amount %1 of %2, with Razorpay Offer/Fee applied.',
"Authroized",
"Authorized",
$order->getBaseCurrency()->formatTxt($amountPaid)
)
);
Expand Down Expand Up @@ -477,11 +477,11 @@ protected function orderPaid(array $post)
}
catch (\Magento\Framework\Exception\MailException $e)
{
$this->logger->critical($e);
$this->logger->critical($e->getMessage());
}
catch (\Exception $e)
{
$this->logger->critical($e);
$this->logger->critical($e->getMessage());
}
}

Expand Down Expand Up @@ -567,6 +567,7 @@ protected function setWebhookData($entityId, $webhookVerifiedStatus, $paymentId,
"event" => $event,
"amount" => $amount
);

$webhookDataText = serialize($webhookData);

$order = $this->order->load($entityId);
Expand Down
40 changes: 25 additions & 15 deletions Cron/UpdateOrdersToProcessing.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ public function execute()
{
$rzpWebhookDataObj = unserialize($rzpWebhookData);

if($rzpWebhookDataObj['webhook_verified_status'] === true)
{
$this->updateOrderStatus($order, $rzpWebhookDataObj);
}
$this->updateOrderStatus($order, $rzpWebhookDataObj);
}
else
{
Expand All @@ -159,10 +156,10 @@ private function updateOrderStatus($order, $rzpWebhookData)
. " started."
);

$payment = $order->getPayment();
$paymentId = $rzpWebhookData['payment_id'];
$payment = $order->getPayment();
$paymentId = $rzpWebhookData['payment_id'];
$rzpOrderAmount = $rzpWebhookData['amount'];
$event = $rzpWebhookData['event'];
$event = $rzpWebhookData['event'];

$payment->setLastTransId($paymentId)
->setTransactionId($paymentId)
Expand All @@ -183,7 +180,7 @@ private function updateOrderStatus($order, $rzpWebhookData)
""
);
}
else
else if ($event === 'order.paid')
{
$payment->addTransactionCommentsToOrder(
"$paymentId",
Expand All @@ -206,13 +203,26 @@ private function updateOrderStatus($order, $rzpWebhookData)

$order->setState(static::STATUS_PROCESSING)->setStatus(static::STATUS_PROCESSING);

$order->addStatusHistoryComment(
__(
'Actual Amount %1 of %2, with Razorpay Offer/Fee applied.',
"Authroized",
$order->getBaseCurrency()->formatTxt($amountPaid)
)
);
if ($event === 'payment.authorized')
{
$order->addStatusHistoryComment(
__(
'Actual Amount %1 of %2, with Razorpay Offer/Fee applied.',
"Authorized",
$order->getBaseCurrency()->formatTxt($amountPaid)
)
);
}
else if ($event === 'order.paid')
{
$order->addStatusHistoryComment(
__(
'%1 amount of %2 online, with Razorpay Offer/Fee applied.',
"Captured",
$order->getBaseCurrency()->formatTxt($amountPaid)
)
);
}

//update/disable the quote
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Expand Down

0 comments on commit bc112d5

Please sign in to comment.