diff --git a/Controller/Payment/Notifications.php b/Controller/Payment/Notifications.php index 8cc0257..ccacad0 100644 --- a/Controller/Payment/Notifications.php +++ b/Controller/Payment/Notifications.php @@ -118,7 +118,10 @@ public function execute() ); $this->getResponse()->setHttpResponseCode(400); } catch (OrderHasBeenAlreadyPaidException $exception) { - $this->logger->info($exception->getMessage() . ' Skip processing the notification.'); + $this->logger->info( + $exception->getMessage() . ' Skip processing the notification.', + $notificationData + ); $this->getResponse()->setHttpResponseCode(200); } } diff --git a/Helper/NotificationProcessor.php b/Helper/NotificationProcessor.php index 50b7c57..0f606c9 100644 --- a/Helper/NotificationProcessor.php +++ b/Helper/NotificationProcessor.php @@ -90,9 +90,12 @@ public function process($paymentId, $status, $externalId) $this->logger->debug( "Current order state", - array_merge($this->loggerContext, [ - 'currentStatus' => $orderPaymentStatus - ]) + array_merge( + [ + 'currentStatus' => $orderPaymentStatus + ], + $this->loggerContext + ) ); if ($finalPaymentStatus) { @@ -212,7 +215,7 @@ private function paymentRejected() $this->order->addCommentToStatusHistory($message); } - $this->order->getPayment()->setIsClosed(true); + $this->order->getPayment()->setIsClosed(true); } /** @@ -250,6 +253,7 @@ private function isCorrectStatus($previousStatus, $nextStatus): bool { $paymentStatusFlow = [ Status::STATUS_NEW => [ + Status::STATUS_NEW, Status::STATUS_PENDING, Status::STATUS_ERROR, Status::STATUS_EXPIRED, diff --git a/Model/Exception/OrderHasBeenAlreadyPaidException.php b/Model/Exception/OrderHasBeenAlreadyPaidException.php index d3f9198..49d5bf9 100644 --- a/Model/Exception/OrderHasBeenAlreadyPaidException.php +++ b/Model/Exception/OrderHasBeenAlreadyPaidException.php @@ -11,7 +11,7 @@ */ class OrderHasBeenAlreadyPaidException extends Exception { - const EXCEPTION_MESSAGE = 'Order %s has been already paid in %s.'; + const EXCEPTION_MESSAGE = 'An order %s has been already paid in %s.'; public function __construct($orderId, $paymentId) { diff --git a/Test/Unit/Gateway/Response/Payment/AuthorizationHandlerTest.php b/Test/Unit/Gateway/Response/Payment/AuthorizationHandlerTest.php index 044e816..497af8e 100644 --- a/Test/Unit/Gateway/Response/Payment/AuthorizationHandlerTest.php +++ b/Test/Unit/Gateway/Response/Payment/AuthorizationHandlerTest.php @@ -34,6 +34,7 @@ public function testHandle() PaymentField::PAYMENT_ID_FIELD_NAME => 'testPaymentId', PaymentField::STATUS_FIELD_NAME => 'NEW', PaymentField::REDIRECT_URL_FIELD_NAME => 'testRedirectUrl', + PaymentField::EXTERNAL_ID_FIELD_NAME => 'testExternalId', ]; $paymentDO->expects(static::atLeastOnce()) diff --git a/composer.json b/composer.json index caf07c6..77c2a51 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "pay-now/paynow-magento2", "description": "Module for Paynow payments", "type": "magento2-module", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "keywords": [ "paynow", diff --git a/etc/module.xml b/etc/module.xml index b3d5b00..5f8deb7 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - +