From a05fd8f09920f8384e1624f6d1b672b8b8d3430b Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Tue, 9 Nov 2021 18:36:46 +0100 Subject: [PATCH 1/8] Release 1.1.1 --- composer.json | 2 +- etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 87bd8db..caf07c6 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.0", + "version": "1.1.1", "license": "MIT", "keywords": [ "paynow", diff --git a/etc/module.xml b/etc/module.xml index 9b7f5cd..b3d5b00 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - + From 61d88db98187eee95500899eaef7200662f6d643 Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Wed, 23 Feb 2022 19:07:49 +0100 Subject: [PATCH 2/8] Test Magento 2.4 --- etc/adminhtml/system/paynow_getting_started.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/adminhtml/system/paynow_getting_started.xml b/etc/adminhtml/system/paynow_getting_started.xml index dfdfa0e..f251ad1 100644 --- a/etc/adminhtml/system/paynow_getting_started.xml +++ b/etc/adminhtml/system/paynow_getting_started.xml @@ -6,10 +6,10 @@ If you do not have an account in the Paynow system yet, register in the Production or Sandbox environment.

]]>
- - - Paynow\PaymentGateway\Block\Adminhtml\System\Config\Field\Version - + + + + 1 \ No newline at end of file From 486685a73022c027138bbf98fd900da14f98958c Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Thu, 24 Feb 2022 10:59:55 +0100 Subject: [PATCH 3/8] Add extra logs --- Controller/Checkout/Redirect.php | 2 +- Controller/Checkout/Success.php | 12 ++++++++---- Controller/Payment/Notifications.php | 2 +- Gateway/Http/Client/PaymentAuthorization.php | 2 +- Gateway/Http/Client/PaymentCapture.php | 2 +- Gateway/Http/Client/PaymentRefund.php | 11 +++++++++-- .../Payment/AuthorizationValidator.php | 7 ++++++- .../Validator/Payment/CaptureValidator.php | 19 ++++++++++++++----- Gateway/Validator/Refund/RefundValidator.php | 17 ++++++++++++++++- Helper/NotificationProcessor.php | 6 ++++-- 10 files changed, 61 insertions(+), 19 deletions(-) diff --git a/Controller/Checkout/Redirect.php b/Controller/Checkout/Redirect.php index 891c526..11ba7bb 100644 --- a/Controller/Checkout/Redirect.php +++ b/Controller/Checkout/Redirect.php @@ -74,7 +74,7 @@ public function execute() $redirectUrl = $order->getPayment()->getAdditionalInformation(PaymentField::REDIRECT_URL_FIELD_NAME); $paymentId = $order->getPayment()->getAdditionalInformation(PaymentField::PAYMENT_ID_FIELD_NAME); if ($redirectUrl) { - $this->logger->info( + $this->logger->debug( 'Redirecting to payment provider page', [ PaymentField::EXTERNAL_ID_FIELD_NAME => $order->getRealOrderId(), diff --git a/Controller/Checkout/Success.php b/Controller/Checkout/Success.php index 4494762..57a3dff 100644 --- a/Controller/Checkout/Success.php +++ b/Controller/Checkout/Success.php @@ -121,15 +121,19 @@ private function retrievePaymentStatusAndUpdateOrder() { $allPayments = $this->order->getAllPayments(); $lastPaymentId = end($allPayments)->getAdditionalInformation(PaymentField::PAYMENT_ID_FIELD_NAME); - $loggerContext = [PaymentField::PAYMENT_ID_FIELD_NAME => $lastPaymentId]; + $this->logger->info( + "Retrieving payment status", + $loggerContext + ); + try { $service = new Payment($this->paymentHelper->initializePaynowClient()); $paymentStatusObject = $service->status($lastPaymentId); $status = $paymentStatusObject ->getStatus(); - $this->logger->debug( - "Retrieved status response", - array_merge($loggerContext, [$status]) + $this->logger->info( + "Retrieved payment status response", + array_merge($loggerContext, [PaymentField::STATUS_FIELD_NAME => $status]) ); $this->notificationProcessor->process($lastPaymentId, $status, $this->order->getIncrementId()); diff --git a/Controller/Payment/Notifications.php b/Controller/Payment/Notifications.php index 1279446..8cc0257 100644 --- a/Controller/Payment/Notifications.php +++ b/Controller/Payment/Notifications.php @@ -90,7 +90,7 @@ public function execute() { $payload = $this->getRequest()->getContent(); $notificationData = json_decode($payload, true); - $this->logger->debug("Received payment status notification", $notificationData); + $this->logger->info("Received payment status notification", $notificationData); $storeId = $this->storeManager->getStore()->getId(); $signatureKey = $this->configHelper->getSignatureKey($storeId, $this->configHelper->isTestMode($storeId)); diff --git a/Gateway/Http/Client/PaymentAuthorization.php b/Gateway/Http/Client/PaymentAuthorization.php index 69fcd72..669ae36 100644 --- a/Gateway/Http/Client/PaymentAuthorization.php +++ b/Gateway/Http/Client/PaymentAuthorization.php @@ -54,7 +54,7 @@ public function placeRequest(TransferInterface $transferObject) $transferObject->getBody(), $transferObject->getHeaders()[PaymentField::IDEMPOTENCY_KEY_FIELD_NAME] ); - $this->logger->debug( + $this->logger->info( "Retrieved authorization response", array_merge($loggerContext, [ PaymentField::STATUS_FIELD_NAME => $apiResponseObject->getStatus(), diff --git a/Gateway/Http/Client/PaymentCapture.php b/Gateway/Http/Client/PaymentCapture.php index ff8a0c7..261595c 100644 --- a/Gateway/Http/Client/PaymentCapture.php +++ b/Gateway/Http/Client/PaymentCapture.php @@ -49,7 +49,7 @@ public function placeRequest(TransferInterface $transferObject) PaymentField::STATUS_FIELD_NAME => $apiResponseObject->getStatus(), PaymentField::PAYMENT_ID_FIELD_NAME => $apiResponseObject->getPaymentId(), ]; - $this->logger->debug( + $this->logger->info( "Retrieved capture response", array_merge($loggerContext, $response) ); diff --git a/Gateway/Http/Client/PaymentRefund.php b/Gateway/Http/Client/PaymentRefund.php index 2c84d00..64a2aa7 100644 --- a/Gateway/Http/Client/PaymentRefund.php +++ b/Gateway/Http/Client/PaymentRefund.php @@ -49,15 +49,22 @@ public function placeRequest(TransferInterface $transferObject) $loggerContext = [ PaymentField::EXTERNAL_ID_FIELD_NAME => $transferObject->getBody()[PaymentField::EXTERNAL_ID_FIELD_NAME] ]; + $data = $transferObject->getBody(); + $this->logger->info( + "Processing create refund", + array_merge($loggerContext, [ + PaymentField::PAYMENT_ID_FIELD_NAME => $data[PaymentField::PAYMENT_ID_FIELD_NAME], + RefundField::AMOUNT_FIELD_NAME => $data[RefundField::AMOUNT_FIELD_NAME] + ]) + ); try { $service = new Refund($this->client); - $data = $transferObject->getBody(); $apiResponseObject = $service->create( $data[PaymentField::PAYMENT_ID_FIELD_NAME], $transferObject->getHeaders()[PaymentField::IDEMPOTENCY_KEY_FIELD_NAME], $data[RefundField::AMOUNT_FIELD_NAME] ); - $this->logger->debug( + $this->logger->info( "Retrieved create refund response", array_merge($loggerContext, [ RefundField::STATUS_FIELD_NAME => $apiResponseObject->getStatus(), diff --git a/Gateway/Validator/Payment/AuthorizationValidator.php b/Gateway/Validator/Payment/AuthorizationValidator.php index 41af2b8..59b97b3 100644 --- a/Gateway/Validator/Payment/AuthorizationValidator.php +++ b/Gateway/Validator/Payment/AuthorizationValidator.php @@ -45,7 +45,12 @@ public function validate(array $validationSubject) array_key_exists(PaymentField::STATUS_FIELD_NAME, $response) && $response[PaymentField::STATUS_FIELD_NAME] === Status::STATUS_NEW; - $this->logger->debug("Validating authorization response", ['valid' => $isResponseValid]); + $this->logger->debug("Validating authorization response", [ + PaymentField::EXTERNAL_ID_FIELD_NAME => $response[PaymentField::EXTERNAL_ID_FIELD_NAME], + PaymentField::PAYMENT_ID_FIELD_NAME => $response[PaymentField::PAYMENT_ID_FIELD_NAME], + PaymentField::STATUS_FIELD_NAME => $response[PaymentField::STATUS_FIELD_NAME], + 'valid' => $isResponseValid + ]); return $this->createResult( $isResponseValid, diff --git a/Gateway/Validator/Payment/CaptureValidator.php b/Gateway/Validator/Payment/CaptureValidator.php index 1c727a7..6f92888 100644 --- a/Gateway/Validator/Payment/CaptureValidator.php +++ b/Gateway/Validator/Payment/CaptureValidator.php @@ -40,19 +40,28 @@ public function __construct(ResultInterfaceFactory $resultFactory, Logger $logge public function validate(array $validationSubject) { $response = SubjectReader::readResponse($validationSubject); - $isResponseValid = array_key_exists(PaymentField::PAYMENT_ID_FIELD_NAME, $response) && - array_key_exists(PaymentField::STATUS_FIELD_NAME, $response) && - $response[PaymentField::STATUS_FIELD_NAME] === Status::STATUS_CONFIRMED; - $this->logger->debug( + $this->logger->info( "Validating capture response", [ - 'valid' => $isResponseValid, 'paymentId' => $response[PaymentField::PAYMENT_ID_FIELD_NAME], 'status' => $response[PaymentField::STATUS_FIELD_NAME] ] ); + $isResponseValid = array_key_exists(PaymentField::PAYMENT_ID_FIELD_NAME, $response) && + array_key_exists(PaymentField::STATUS_FIELD_NAME, $response) && + $response[PaymentField::STATUS_FIELD_NAME] === Status::STATUS_CONFIRMED; + + $this->logger->info( + "Capture response has been validated", + [ + PaymentField::PAYMENT_ID_FIELD_NAME => $response[PaymentField::PAYMENT_ID_FIELD_NAME], + PaymentField::STATUS_FIELD_NAME => $response[PaymentField::STATUS_FIELD_NAME], + 'valid' => $isResponseValid, + ] + ); + return $this->createResult( $isResponseValid, $isResponseValid ? [] : [__('Error occurred during the capture process.')] diff --git a/Gateway/Validator/Refund/RefundValidator.php b/Gateway/Validator/Refund/RefundValidator.php index e45401a..ec4f87e 100644 --- a/Gateway/Validator/Refund/RefundValidator.php +++ b/Gateway/Validator/Refund/RefundValidator.php @@ -40,11 +40,26 @@ public function __construct(ResultInterfaceFactory $resultFactory, Logger $logge public function validate(array $validationSubject) { $response = SubjectReader::readResponse($validationSubject); + $this->logger->info( + "Validating refund response", + [ + RefundField::REFUND_ID_FIELD_NAME => $response[RefundField::REFUND_ID_FIELD_NAME], + RefundField::STATUS_FIELD_NAME => $response[RefundField::STATUS_FIELD_NAME], + ] + ); + $isResponseValid = array_key_exists(RefundField::REFUND_ID_FIELD_NAME, $response) && array_key_exists(RefundField::STATUS_FIELD_NAME, $response) && $response[RefundField::STATUS_FIELD_NAME] === Status::STATUS_PENDING; - $this->logger->debug("Validating refund response", ['valid' => $isResponseValid]); + $this->logger->info( + "Refund response has been validated", + [ + RefundField::REFUND_ID_FIELD_NAME => $response[RefundField::REFUND_ID_FIELD_NAME], + RefundField::STATUS_FIELD_NAME => $response[RefundField::STATUS_FIELD_NAME], + 'valid' => $isResponseValid + ] + ); return $this->createResult( $isResponseValid, diff --git a/Helper/NotificationProcessor.php b/Helper/NotificationProcessor.php index 873a20b..bac0b74 100644 --- a/Helper/NotificationProcessor.php +++ b/Helper/NotificationProcessor.php @@ -72,9 +72,11 @@ public function __construct( public function process($paymentId, $status, $externalId) { $this->loggerContext = [ + PaymentField::EXTERNAL_ID_FIELD_NAME => $externalId, PaymentField::PAYMENT_ID_FIELD_NAME => $paymentId, - PaymentField::EXTERNAL_ID_FIELD_NAME => $externalId + PaymentField::STATUS_FIELD_NAME => $status ]; + $this->logger->info("Processing payment status notification", $this->loggerContext); /** @var Order */ $this->order = $this->orderFactory->create()->loadByIncrementId($externalId); @@ -87,7 +89,6 @@ public function process($paymentId, $status, $externalId) $finalPaymentStatus = $orderPaymentStatus == Status::STATUS_CONFIRMED; if ($finalPaymentStatus) { - $this->logger->info('Order has paid status. Skipped notification processing', $this->loggerContext); throw new OrderHasBeenAlreadyPaidException($externalId, $paymentId); } @@ -121,6 +122,7 @@ public function process($paymentId, $status, $externalId) break; } $this->orderRepository->save($this->order); + $this->logger->info("Finished processing payment status notification", $this->loggerContext); } private function paymentNew($paymentId) From f75960c142faf8b2bfb8eaeba5e632a5c4da8318 Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Thu, 24 Feb 2022 11:27:18 +0100 Subject: [PATCH 4/8] Revert version info --- etc/adminhtml/system/paynow_getting_started.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/adminhtml/system/paynow_getting_started.xml b/etc/adminhtml/system/paynow_getting_started.xml index f251ad1..dfdfa0e 100644 --- a/etc/adminhtml/system/paynow_getting_started.xml +++ b/etc/adminhtml/system/paynow_getting_started.xml @@ -6,10 +6,10 @@ If you do not have an account in the Paynow system yet, register in the Production or Sandbox environment.

]]>
- - - - + + + Paynow\PaymentGateway\Block\Adminhtml\System\Config\Field\Version + 1 \ No newline at end of file From 1406d04d591d48aeefc8a2f6912820f14ff6aadf Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Thu, 24 Feb 2022 13:11:06 +0100 Subject: [PATCH 5/8] Add externalId to authorization context --- Gateway/Http/Client/PaymentAuthorization.php | 1 + Helper/NotificationProcessor.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Gateway/Http/Client/PaymentAuthorization.php b/Gateway/Http/Client/PaymentAuthorization.php index 669ae36..53ab483 100644 --- a/Gateway/Http/Client/PaymentAuthorization.php +++ b/Gateway/Http/Client/PaymentAuthorization.php @@ -65,6 +65,7 @@ public function placeRequest(TransferInterface $transferObject) PaymentField::REDIRECT_URL_FIELD_NAME => $apiResponseObject->getRedirectUrl(), PaymentField::STATUS_FIELD_NAME => $apiResponseObject->getStatus(), PaymentField::PAYMENT_ID_FIELD_NAME => $apiResponseObject->getPaymentId(), + PaymentField::EXTERNAL_ID_FIELD_NAME => $transferObject->getBody()[PaymentField::EXTERNAL_ID_FIELD_NAME] ]; } catch (PaynowException $exception) { $this->logger->error( diff --git a/Helper/NotificationProcessor.php b/Helper/NotificationProcessor.php index bac0b74..50b7c57 100644 --- a/Helper/NotificationProcessor.php +++ b/Helper/NotificationProcessor.php @@ -88,6 +88,13 @@ public function process($paymentId, $status, $externalId) $orderPaymentStatus = $paymentAdditionalInformation[PaymentField::STATUS_FIELD_NAME]; $finalPaymentStatus = $orderPaymentStatus == Status::STATUS_CONFIRMED; + $this->logger->debug( + "Current order state", + array_merge($this->loggerContext, [ + 'currentStatus' => $orderPaymentStatus + ]) + ); + if ($finalPaymentStatus) { throw new OrderHasBeenAlreadyPaidException($externalId, $paymentId); } From 12ecb89ad582712fae9eb8456e562d85c512351e Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Thu, 24 Feb 2022 13:56:30 +0100 Subject: [PATCH 6/8] Release 1.1.2 --- Controller/Payment/Notifications.php | 5 ++++- Gateway/Http/Client/PaymentAuthorization.php | 6 ++++-- Gateway/Http/Client/PaymentCapture.php | 19 ++++++++++++------- Gateway/Http/Client/PaymentRefund.php | 9 +++++---- Helper/NotificationProcessor.php | 12 ++++++++---- .../OrderHasBeenAlreadyPaidException.php | 2 +- .../Payment/AuthorizationHandlerTest.php | 1 + composer.json | 2 +- etc/module.xml | 2 +- 9 files changed, 37 insertions(+), 21 deletions(-) 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/Gateway/Http/Client/PaymentAuthorization.php b/Gateway/Http/Client/PaymentAuthorization.php index 53ab483..b1aa5d3 100644 --- a/Gateway/Http/Client/PaymentAuthorization.php +++ b/Gateway/Http/Client/PaymentAuthorization.php @@ -69,10 +69,12 @@ public function placeRequest(TransferInterface $transferObject) ]; } catch (PaynowException $exception) { $this->logger->error( - $exception->getMessage(), + 'An error occurred during payment authorization', array_merge($loggerContext, [ 'service' => 'Payment', - 'action' => 'authorize' + 'action' => 'authorize', + 'message' => $exception->getMessage(), + 'errors' => $exception->getPrevious()->getErrors() ]) ); foreach ($exception->getErrors() as $error) { diff --git a/Gateway/Http/Client/PaymentCapture.php b/Gateway/Http/Client/PaymentCapture.php index 261595c..4e275ff 100644 --- a/Gateway/Http/Client/PaymentCapture.php +++ b/Gateway/Http/Client/PaymentCapture.php @@ -55,13 +55,18 @@ public function placeRequest(TransferInterface $transferObject) ); } catch (PaynowException $exception) { $response['errors'] = $exception->getMessage(); - $this->logger->error($exception->getMessage(), array_merge( - $loggerContext, - [ - 'service' => 'Payment', - 'action' => 'status' - ] - )); + $this->logger->error( + 'An error occurred during payment capture', + array_merge( + $loggerContext, + [ + 'service' => 'Payment', + 'action' => 'status', + 'message' => $exception->getMessage(), + 'errors' => $exception->getPrevious()->getErrors() + ] + ) + ); } return $response; diff --git a/Gateway/Http/Client/PaymentRefund.php b/Gateway/Http/Client/PaymentRefund.php index 64a2aa7..7cab967 100644 --- a/Gateway/Http/Client/PaymentRefund.php +++ b/Gateway/Http/Client/PaymentRefund.php @@ -58,8 +58,7 @@ public function placeRequest(TransferInterface $transferObject) ]) ); try { - $service = new Refund($this->client); - $apiResponseObject = $service->create( + $apiResponseObject = (new Refund($this->client))->create( $data[PaymentField::PAYMENT_ID_FIELD_NAME], $transferObject->getHeaders()[PaymentField::IDEMPOTENCY_KEY_FIELD_NAME], $data[RefundField::AMOUNT_FIELD_NAME] @@ -78,10 +77,12 @@ public function placeRequest(TransferInterface $transferObject) ]; } catch (PaynowException $exception) { $this->logger->error( - $exception->getMessage(), + 'An error occurred during refund create', array_merge($loggerContext, [ 'service' => 'Refund', - 'action' => 'create' + 'action' => 'create', + 'message' => $exception->getMessage(), + 'errors' => $exception->getPrevious()->getErrors() ]) ); foreach ($exception->getErrors() as $error) { 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 @@ - + From 4d936a074dfe6a05d90061f7203c64461c19f19f Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Fri, 25 Feb 2022 09:29:28 +0100 Subject: [PATCH 7/8] Fix test --- .../Validator/Payment/AuthorizationValidatorTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php b/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php index c6047b3..be0279a 100644 --- a/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php +++ b/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php @@ -101,7 +101,8 @@ public function dataProviderTestValidate() 'response' => [ PaymentField::PAYMENT_ID_FIELD_NAME => 'testPaymentId', PaymentField::STATUS_FIELD_NAME => 'NEW', - PaymentField::REDIRECT_URL_FIELD_NAME => 'testRedirectUrl' + PaymentField::REDIRECT_URL_FIELD_NAME => 'testRedirectUrl', + PaymentField::EXTERNAL_ID_FIELD_NAME => 'testExternalId' ], ], 'isValid' => true, @@ -111,7 +112,8 @@ public function dataProviderTestValidate() 'validationSubject' => [ 'response' => [ PaymentField::PAYMENT_ID_FIELD_NAME => 'testPaymentId', - PaymentField::STATUS_FIELD_NAME => 'NEW' + PaymentField::STATUS_FIELD_NAME => 'NEW', + PaymentField::EXTERNAL_ID_FIELD_NAME => 'testExternalId' ] ], 'isValid' => false, From b534a348d9d3d0a3a3578f32deb0b92a97ade9de Mon Sep 17 00:00:00 2001 From: Emil Leszczak Date: Fri, 25 Feb 2022 10:04:43 +0100 Subject: [PATCH 8/8] Revert "Merge branch 'master' into extra-logs" This reverts commit 8d2f56007f94d472a84abfc42098e4770518a451, reversing changes made to 4d936a074dfe6a05d90061f7203c64461c19f19f. --- Block/Payment/Confirm.php | 51 -------- Controller/Checkout/Success.php | 52 +++++--- Controller/Payment/Confirm.php | 115 ----------------- Controller/Payment/Status.php | 81 ------------ Gateway/Http/Client/PaymentAuthorization.php | 3 +- Gateway/Request/Payment/AuthorizeRequest.php | 8 +- Gateway/Request/Refund/RefundRequest.php | 2 +- .../Payment/AuthorizationValidator.php | 23 +--- Helper/GDPRHelper.php | 119 ------------------ Helper/PaymentField.php | 1 - Helper/PaymentStatusLabel.php | 19 --- Helper/PaymentStatusService.php | 54 -------- Model/Cache/GDPRNoticesCache.php | 25 ---- Model/Ui/BlikConfigProvider.php | 8 +- Model/Ui/ConfigProvider.php | 17 --- Observer/PaymentDataAssignObserver.php | 5 +- .../Payment/AuthorizationValidatorTest.php | 79 +----------- composer.json | 4 +- etc/cache.xml | 7 -- etc/di.xml | 18 --- etc/error_mapping.xml | 7 -- etc/module.xml | 2 +- i18n/pl_PL.csv | 17 +-- .../layout/paynow_payment_confirm.xml | 13 -- .../onepage/success_message_button.phtml | 2 +- .../templates/payment/blik/confirm.phtml | 38 ------ view/frontend/web/css/checkout.css | 42 ------- view/frontend/web/css/confirm_blik.css | 16 --- view/frontend/web/images/confirm-blik.png | Bin 9362 -> 0 bytes .../js/view/payment/paynow_blik_gateway.js | 27 +--- .../js/view/payment/paynow_confirm_blik.js | 60 --------- .../payment/data_processing_info.html | 13 -- .../template/payment/paynow_blik_gateway.html | 15 +-- 33 files changed, 57 insertions(+), 886 deletions(-) delete mode 100644 Block/Payment/Confirm.php delete mode 100644 Controller/Payment/Confirm.php delete mode 100644 Controller/Payment/Status.php delete mode 100644 Helper/GDPRHelper.php delete mode 100644 Helper/PaymentStatusLabel.php delete mode 100644 Helper/PaymentStatusService.php delete mode 100644 Model/Cache/GDPRNoticesCache.php delete mode 100644 etc/cache.xml delete mode 100644 etc/error_mapping.xml delete mode 100644 view/frontend/layout/paynow_payment_confirm.xml delete mode 100644 view/frontend/templates/payment/blik/confirm.phtml delete mode 100644 view/frontend/web/css/confirm_blik.css delete mode 100644 view/frontend/web/images/confirm-blik.png delete mode 100644 view/frontend/web/js/view/payment/paynow_confirm_blik.js delete mode 100644 view/frontend/web/template/payment/data_processing_info.html diff --git a/Block/Payment/Confirm.php b/Block/Payment/Confirm.php deleted file mode 100644 index 71e291b..0000000 --- a/Block/Payment/Confirm.php +++ /dev/null @@ -1,51 +0,0 @@ -getViewFileUrl('Paynow_PaymentGateway::images/confirm-blik.png'); - } - - /** - * @return string|null - */ - public function getPaymentId(): ?string - { - return $this->getData('payment_id'); - } - - /** - * @return array|mixed|null - */ - public function getPaymentStatus(): ?string - { - return $this->getData('payment_status'); - } - - /** - * @return Phrase|null - */ - public function getPaymentStatusLabel(): ?Phrase - { - $paymentStatus = $this->getPaymentStatus(); - if ($paymentStatus) { - return __(PaymentStatusLabel::${$paymentStatus}); - } - return null; - } -} diff --git a/Controller/Checkout/Success.php b/Controller/Checkout/Success.php index 4b64423..73e7428 100644 --- a/Controller/Checkout/Success.php +++ b/Controller/Checkout/Success.php @@ -5,13 +5,19 @@ use Magento\Checkout\Model\Session as CheckoutSession; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\CsrfAwareActionInterface; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\ResponseInterface; use Magento\Framework\Controller\Result\Redirect as ResponseRedirect; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\UrlInterface; use Magento\Sales\Model\Order; use Paynow\PaymentGateway\Helper\NotificationProcessor; use Paynow\PaymentGateway\Helper\PaymentField; -use Paynow\PaymentGateway\Helper\PaymentStatusService; +use Paynow\PaymentGateway\Helper\PaymentHelper; use Paynow\PaymentGateway\Model\Logger\Logger; +use Paynow\Service\Payment; /** * Class Return @@ -39,6 +45,10 @@ class Success extends Action * @var Order */ private $order; + /** + * @var \Magento\Framework\App\RequestInterface + */ + private $request; /** * @var UrlInterface @@ -46,14 +56,14 @@ class Success extends Action protected $urlBuilder; /** - * @var NotificationProcessor + * @var PaymentHelper */ - private $notificationProcessor; + private $paymentHelper; /** - * @var PaymentStatusService + * @var NotificationProcessor */ - private $paymentStatusService; + private $notificationProcessor; /** * Redirect constructor. @@ -62,7 +72,7 @@ class Success extends Action * @param Logger $logger * @param UrlInterface $urlBuilder * @param NotificationProcessor $notificationProcessor - * @param PaymentStatusService $paymentStatusService + * @param PaymentHelper $paymentHelper */ public function __construct( Context $context, @@ -70,26 +80,25 @@ public function __construct( Logger $logger, UrlInterface $urlBuilder, NotificationProcessor $notificationProcessor, - PaymentStatusService $paymentStatusService + PaymentHelper $paymentHelper ) { parent::__construct($context); $this->checkoutSession = $checkoutSession; $this->logger = $logger; $this->redirectResult = $this->resultRedirectFactory->create(); + $this->request = $this->getRequest(); $this->urlBuilder = $urlBuilder; $this->notificationProcessor = $notificationProcessor; + $this->paymentHelper = $paymentHelper; $this->order = $this->checkoutSession->getLastRealOrder(); - $this->paymentStatusService = $paymentStatusService; } /** - * @return ResponseRedirect + * @return ResponseInterface|ResponseRedirect|ResultInterface */ - public function execute(): ResponseRedirect + public function execute() { - $isRetry = $this->order && - $this->order->getPayment() && - $this->order->getPayment()->hasAdditionalInformation(PaymentField::IS_PAYMENT_RETRY_FIELD_NAME); + $isRetry = $this->order->getPayment()->hasAdditionalInformation(PaymentField::IS_PAYMENT_RETRY_FIELD_NAME); if ($this->shouldRetrieveStatus() && ! $isRetry) { $this->retrievePaymentStatusAndUpdateOrder(); @@ -99,10 +108,6 @@ public function execute(): ResponseRedirect return $this->redirectResult; } - /** - * @param bool $forRetryPayment - * @return string - */ public function getRedirectUrl(bool $forRetryPayment): string { if ($forRetryPayment) { @@ -121,13 +126,22 @@ private function retrievePaymentStatusAndUpdateOrder() "Retrieving payment status", $loggerContext ); + try { - $status = $this->paymentStatusService->getStatus($lastPaymentId); + $service = new Payment($this->paymentHelper->initializePaynowClient()); + $paymentStatusObject = $service->status($lastPaymentId); + $status = $paymentStatusObject ->getStatus(); $this->logger->info( "Retrieved payment status response", - array_merge($loggerContext, [PaymentField::STATUS_FIELD_NAME => $status]) + array_merge( + $loggerContext, + [ + PaymentField::STATUS_FIELD_NAME => $status + ] + ) ); $this->notificationProcessor->process($lastPaymentId, $status, $this->order->getIncrementId()); + } catch (\Exception $exception) { $this->logger->error($exception->getMessage(), $loggerContext); } diff --git a/Controller/Payment/Confirm.php b/Controller/Payment/Confirm.php deleted file mode 100644 index dc9427a..0000000 --- a/Controller/Payment/Confirm.php +++ /dev/null @@ -1,115 +0,0 @@ -pageFactory = $pageFactory; - $this->checkoutSession = $checkoutSession; - $this->logger = $logger; - $this->redirectResult = $this->resultRedirectFactory->create(); - $this->urlBuilder = $urlBuilder; - } - - public function execute() - { - $paymentData = $this->preparePaymentData(); - if ($paymentData) { - $resultPage = $this->pageFactory->create(); - $resultPage->addHandle(self::CONFIRM_BLOCK_NAME); - $paymentData = $this->preparePaymentData(); - $block = $resultPage->getLayout()->getBlock(self::CONFIRM_BLOCK_NAME); - $block->setData('payment_id', $paymentData['payment_id']); - $block->setData('payment_status', $paymentData['payment_status']); - $resultPage->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0', true); - return $resultPage; - } - - return $this->redirectResult->setUrl($this->urlBuilder->getUrl('paynow/checkout/success')); - } - - /** - * @return array - */ - private function preparePaymentData(): ?array - { - /** @var Order */ - $order = $this->checkoutSession->getLastRealOrder(); - if ($order) { - $allPayments = $order->getAllPayments(); - $lastPayment = end($allPayments); - if ($lastPayment) { - $paymentId = $lastPayment->getAdditionalInformation(PaymentField::PAYMENT_ID_FIELD_NAME); - $paymentStatus = $lastPayment->getAdditionalInformation(PaymentField::STATUS_FIELD_NAME); - - $this->logger->debug( - "Retrieved payment data from checkout session", - ["paymentId" => $paymentId, - "paymentStatus" => $paymentStatus, - "orderId" => $order->getIncrementId() - ] - ); - - return ["payment_id" => $paymentId, "payment_status" => $paymentStatus]; - } - } - return null; - } -} diff --git a/Controller/Payment/Status.php b/Controller/Payment/Status.php deleted file mode 100644 index 0bfc609..0000000 --- a/Controller/Payment/Status.php +++ /dev/null @@ -1,81 +0,0 @@ -checkoutSession = $checkoutSession; - $this->resultJsonFactory = $resultJsonFactory; - $this->paymentStatusService = $paymentStatusService; - } - - public function execute() - { - $resultJson = $this->resultJsonFactory->create(); - - /** @var Order */ - $order = $this->checkoutSession->getLastRealOrder(); - if (!$order) { - return $resultJson->setStatusHeader(404, null, 'Not Found'); - } - $allPayments = $order->getAllPayments(); - $lastPaymentId = end($allPayments)->getAdditionalInformation(PaymentField::PAYMENT_ID_FIELD_NAME); - $status = $this->paymentStatusService->getStatus($lastPaymentId); - - if ($status) { - return $resultJson->setData([ - 'paymentId' => $lastPaymentId, - 'payment_status' => $status, - 'payment_status_label' => __(PaymentStatusLabel::${$status}) - ]); - } - - return $resultJson->setStatusHeader(404, null, 'Not Found'); - } -} diff --git a/Gateway/Http/Client/PaymentAuthorization.php b/Gateway/Http/Client/PaymentAuthorization.php index 3ee3fb4..b1aa5d3 100644 --- a/Gateway/Http/Client/PaymentAuthorization.php +++ b/Gateway/Http/Client/PaymentAuthorization.php @@ -48,7 +48,6 @@ public function placeRequest(TransferInterface $transferObject) $loggerContext = [ PaymentField::EXTERNAL_ID_FIELD_NAME => $transferObject->getBody()[PaymentField::EXTERNAL_ID_FIELD_NAME] ]; - try { $service = new Payment($this->client); $apiResponseObject = $service->authorize( @@ -81,7 +80,7 @@ public function placeRequest(TransferInterface $transferObject) foreach ($exception->getErrors() as $error) { $this->logger->debug($error->getType() . ' - ' . $error->getMessage(), $loggerContext); } - return ['errors' => $exception->getErrors()]; + return $response['errors'] = $exception->getErrors(); } } } diff --git a/Gateway/Request/Payment/AuthorizeRequest.php b/Gateway/Request/Payment/AuthorizeRequest.php index c4737d7..016f91f 100644 --- a/Gateway/Request/Payment/AuthorizeRequest.php +++ b/Gateway/Request/Payment/AuthorizeRequest.php @@ -80,14 +80,8 @@ public function build(array $buildSubject) } } - if ($this->payment->hasAdditionalInformation(PaymentDataAssignObserver::BLIK_CODE) - && ! empty($this->payment->getAdditionalInformation(PaymentDataAssignObserver::BLIK_CODE))) { - $request['body'][PaymentField::AUTHORIZATION_CODE] = $this->payment - ->getAdditionalInformation(PaymentDataAssignObserver::BLIK_CODE); - } - $request['headers'] = [ - PaymentField::IDEMPOTENCY_KEY_FIELD_NAME => uniqid(substr($referenceId, 0, 22), true) + PaymentField::IDEMPOTENCY_KEY_FIELD_NAME => uniqid($referenceId, true) ]; return $request; diff --git a/Gateway/Request/Refund/RefundRequest.php b/Gateway/Request/Refund/RefundRequest.php index 3a44d33..f540346 100644 --- a/Gateway/Request/Refund/RefundRequest.php +++ b/Gateway/Request/Refund/RefundRequest.php @@ -46,7 +46,7 @@ public function build(array $buildSubject) ]; $request['headers'] = [ - PaymentField::IDEMPOTENCY_KEY_FIELD_NAME => uniqid(substr($referenceId, 0, 22), true) + PaymentField::IDEMPOTENCY_KEY_FIELD_NAME => uniqid($referenceId, true) ]; return $request; diff --git a/Gateway/Validator/Payment/AuthorizationValidator.php b/Gateway/Validator/Payment/AuthorizationValidator.php index 5af5c12..59b97b3 100644 --- a/Gateway/Validator/Payment/AuthorizationValidator.php +++ b/Gateway/Validator/Payment/AuthorizationValidator.php @@ -9,7 +9,6 @@ use Paynow\Model\Payment\Status; use Paynow\PaymentGateway\Helper\PaymentField; use Paynow\PaymentGateway\Model\Logger\Logger; -use Paynow\PaymentGateway\Observer\PaymentDataAssignObserver; /** * Class PaymentAuthorizationValidator @@ -38,26 +37,13 @@ public function __construct(ResultInterfaceFactory $resultFactory, Logger $logge * @param array $validationSubject * @return ResultInterface */ - public function validate(array $validationSubject): ResultInterface + public function validate(array $validationSubject) { $response = SubjectReader::readResponse($validationSubject); - $payment = SubjectReader::readPayment($validationSubject); - - $isWhiteLabelPayment = $payment->getPayment()->hasAdditionalInformation(PaymentDataAssignObserver::BLIK_CODE) - && ! empty($payment->getPayment()->getAdditionalInformation(PaymentDataAssignObserver::BLIK_CODE)); - $isResponseValid = array_key_exists(PaymentField::PAYMENT_ID_FIELD_NAME, $response) && + array_key_exists(PaymentField::REDIRECT_URL_FIELD_NAME, $response) && array_key_exists(PaymentField::STATUS_FIELD_NAME, $response) && - in_array($response[PaymentField::STATUS_FIELD_NAME], [ - Status::STATUS_NEW, - Status::STATUS_PENDING - ]); - - if (! $isWhiteLabelPayment) { - $isResponseValid= $isResponseValid && - array_key_exists(PaymentField::REDIRECT_URL_FIELD_NAME, $response) && - ! empty($response[PaymentField::REDIRECT_URL_FIELD_NAME]); - } + $response[PaymentField::STATUS_FIELD_NAME] === Status::STATUS_NEW; $this->logger->debug("Validating authorization response", [ PaymentField::EXTERNAL_ID_FIELD_NAME => $response[PaymentField::EXTERNAL_ID_FIELD_NAME], @@ -68,8 +54,7 @@ public function validate(array $validationSubject): ResultInterface return $this->createResult( $isResponseValid, - $isResponseValid ? [] : [__('Error occurred during the payment process.')], - $isResponseValid || !$isWhiteLabelPayment ? [] : [$response['errors'][0]->getType()] + $isResponseValid ? [] : [__('Error occurred during the payment process.')] ); } } diff --git a/Helper/GDPRHelper.php b/Helper/GDPRHelper.php deleted file mode 100644 index cadb769..0000000 --- a/Helper/GDPRHelper.php +++ /dev/null @@ -1,119 +0,0 @@ -paymentHelper = $paymentHelper; - $this->logger = $logger; - $this->cache = $cache; - $this->serializer = $serializer; - $this->client = $this->paymentHelper->initializePaynowClient(); - } - - /** - * @return array - */ - public function getNotices(): array - { - $cacheKey = GDPRNoticesCache::TYPE_IDENTIFIER . '-' . $this->paymentHelper->getStoreLocale(); - $cacheTag = GDPRNoticesCache::CACHE_TAG; - $notices = []; - $gdpr_notices = $this->cache->load($cacheKey); - if (!$gdpr_notices) { - $gdpr_notices = $this->retrieve(); - foreach ($gdpr_notices as $notice) { - $notices[] = [ - 'title' => $notice->getTitle(), - 'content' => $notice->getContent() - ]; - } - $this->cache->save( - $this->serializer->serialize($notices), - $cacheKey, - [$cacheTag], - 1440 - ); - } else { - $this->logger->info("Retrieving GDPR notices from cache"); - $unserialized = $this->serializer->unserialize($gdpr_notices); - if ($unserialized) { - foreach ($unserialized as $notice) { - $notices[] = [ - 'title' => $notice["title"], - 'content' => $notice["content"] - ]; - } - } - } - - return $notices; - } - - /** - * @return array|null - */ - private function retrieve(): ?array - { - try { - $this->logger->info("Retrieving GDPR notices"); - return (new DataProcessing($this->client)) - ->getNotices($this->paymentHelper->getStoreLocale()) - ->getAll(); - } catch (PaynowException $exception) { - $this->logger->error($exception->getMessage()); - } - - return null; - } -} diff --git a/Helper/PaymentField.php b/Helper/PaymentField.php index e3a563c..c56ef5c 100644 --- a/Helper/PaymentField.php +++ b/Helper/PaymentField.php @@ -27,5 +27,4 @@ class PaymentField const STATUS_FIELD_NAME = 'status'; const ORDER_ITEMS = 'orderItems'; const VALIDITY_TIME = 'validityTime'; - const AUTHORIZATION_CODE = 'authorizationCode'; } diff --git a/Helper/PaymentStatusLabel.php b/Helper/PaymentStatusLabel.php deleted file mode 100644 index 8f9654a..0000000 --- a/Helper/PaymentStatusLabel.php +++ /dev/null @@ -1,19 +0,0 @@ -logger = $logger; - $this->paymentHelper = $paymentHelper; - } - - /** - * @param $paymentId - * @return string|void - */ - public function getStatus($paymentId) - { - $loggerContext = [PaymentField::PAYMENT_ID_FIELD_NAME => $paymentId]; - - try { - $paymentStatusObject = (new Payment($this->paymentHelper->initializePaynowClient()))->status($paymentId); - $status = $paymentStatusObject->getStatus(); - $this->logger->debug( - "Retrieved status response", - array_merge($loggerContext, ['status' => $status]) - ); - - return $status; - } catch (\Exception $exception) { - $this->logger->error($exception->getMessage(), $loggerContext); - } - } -} diff --git a/Model/Cache/GDPRNoticesCache.php b/Model/Cache/GDPRNoticesCache.php deleted file mode 100644 index ff53933..0000000 --- a/Model/Cache/GDPRNoticesCache.php +++ /dev/null @@ -1,25 +0,0 @@ -get(self::TYPE_IDENTIFIER), self::CACHE_TAG); - } -} diff --git a/Model/Ui/BlikConfigProvider.php b/Model/Ui/BlikConfigProvider.php index 37bcc57..cf4992e 100644 --- a/Model/Ui/BlikConfigProvider.php +++ b/Model/Ui/BlikConfigProvider.php @@ -3,7 +3,6 @@ namespace Paynow\PaymentGateway\Model\Ui; use Magento\Checkout\Model\ConfigProviderInterface; -use Paynow\Model\PaymentMethods\AuthorizationType; /** * Class ConfigProvider @@ -29,8 +28,6 @@ public function getConfig(): array && $this->configHelper->isBlikActive() && $blikPaymentMethod && $blikPaymentMethod->isEnabled(); - $GDPRNotices = $this->GDPRHelper->getNotices(); - $isWhiteLabel = $blikPaymentMethod && $blikPaymentMethod->getAuthorizationType() === AuthorizationType::CODE; return [ 'payment' => [ @@ -38,10 +35,7 @@ public function getConfig(): array 'isActive' => $isActive, 'logoPath' => $blikPaymentMethod ? $blikPaymentMethod->getImage() : null, 'redirectUrl' => $this->getRedirectUrl(), - 'paymentMethodId' => $blikPaymentMethod ? $blikPaymentMethod->getId(): null, - 'GDPRNotices' => $GDPRNotices, - 'isWhiteLabel' => $isWhiteLabel, - 'blikConfirmUrl' => $this->getConfirmBlikUrl() + 'paymentMethodId' => $blikPaymentMethod ? $blikPaymentMethod->getId(): null ] ] ]; diff --git a/Model/Ui/ConfigProvider.php b/Model/Ui/ConfigProvider.php index b0c6874..5278172 100644 --- a/Model/Ui/ConfigProvider.php +++ b/Model/Ui/ConfigProvider.php @@ -6,7 +6,6 @@ use Magento\Framework\App\RequestInterface; use Magento\Framework\UrlInterface; use Paynow\PaymentGateway\Helper\ConfigHelper; -use Paynow\PaymentGateway\Helper\GDPRHelper; use Paynow\PaymentGateway\Helper\PaymentHelper; use Paynow\PaymentGateway\Helper\PaymentMethodsHelper; @@ -44,11 +43,6 @@ class ConfigProvider */ protected $paymentMethodsHelper; - /** - * @var GDPRHelper - */ - protected $GDPRHelper; - /** * @var CheckoutSession */ @@ -59,7 +53,6 @@ public function __construct( RequestInterface $request, PaymentHelper $paymentHelper, PaymentMethodsHelper $paymentMethodsHelper, - GDPRHelper $GDPRHelper, ConfigHelper $configHelper, CheckoutSession $checkoutSession ) { @@ -69,7 +62,6 @@ public function __construct( $this->paymentMethodsHelper = $paymentMethodsHelper; $this->configHelper = $configHelper; $this->checkoutSession = $checkoutSession; - $this->GDPRHelper = $GDPRHelper; } /** @@ -81,15 +73,6 @@ protected function getRedirectUrl() return $this->urlBuilder->getUrl('paynow/checkout/redirect', ['_secure' => $this->getRequest()->isSecure()]); } - /** - * Return url for BLIK confirmation page - * @return string - */ - protected function getConfirmBlikUrl(): string - { - return $this->urlBuilder->getUrl('paynow/payment/confirm', ['_secure' => $this->getRequest()->isSecure()]); - } - /** * Retrieve request object * @return RequestInterface diff --git a/Observer/PaymentDataAssignObserver.php b/Observer/PaymentDataAssignObserver.php index bcf52e4..69ecbab 100644 --- a/Observer/PaymentDataAssignObserver.php +++ b/Observer/PaymentDataAssignObserver.php @@ -15,14 +15,11 @@ class PaymentDataAssignObserver extends AbstractDataAssignObserver { const PAYMENT_METHOD_ID = 'payment_method_id'; - const BLIK_CODE = 'blik_code'; - /** * @var array */ protected $additionalInformationList = [ - self::PAYMENT_METHOD_ID, - self::BLIK_CODE + self::PAYMENT_METHOD_ID ]; /** diff --git a/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php b/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php index 242148f..be0279a 100644 --- a/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php +++ b/Test/Unit/Gateway/Validator/Payment/AuthorizationValidatorTest.php @@ -3,15 +3,11 @@ namespace Paynow\PaymentGateway\Test\Unit\Gateway\Validator\Payment; use Magento\Framework\Phrase; -use Magento\Payment\Gateway\Data\PaymentDataObjectInterface; use Magento\Payment\Gateway\Validator\Result; use Magento\Payment\Gateway\Validator\ResultInterface; use Magento\Payment\Gateway\Validator\ResultInterfaceFactory; -use Magento\Sales\Model\Order\Payment; -use Paynow\Exception\Error; use Paynow\PaymentGateway\Gateway\Validator\Payment\AuthorizationValidator; use Paynow\PaymentGateway\Helper\PaymentField; -use Paynow\PaymentGateway\Observer\PaymentDataAssignObserver; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -74,7 +70,7 @@ public function testValidateReadResponseException() * * @dataProvider dataProviderTestValidate */ - public function testValidate(array $validationSubject, $isValid, $messages, $messageCodes) + public function testValidate(array $validationSubject, $isValid, $messages) { /** @var ResultInterface|MockObject $result */ $result = new Result($isValid, $messages); @@ -84,7 +80,7 @@ public function testValidate(array $validationSubject, $isValid, $messages, $mes [ 'isValid' => $isValid, 'failsDescription' => $messages, - 'errorCodes' => $messageCodes + 'errorCodes' => [] ] ) ->willReturn($result); @@ -99,15 +95,6 @@ public function testValidate(array $validationSubject, $isValid, $messages, $mes */ public function dataProviderTestValidate() { - $error = $this->getMockBuilder(Error::class) - ->disableOriginalConstructor() - ->getMock(); - - $error - ->expects($this->any()) - ->method('getType') - ->willReturn('WRONG_BLIK_CODE'); - return [ [ 'validationSubject' => [ @@ -117,22 +104,8 @@ public function dataProviderTestValidate() PaymentField::REDIRECT_URL_FIELD_NAME => 'testRedirectUrl', PaymentField::EXTERNAL_ID_FIELD_NAME => 'testExternalId' ], - 'payment' => $this->getPaymentDataObject('') - ], - 'isValid' => true, - [], - [] - ], - [ - 'validationSubject' => [ - 'response' => [ - PaymentField::PAYMENT_ID_FIELD_NAME => 'testPaymentId', - PaymentField::STATUS_FIELD_NAME => 'NEW' - ], - 'payment' => $this->getPaymentDataObject('111111') ], 'isValid' => true, - [], [] ], [ @@ -141,57 +114,13 @@ public function dataProviderTestValidate() PaymentField::PAYMENT_ID_FIELD_NAME => 'testPaymentId', PaymentField::STATUS_FIELD_NAME => 'NEW', PaymentField::EXTERNAL_ID_FIELD_NAME => 'testExternalId' - ], - 'payment' => $this->getPaymentDataObject('') + ] ], 'isValid' => false, [ __('Error occurred during the payment process.') - ], - [] - ], - [ - 'validationSubject' => [ - 'response' => [ - 'errors' => [$error] - ], - 'payment' => $this->getPaymentDataObject('123123') - ], - 'isValid' => false, - [ - __('Error occurred during the payment process.') - ], - ['WRONG_BLIK_CODE'] + ] ] ]; } - - private function getPaymentDataObject($blikCode) - { - $paymentInfo = $this->getMockBuilder(Payment::class) - ->disableOriginalConstructor() - ->getMock(); - - $paymentInfo - ->expects($this->any()) - ->method('getAdditionalInformation') - ->willReturn([PaymentDataAssignObserver::BLIK_CODE => $blikCode]); - - $paymentInfo - ->expects($this->any()) - ->method('hasAdditionalInformation') - ->with(PaymentDataAssignObserver::BLIK_CODE) - ->willReturn(boolval($blikCode)); - - $paymentDO = $this->getMockBuilder(PaymentDataObjectInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $paymentDO - ->expects($this->any()) - ->method('getPayment') - ->willReturn($paymentInfo); - - return $paymentDO; - } } diff --git a/composer.json b/composer.json index 0949b2e..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.2.0", + "version": "1.1.2", "license": "MIT", "keywords": [ "paynow", @@ -24,7 +24,7 @@ "magento/module-payment": ">=100.2", "magento/module-sales": ">=101", "nyholm/psr7": "^1.2", - "pay-now/paynow-php-sdk": "^2.2", + "pay-now/paynow-php-sdk": "^2.1.3", "php": ">=7.1", "php-http/curl-client": "^2.1", "ext-json": "*" diff --git a/etc/cache.xml b/etc/cache.xml deleted file mode 100644 index f80289c..0000000 --- a/etc/cache.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - Paynow GDPR notices cache. - - \ No newline at end of file diff --git a/etc/di.xml b/etc/di.xml index 9f37900..8c0aa7c 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -48,7 +48,6 @@ Paynow\PaymentGateway\Gateway\Http\Client\PaymentAuthorization Paynow\PaymentGateway\Gateway\Response\Payment\AuthorizationHandler Paynow\PaymentGateway\Gateway\Validator\Payment\AuthorizationValidator - Paynow\PaymentGateway\Gateway\ErrorMapper\VirtualErrorMessageMapper @@ -142,21 +141,4 @@ - - - - - error_mapping.xml - - - - - Paynow\PaymentGateway\Gateway\ErrorMapper\VirtualConfigReader - - - - - Paynow\PaymentGateway\Gateway\ErrorMapper\VirtualMappingData - - \ No newline at end of file diff --git a/etc/error_mapping.xml b/etc/error_mapping.xml deleted file mode 100644 index 6b34adb..0000000 --- a/etc/error_mapping.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Wrong BLIK code - BLIK code has expired - BLIK code already used - - \ No newline at end of file diff --git a/etc/module.xml b/etc/module.xml index 9c3826c..5f8deb7 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - + diff --git a/i18n/pl_PL.csv b/i18n/pl_PL.csv index 89b8017..e87acef 100644 --- a/i18n/pl_PL.csv +++ b/i18n/pl_PL.csv @@ -55,19 +55,4 @@ Information,Informacje "Your payment has been completed.", "Twoja płatnośc zakończyła się sukcesem." "Use the button below to retry payment:", "Użyj poniższego przycisku, aby ponowić próbę płatności:" "Your payment has been expired.", "Twoja płatność wygasła." -"New payment created for order. Transaction ID: ", "Utworzono nową płatność dla zamówienia. ID transakcji: " -"Confirm the payment using the app on your phone.", "Potwierdź płatność w swojej aplikacji bankowej." -"Your payment ID: ", "Numer płatności: " -"Current payment status: ", "Status płatności: " -"processing", "w trakcie realizacji" -"expired", "przeterminowana" -"succeeded", "zrealizowana" -"failed", "nieudana" -"rejected", "odrzucona" -"abandoned", "porzucona" -"Enter the BLIK code", "Wprowadź kod BLIK" -" Read more", " Czytaj więcej" -"Wrong BLIK code", "Nieprawidłowy kod BLIK" -"BLIK code has expired", "Kod BLIK jest nieaktualny" -"BLIK code already used", "Kod BLIK był wcześniej wykorzystany" - +"New payment created for order. Transaction ID: ", "Utworzono nową płatność dla zamówienia. ID transakcji: " \ No newline at end of file diff --git a/view/frontend/layout/paynow_payment_confirm.xml b/view/frontend/layout/paynow_payment_confirm.xml deleted file mode 100644 index c03914e..0000000 --- a/view/frontend/layout/paynow_payment_confirm.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/view/frontend/templates/onepage/success_message_button.phtml b/view/frontend/templates/onepage/success_message_button.phtml index 7ba2e22..60d9b62 100644 --- a/view/frontend/templates/onepage/success_message_button.phtml +++ b/view/frontend/templates/onepage/success_message_button.phtml @@ -5,7 +5,7 @@ if ($block->getPaymentStatusPhrase()) : ?>

escapeHtml($block->getPaymentStatusPhrase()); ?>

canRetryPayment()) : ?> -

escapeHtml(__('Use the button below to retry payment:')); ?>

+

escapeHtml(__('Use the button below to retry payment')); ?>

escapeHtml(__('Retry payment')); ?> diff --git a/view/frontend/templates/payment/blik/confirm.phtml b/view/frontend/templates/payment/blik/confirm.phtml deleted file mode 100644 index 008ef71..0000000 --- a/view/frontend/templates/payment/blik/confirm.phtml +++ /dev/null @@ -1,38 +0,0 @@ - -
-

escapeHtml(__('Confirm the payment using the app on your phone.')) ?>

- -
-

- escapeHtml(__('Your payment ID: ')) ?> - - escapeHtml($block->getPaymentId()) ?> - -

-

- escapeHtml(__('Current payment status: ')) ?> - - escapeHtml($block->getPaymentStatusLabel()); ?> - -

-
-
- - diff --git a/view/frontend/web/css/checkout.css b/view/frontend/web/css/checkout.css index f6c634f..6093032 100644 --- a/view/frontend/web/css/checkout.css +++ b/view/frontend/web/css/checkout.css @@ -46,46 +46,4 @@ .paynow-payment-option.disabled div { cursor: not-allowed; -} - -.paynow-payment-option-blik { - padding: 1rem; -} - -.paynow-payment-option-blik .paynow-data-processing-info { - margin-top: 1rem; -} - -.paynow-payment-option-blik label { - display: inline-block; - text-align: left; - font-weight: 700; - margin-right: 2rem; -} - -.paynow-payment-option-blik input[type=text] { - letter-spacing: 10px; - display: inline-block; - width: 150px; - text-align: center; - padding: 1.75rem; - background: #f6f6f6; -} - -.paynow-data-processing-info { - color: #797979; - text-align: justify; -} - -.payment-form .paynow-data-processing-info { - font-size: 0.7rem; -} - -.paynow-data-processing-info ul { - list-style-type: lower-alpha; - margin: 0 1rem; -} - -.paynow-data-processing-info .expand { - cursor: pointer; } \ No newline at end of file diff --git a/view/frontend/web/css/confirm_blik.css b/view/frontend/web/css/confirm_blik.css deleted file mode 100644 index f7196f7..0000000 --- a/view/frontend/web/css/confirm_blik.css +++ /dev/null @@ -1,16 +0,0 @@ -.paynow-confirm-blik { - text-align: center; - background: #fff; - padding: 1.5rem; - margin-bottom: 1rem; -} - -.paynow-confirm-blik img { - max-width: 35%; -} - -.paynow-confirm-blik .headline { - font-size: 1.8125rem; - color: #232323; - font-weight: 700; -} \ No newline at end of file diff --git a/view/frontend/web/images/confirm-blik.png b/view/frontend/web/images/confirm-blik.png deleted file mode 100644 index 93f59eff6cc6bc646f4e133c788b9765f893d24d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9362 zcmeHs_g52J)HYUB1g=!2UZr;t0@6jLBy>XPO{#Q3TBui%7CMC9G?b7~1B70r_Z|ok zij;tK=^Z|N|Au$HKYeGdS!?z)d!Dn;b7uBFXC_=zU5We=!y^(B5^|vOduwkRuNWR@5ZGX++PLhyLlE_|?uk9oWgCsHiB>pXbX#-nH;s!|kev(A=kVN&8 z{MY(7!sz~+;QxR7{|fvsD&UGDC%>WNaMxA`li+FZ{QRGm6L+fS${F;KQhsm6>=mSz zo-k70PwcPQJNlQNcBYnu!j?5&uS;u<$XBWxMv`yBEvBrLNpl zg@D(!?hO%pe0-$r*n8?BN<)LFT0GaIFqbd@QK>~ai_x@FLq(|cX)G?^HO3)x5zo&n zw?~Yt<&Yeb)tR~nbGo0tG`w@+Uy^LjpByMck)O#}4FK$Th~(?KXuCv3%tLtoMX4=% zUdUPffHEDNKI#n5&ed8U)geuHorz3e*v%>Q$)Ih*fZk{`=8B&sr+yFXe1XR7DAp3d z`kKP?-*$Je&gU-j#&5?@KjrEf`wE&|jk;8~oMxyO#M+3#8d6*uYk=a-4v%9>SA|Od zxry_)b>QQkk1!&;qW#QT4D}H-&Vfb&V>}QmEp))(zTc)$0SkE)KmFKQFNm8huJiS; zLJd1EkDT_*<}M~hD3dCbM!hpi7Eq9?UP!Mcug$pd@yy?Q$CHA>c$H3Vl&3; zOc|SZ9b&+{v_2my;-HAypNAK{&v=*f#9G3~dRcebOEuV`0~4o(msU*=ma4#B2N&Fq zA!=3D)X=!mt5{uueY@J+EGsSCxju`@zcp^Mv*6fQcVRL!X(^V zC%|+NGt&?4N(X!9ngO%UmYCcb^BJG2mx~y$y^{cR^(o#_UvMs;tdwu$Fz}THRaAk# z;)pv?Bjnvs-~?rBc)$qD9#>;HI*-S}lBar1Lc&mAVgZBujI>KDPnzLr7PmP@Q3&P9CPB`$Bx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zd}7C)&VvSSmQklw2ObKLo%t!ojeu?j{<-FBay=V2?$M>ahgO5GA~Tg zp-wfvyP;(K#{}leNavQRGWpj8>*a~kzMlbJOt z^*wO8X8TIj%+)B4I$W>bZLi#r3li!JH%6UE7oRv2$BVI5e|L6C)0 zwKg_9{1V4L?|Rc+ZS3eEbuFY5;p3$nP=0okn?aN-EJ7uvQwAp% zlHH0+YikFHi+*ONZ2+_cNiMrK;B?i(P~_&9K42+_9ZqO4!zD~CELNodDm(O& zB#f~zyVlr9oAKP-?#w-apppaniSNZMULIN;9IjOc7O31Q)IZZ3si&l4;OVnKy*I2= z9PNb|sk15sG#~vp{Z(Ul;A@vfmIXTf=-gptnlHoyn$SsRmVRfbG`$CU3dn`5kGkyM zN>^sxV*bdveiU;sLM4M4~9Al*oslZ2(=ezdAR<-cV zmCV8A{mr5aDycF)Y1>h6-b*SqFMNXmA}O)YS!SwKoX=WIqDMGNlv&N_6a~rW$VmVV zy|+Eu2DZMzhhg8t_BfUzeq_SR`K9Td7wP(XqO7tbPuFHq8~GQ{334vy4(ji95}Yk3 znX9^0lni4u6H0`zxHwZ-d7z3}>V$%Ydaql2ReAmgl?$6jj_mah*}2>>=_)P3KA4p) ziy4~J%{t=G1!Ok-H%i!ps|2|n+of$+H&ksPU=6UllTzoW)a&IDm(ah@&e|ciK43^| z0BL^<)Pk?;%3h9`xO&*xQ|u`3`$+LrTe1P{9&>{6`yr77wyc@LaEoeNnmlr`!_)f&R=BBxz7JgXga2`$U)zfd>N%jJ&91cGDe<6ra2X$X}*;KXP~-P%BRP|GA2;~X7;Ku(6M^5xJ~wfa36D(?R@h|$${%nouL?upSK# { - self.redirectToReturn(self.paymentStatus, self.paymentId) - }, 60000); - }, - redirectToReturn: function (paymentStatus, paymentId) { - const successUrl = url.build('paynow/checkout/success'); - window.location.replace(successUrl + '?paymentStatus=' + paymentStatus + '&paymentId=' + paymentId); - }, - fetchNewData : function () { - self.currentReq = $.ajax({ - url: url.build('paynow/payment/status'), - dataType: 'json', - type: 'get'}); - - self.currentReq - .done(self.processNewData) - .always(self.scheduleNewDataFetch); - }, - processNewData: function (data) { - self.paymentStatus(data.payment_status); - self.paymentId(data.paymentId); - self.paymentStatusLabel(data.payment_status_label); - - if (!["PENDING", "NEW"].includes(data.payment_status)) { - self.redirectToReturn(data.payment_status, data.paymentId); - } - }, - scheduleNewDataFetch: function () { - if (self.currentReq) { - self.currentReq.abort(); - } - - if (self.timeout) { - clearTimeout(self.timeout); - } - - self.currentReq = null; - self.timeout = setTimeout(self.fetchNewData, self.INTERVAL); - } - }); -}); diff --git a/view/frontend/web/template/payment/data_processing_info.html b/view/frontend/web/template/payment/data_processing_info.html deleted file mode 100644 index 562985b..0000000 --- a/view/frontend/web/template/payment/data_processing_info.html +++ /dev/null @@ -1,13 +0,0 @@ -
- -
- - - -
-

-
- -
- -
\ No newline at end of file diff --git a/view/frontend/web/template/payment/paynow_blik_gateway.html b/view/frontend/web/template/payment/paynow_blik_gateway.html index 719d716..87a49aa 100644 --- a/view/frontend/web/template/payment/paynow_blik_gateway.html +++ b/view/frontend/web/template/payment/paynow_blik_gateway.html @@ -1,4 +1,4 @@ -
+
- -
- - - - -
- -
- -