From f4a7d40c14a5ea6ca3a47baf35cc3aa17e388186 Mon Sep 17 00:00:00 2001 From: Oleksii Skorobogatko Date: Mon, 9 Sep 2024 19:11:26 +0300 Subject: [PATCH 1/5] #5 split on Mirspay and Custom namespaces --- bin/console | 2 +- composer.json | 5 ++-- config/packages/doctrine.yaml | 6 ++--- config/packages/maker.yaml | 5 ++++ config/packages/messenger.yaml | 2 +- config/routes.yaml | 4 ++-- config/services.yaml | 24 ++++++++++--------- phpunit.xml.dist | 1 + public/index.php | 2 +- src/{Controller => Custom}/.gitignore | 0 src/Custom/README.md | 20 ++++++++++++++++ .../Command/PaymentGatewaysCommand.php | 6 ++--- .../Command/SubscriberAddHttpCommand.php | 8 +++---- .../Command/SubscriberChannelsCommand.php | 4 ++-- .../Command/SubscriberGetCommand.php | 6 ++--- .../Command/SubscriberRemoveCommand.php | 6 ++--- .../Controller/Api/V1/OrderController.php | 24 +++++++++---------- .../Controller/Api/V1/PaymentController.php | 24 +++++++++---------- .../DataFixtures/OrderFixture.php | 10 ++++---- .../DataFixtures/SubscriberFixture.php | 8 +++---- src/{ => Mirspay}/Dto/OrderDto.php | 2 +- src/{ => Mirspay}/Dto/PaymentGatewayDto.php | 6 ++--- src/{ => Mirspay}/Dto/PaymentStatusDto.php | 6 ++--- src/{ => Mirspay}/Dto/ProductDto.php | 2 +- src/{ => Mirspay}/Entity/Order.php | 8 +++---- src/{ => Mirspay}/Entity/OrderProduct.php | 6 ++--- src/{ => Mirspay}/Entity/OrderStatus.php | 2 +- .../Entity/PaymentProcessing.php | 8 +++---- src/{ => Mirspay}/Entity/Subscriber.php | 4 ++-- .../AfterPaymentCallbackHandlerEvent.php | 6 ++--- .../BeforePaymentCallbackHandlerEvent.php | 6 ++--- .../Event/OrderStatusWasChanged.php | 10 ++++---- src/{ => Mirspay}/Event/OrderWasCreated.php | 4 ++-- .../Event/PaymentStatusEvent.php | 6 ++--- .../NotifySubscribersListener.php | 8 +++---- .../TrackPaymentStatusRequestListener.php | 6 ++--- src/{ => Mirspay}/Kernel.php | 2 +- .../Message/NotifySubscriber.php | 2 +- .../NotifySubscriberHandler.php | 14 +++++------ .../Order/OrderTotalAmountCalculator.php | 4 ++-- .../Order/Workflow/OrderWorkflow.php | 16 ++++++------- .../Order/Workflow/OrderWorkflowFactory.php | 8 +++---- .../Order/Workflow/OrderWorkflowInterface.php | 4 ++-- .../Payment/Common/AbstractGateway.php | 4 ++-- .../CommonPaymentStatusRequestBuilder.php | 6 ++--- .../Builder/CommonPurchaseRequestBuilder.php | 6 ++--- .../PaymentStatusRequestBuilderInterface.php | 6 ++--- .../PurchaseRequestBuilderInterface.php | 11 +++++++++ .../Payment/Common/Exception/Exception.php | 2 +- .../Exception/InvalidRequestException.php | 2 +- .../Exception/InvalidResponseException.php | 2 +- ...PaymentGatewayIsNotRegisteredException.php | 2 +- .../RequestParameterRequiredException.php | 2 +- .../Payment/Common/GatewayInterface.php | 8 +++---- .../Common/Message/AbstractRequest.php | 6 ++--- .../Common/Message/AbstractResponse.php | 2 +- .../Common/Message/MessageInterface.php | 2 +- .../Payment/Common/Message/NullRequest.php | 2 +- .../Message/PaymentStatusRequestInterface.php | 2 +- .../Message/PurchaseRequestInterface.php | 2 +- .../Message/RedirectResponseInterface.php | 2 +- .../Common/Message/RequestInterface.php | 2 +- .../Common/Message/ResponseInterface.php | 2 +- .../ServerCallbackHandlerInterface.php | 4 ++-- .../Payment/Common/PaymentGatewayRegistry.php | 4 ++-- .../PaymentGatewayRegistryInterface.php | 4 ++-- .../Exception/InvalidResponseException.php | 11 +++++++++ .../InvalidResponseSignatureException.php | 2 +- .../Exception/ResponseDecodeException.php | 2 +- .../UnsupportedCurrencyException.php | 6 ++--- src/{ => Mirspay}/Payment/LiqPay/Gateway.php | 24 +++++++++---------- .../LiqPay/Request/AbstractRequest.php | 6 ++--- .../LiqPay/Request/CheckoutRequest.php | 12 +++++----- .../Payment/LiqPay/Request/MessageEncoder.php | 4 ++-- .../LiqPay/Request/PaymentStatusRequest.php | 10 ++++---- .../LiqPay/Response/AbstractResponse.php | 10 ++++---- .../LiqPay/Response/CheckoutResponse.php | 8 +++---- .../LiqPay/Response/MessageDecoder.php | 7 +++--- .../LiqPay/Response/PaymentStatusResponse.php | 2 +- .../Payment/LiqPay/Response/SignedMessage.php | 4 ++-- .../Payment/LiqPay/ServerCallbackHandler.php | 18 +++++++------- .../Payment/LiqPay/Signature.php | 2 +- .../Repository/OrderProductRepository.php | 4 ++-- .../Repository/OrderRepository.php | 4 ++-- .../PaymentProcessingRepository.php | 4 ++-- .../Repository/SubscriberRepository.php | 6 ++--- .../Action/AddHttpSubscriberAction.php | 8 +++---- .../Subscriber/Action/AddSubscriberAction.php | 16 ++++++------- .../SendSubscriberNotificationAction.php | 16 ++++++------- .../Channel/AbstractChannelMessage.php | 6 ++--- .../Channel/ChannelMessageInterface.php | 6 ++--- .../Channel/HttpNotificationChannel.php | 6 ++--- .../Channel/NotificationChannelCollection.php | 6 ++--- .../Channel/NotificationChannelInterface.php | 6 ++--- .../Channel/SimpleArrayChannelMessage.php | 4 ++-- .../Exception/ChannelMessageException.php | 2 +- .../Exception/ChannelMessageNotRegistered.php | 4 +--- .../NotificationChannelException.php | 2 +- ...ificationChannelNotRegisteredException.php | 4 +--- .../Exception/SubscriberExistsException.php | 2 +- .../PurchaseRequestBuilderInterface.php | 11 --------- .../Exception/InvalidResponseException.php | 11 --------- tests/Application/Api/V1/CreateOrderTest.php | 18 +++++++------- .../Api/V1/LiqPayPaymentCallbackTest.php | 10 ++++---- .../Api/V1/PaymentControllerTest.php | 6 ++--- .../Command/AbstractCommandTest.php | 2 +- .../Command/PaymentGatewaysCommandTest.php | 8 +++---- .../Subscribers/AddHttpCommandTest.php | 12 +++++----- .../Subscribers/ChannelsCommandTest.php | 6 ++--- .../Command/Subscribers/RemoveCommandTest.php | 10 ++++---- .../Event/NotifySubscribersTest.php | 16 ++++++------- tests/Concerns/WithFaker.php | 2 +- tests/Concerns/WithFixtureLoader.php | 2 +- tests/Concerns/WithOrderPostData.php | 2 +- tests/Concerns/WithPaymentGateway.php | 4 ++-- tests/Concerns/WithProductDto.php | 4 ++-- .../Order/OrderTotalAmountCalculatorTest.php | 8 +++---- .../Common/Message/NullRequestTest.php | 4 ++-- tests/Unit/Payment/LiqPay/GatewayTest.php | 16 ++++++------- .../LiqPay/Request/CheckoutRequestTest.php | 20 ++++++++-------- .../LiqPay/Request/MessageEncoderTest.php | 8 +++---- .../Request/PaymentStatusRequestTest.php | 12 +++++----- .../LiqPay/Response/MessageDecoderTest.php | 12 +++++----- .../Response/PaymentStatusResponseTest.php | 8 +++---- .../LiqPay/ServerCallbackHandlerTest.php | 24 +++++++++---------- tests/Unit/Payment/LiqPay/SignatureTest.php | 6 ++--- .../AddHttpSubscriberActionTest.php | 16 ++++++------- .../NotificationChannelCollectionTest.php | 12 +++++----- .../SendSubscriberNotificationActionTest.php | 20 ++++++++-------- .../SimpleArrayChannelMessageTest.php | 16 ++++++------- 130 files changed, 477 insertions(+), 455 deletions(-) create mode 100644 config/packages/maker.yaml rename src/{Controller => Custom}/.gitignore (100%) create mode 100644 src/Custom/README.md rename src/{ => Mirspay}/Command/PaymentGatewaysCommand.php (92%) rename src/{ => Mirspay}/Command/SubscriberAddHttpCommand.php (94%) rename src/{ => Mirspay}/Command/SubscriberChannelsCommand.php (93%) rename src/{ => Mirspay}/Command/SubscriberGetCommand.php (96%) rename src/{ => Mirspay}/Command/SubscriberRemoveCommand.php (94%) rename src/{ => Mirspay}/Controller/Api/V1/OrderController.php (91%) rename src/{ => Mirspay}/Controller/Api/V1/PaymentController.php (89%) rename src/{ => Mirspay}/DataFixtures/OrderFixture.php (92%) rename src/{ => Mirspay}/DataFixtures/SubscriberFixture.php (86%) rename src/{ => Mirspay}/Dto/OrderDto.php (98%) rename src/{ => Mirspay}/Dto/PaymentGatewayDto.php (92%) rename src/{ => Mirspay}/Dto/PaymentStatusDto.php (95%) rename src/{ => Mirspay}/Dto/ProductDto.php (94%) rename src/{ => Mirspay}/Entity/Order.php (97%) rename src/{ => Mirspay}/Entity/OrderProduct.php (95%) rename src/{ => Mirspay}/Entity/OrderStatus.php (94%) rename src/{ => Mirspay}/Entity/PaymentProcessing.php (92%) rename src/{ => Mirspay}/Entity/Subscriber.php (97%) rename src/{ => Mirspay}/Event/AfterPaymentCallbackHandlerEvent.php (72%) rename src/{ => Mirspay}/Event/BeforePaymentCallbackHandlerEvent.php (78%) rename src/{ => Mirspay}/Event/OrderStatusWasChanged.php (65%) rename src/{ => Mirspay}/Event/OrderWasCreated.php (74%) rename src/{ => Mirspay}/Event/PaymentStatusEvent.php (75%) rename src/{ => Mirspay}/EventListener/NotifySubscribersListener.php (88%) rename src/{ => Mirspay}/EventListener/TrackPaymentStatusRequestListener.php (85%) rename src/{ => Mirspay}/Kernel.php (90%) rename src/{ => Mirspay}/Message/NotifySubscriber.php (92%) rename src/{ => Mirspay}/MessageHandler/NotifySubscriberHandler.php (80%) rename src/{ => Mirspay}/Order/OrderTotalAmountCalculator.php (97%) rename src/{ => Mirspay}/Order/Workflow/OrderWorkflow.php (83%) rename src/{ => Mirspay}/Order/Workflow/OrderWorkflowFactory.php (79%) rename src/{ => Mirspay}/Order/Workflow/OrderWorkflowInterface.php (67%) rename src/{ => Mirspay}/Payment/Common/AbstractGateway.php (94%) rename src/{ => Mirspay}/Payment/Common/Builder/CommonPaymentStatusRequestBuilder.php (77%) rename src/{ => Mirspay}/Payment/Common/Builder/CommonPurchaseRequestBuilder.php (84%) rename src/{ => Mirspay}/Payment/Common/Builder/PaymentStatusRequestBuilderInterface.php (54%) create mode 100644 src/Mirspay/Payment/Common/Builder/PurchaseRequestBuilderInterface.php rename src/{ => Mirspay}/Payment/Common/Exception/Exception.php (72%) rename src/{ => Mirspay}/Payment/Common/Exception/InvalidRequestException.php (85%) rename src/{ => Mirspay}/Payment/Common/Exception/InvalidResponseException.php (86%) rename src/{ => Mirspay}/Payment/Common/Exception/PaymentGatewayIsNotRegisteredException.php (86%) rename src/{ => Mirspay}/Payment/Common/Exception/RequestParameterRequiredException.php (88%) rename src/{ => Mirspay}/Payment/Common/GatewayInterface.php (71%) rename src/{ => Mirspay}/Payment/Common/Message/AbstractRequest.php (95%) rename src/{ => Mirspay}/Payment/Common/Message/AbstractResponse.php (94%) rename src/{ => Mirspay}/Payment/Common/Message/MessageInterface.php (84%) rename src/{ => Mirspay}/Payment/Common/Message/NullRequest.php (94%) rename src/{ => Mirspay}/Payment/Common/Message/PaymentStatusRequestInterface.php (89%) rename src/{ => Mirspay}/Payment/Common/Message/PurchaseRequestInterface.php (96%) rename src/{ => Mirspay}/Payment/Common/Message/RedirectResponseInterface.php (88%) rename src/{ => Mirspay}/Payment/Common/Message/RequestInterface.php (87%) rename src/{ => Mirspay}/Payment/Common/Message/ResponseInterface.php (91%) rename src/{ => Mirspay}/Payment/Common/Message/ServerCallbackHandlerInterface.php (86%) rename src/{ => Mirspay}/Payment/Common/PaymentGatewayRegistry.php (93%) rename src/{ => Mirspay}/Payment/Common/PaymentGatewayRegistryInterface.php (84%) create mode 100644 src/Mirspay/Payment/LiqPay/Exception/InvalidResponseException.php rename src/{ => Mirspay}/Payment/LiqPay/Exception/InvalidResponseSignatureException.php (84%) rename src/{ => Mirspay}/Payment/LiqPay/Exception/ResponseDecodeException.php (84%) rename src/{ => Mirspay}/Payment/LiqPay/Exception/UnsupportedCurrencyException.php (74%) rename src/{ => Mirspay}/Payment/LiqPay/Gateway.php (76%) rename src/{ => Mirspay}/Payment/LiqPay/Request/AbstractRequest.php (93%) rename src/{ => Mirspay}/Payment/LiqPay/Request/CheckoutRequest.php (92%) rename src/{ => Mirspay}/Payment/LiqPay/Request/MessageEncoder.php (79%) rename src/{ => Mirspay}/Payment/LiqPay/Request/PaymentStatusRequest.php (89%) rename src/{ => Mirspay}/Payment/LiqPay/Response/AbstractResponse.php (63%) rename src/{ => Mirspay}/Payment/LiqPay/Response/CheckoutResponse.php (82%) rename src/{ => Mirspay}/Payment/LiqPay/Response/MessageDecoder.php (91%) rename src/{ => Mirspay}/Payment/LiqPay/Response/PaymentStatusResponse.php (95%) rename src/{ => Mirspay}/Payment/LiqPay/Response/SignedMessage.php (90%) rename src/{ => Mirspay}/Payment/LiqPay/ServerCallbackHandler.php (75%) rename src/{ => Mirspay}/Payment/LiqPay/Signature.php (96%) rename src/{ => Mirspay}/Repository/OrderProductRepository.php (85%) rename src/{ => Mirspay}/Repository/OrderRepository.php (93%) rename src/{ => Mirspay}/Repository/PaymentProcessingRepository.php (91%) rename src/{ => Mirspay}/Repository/SubscriberRepository.php (92%) rename src/{ => Mirspay}/Subscriber/Action/AddHttpSubscriberAction.php (87%) rename src/{ => Mirspay}/Subscriber/Action/AddSubscriberAction.php (85%) rename src/{ => Mirspay}/Subscriber/Action/SendSubscriberNotificationAction.php (60%) rename src/{ => Mirspay}/Subscriber/Channel/AbstractChannelMessage.php (79%) rename src/{ => Mirspay}/Subscriber/Channel/ChannelMessageInterface.php (91%) rename src/{ => Mirspay}/Subscriber/Channel/HttpNotificationChannel.php (89%) rename src/{ => Mirspay}/Subscriber/Channel/NotificationChannelCollection.php (90%) rename src/{ => Mirspay}/Subscriber/Channel/NotificationChannelInterface.php (89%) rename src/{ => Mirspay}/Subscriber/Channel/SimpleArrayChannelMessage.php (90%) rename src/{ => Mirspay}/Subscriber/Exception/ChannelMessageException.php (71%) rename src/{ => Mirspay}/Subscriber/Exception/ChannelMessageNotRegistered.php (85%) rename src/{ => Mirspay}/Subscriber/Exception/NotificationChannelException.php (72%) rename src/{ => Mirspay}/Subscriber/Exception/NotificationChannelNotRegisteredException.php (87%) rename src/{ => Mirspay}/Subscriber/Exception/SubscriberExistsException.php (82%) delete mode 100644 src/Payment/Common/Builder/PurchaseRequestBuilderInterface.php delete mode 100644 src/Payment/LiqPay/Exception/InvalidResponseException.php diff --git a/bin/console b/bin/console index d8d530e..9fec2a9 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env php + diff --git a/public/index.php b/public/index.php index 9982c21..bb7df25 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,6 @@ diff --git a/src/Repository/OrderRepository.php b/src/Mirspay/Repository/OrderRepository.php similarity index 93% rename from src/Repository/OrderRepository.php rename to src/Mirspay/Repository/OrderRepository.php index 67f6ca0..85c95e8 100644 --- a/src/Repository/OrderRepository.php +++ b/src/Mirspay/Repository/OrderRepository.php @@ -1,10 +1,10 @@ diff --git a/src/Repository/PaymentProcessingRepository.php b/src/Mirspay/Repository/PaymentProcessingRepository.php similarity index 91% rename from src/Repository/PaymentProcessingRepository.php rename to src/Mirspay/Repository/PaymentProcessingRepository.php index 4113cc4..9e4e6af 100644 --- a/src/Repository/PaymentProcessingRepository.php +++ b/src/Mirspay/Repository/PaymentProcessingRepository.php @@ -1,10 +1,10 @@ diff --git a/src/Repository/SubscriberRepository.php b/src/Mirspay/Repository/SubscriberRepository.php similarity index 92% rename from src/Repository/SubscriberRepository.php rename to src/Mirspay/Repository/SubscriberRepository.php index 7ed2906..239de05 100644 --- a/src/Repository/SubscriberRepository.php +++ b/src/Mirspay/Repository/SubscriberRepository.php @@ -1,11 +1,11 @@ diff --git a/src/Subscriber/Action/AddHttpSubscriberAction.php b/src/Mirspay/Subscriber/Action/AddHttpSubscriberAction.php similarity index 87% rename from src/Subscriber/Action/AddHttpSubscriberAction.php rename to src/Mirspay/Subscriber/Action/AddHttpSubscriberAction.php index b32cba6..e984637 100644 --- a/src/Subscriber/Action/AddHttpSubscriberAction.php +++ b/src/Mirspay/Subscriber/Action/AddHttpSubscriberAction.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Subscriber\Action; +namespace Mirspay\Subscriber\Action; -use App\Entity\OrderStatus; -use App\Entity\Subscriber; -use App\Subscriber\Channel\HttpNotificationChannel; use InvalidArgumentException; +use Mirspay\Entity\OrderStatus; +use Mirspay\Entity\Subscriber; +use Mirspay\Subscriber\Channel\HttpNotificationChannel; class AddHttpSubscriberAction extends AddSubscriberAction { diff --git a/src/Subscriber/Action/AddSubscriberAction.php b/src/Mirspay/Subscriber/Action/AddSubscriberAction.php similarity index 85% rename from src/Subscriber/Action/AddSubscriberAction.php rename to src/Mirspay/Subscriber/Action/AddSubscriberAction.php index fd14bfa..78c71a4 100644 --- a/src/Subscriber/Action/AddSubscriberAction.php +++ b/src/Mirspay/Subscriber/Action/AddSubscriberAction.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace App\Subscriber\Action; +namespace Mirspay\Subscriber\Action; -use App\Entity\OrderStatus; -use App\Entity\Subscriber; -use App\Repository\SubscriberRepository; -use App\Subscriber\Channel\NotificationChannelCollection; -use App\Subscriber\Exception\ChannelMessageNotRegistered; -use App\Subscriber\Exception\NotificationChannelNotRegisteredException; -use App\Subscriber\Exception\SubscriberExistsException; use Doctrine\ORM\EntityManagerInterface; +use Mirspay\Entity\OrderStatus; +use Mirspay\Entity\Subscriber; +use Mirspay\Repository\SubscriberRepository; +use Mirspay\Subscriber\Channel\NotificationChannelCollection; +use Mirspay\Subscriber\Exception\ChannelMessageNotRegistered; +use Mirspay\Subscriber\Exception\NotificationChannelNotRegisteredException; +use Mirspay\Subscriber\Exception\SubscriberExistsException; class AddSubscriberAction { diff --git a/src/Subscriber/Action/SendSubscriberNotificationAction.php b/src/Mirspay/Subscriber/Action/SendSubscriberNotificationAction.php similarity index 60% rename from src/Subscriber/Action/SendSubscriberNotificationAction.php rename to src/Mirspay/Subscriber/Action/SendSubscriberNotificationAction.php index 35990cd..540455b 100644 --- a/src/Subscriber/Action/SendSubscriberNotificationAction.php +++ b/src/Mirspay/Subscriber/Action/SendSubscriberNotificationAction.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Subscriber\Action; +namespace Mirspay\Subscriber\Action; -use App\Entity\PaymentProcessing; -use App\Entity\Subscriber; -use App\Subscriber\Channel\NotificationChannelCollection; use App\Subscriber\Exception; +use Mirspay\Entity\PaymentProcessing; +use Mirspay\Entity\Subscriber; +use Mirspay\Subscriber\Channel\NotificationChannelCollection; class SendSubscriberNotificationAction { @@ -17,10 +17,10 @@ public function __construct( } /** - * @throws Exception\NotificationChannelNotRegisteredException - * @throws Exception\NotificationChannelException - * @throws Exception\ChannelMessageNotRegistered - * @throws Exception\ChannelMessageException + * @throws \Mirspay\Subscriber\Exception\NotificationChannelNotRegisteredException + * @throws \Mirspay\Subscriber\Exception\NotificationChannelException + * @throws \Mirspay\Subscriber\Exception\ChannelMessageNotRegistered + * @throws \Mirspay\Subscriber\Exception\ChannelMessageException */ public function sendNotification(Subscriber $subscriber, PaymentProcessing $paymentProcessing): void { diff --git a/src/Subscriber/Channel/AbstractChannelMessage.php b/src/Mirspay/Subscriber/Channel/AbstractChannelMessage.php similarity index 79% rename from src/Subscriber/Channel/AbstractChannelMessage.php rename to src/Mirspay/Subscriber/Channel/AbstractChannelMessage.php index 564fa55..da8e52f 100644 --- a/src/Subscriber/Channel/AbstractChannelMessage.php +++ b/src/Mirspay/Subscriber/Channel/AbstractChannelMessage.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Entity\PaymentProcessing; -use App\Subscriber\Exception\ChannelMessageException; +use Mirspay\Entity\PaymentProcessing; +use Mirspay\Subscriber\Exception\ChannelMessageException; abstract class AbstractChannelMessage implements ChannelMessageInterface { diff --git a/src/Subscriber/Channel/ChannelMessageInterface.php b/src/Mirspay/Subscriber/Channel/ChannelMessageInterface.php similarity index 91% rename from src/Subscriber/Channel/ChannelMessageInterface.php rename to src/Mirspay/Subscriber/Channel/ChannelMessageInterface.php index e2705fc..dd4c7a3 100644 --- a/src/Subscriber/Channel/ChannelMessageInterface.php +++ b/src/Mirspay/Subscriber/Channel/ChannelMessageInterface.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Entity\PaymentProcessing; -use App\Subscriber\Exception\ChannelMessageException; +use Mirspay\Entity\PaymentProcessing; +use Mirspay\Subscriber\Exception\ChannelMessageException; /** * Channel data message. diff --git a/src/Subscriber/Channel/HttpNotificationChannel.php b/src/Mirspay/Subscriber/Channel/HttpNotificationChannel.php similarity index 89% rename from src/Subscriber/Channel/HttpNotificationChannel.php rename to src/Mirspay/Subscriber/Channel/HttpNotificationChannel.php index b8436d6..7258b5d 100644 --- a/src/Subscriber/Channel/HttpNotificationChannel.php +++ b/src/Mirspay/Subscriber/Channel/HttpNotificationChannel.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Subscriber\Exception\ChannelMessageException; -use App\Subscriber\Exception\NotificationChannelException; +use Mirspay\Subscriber\Exception\ChannelMessageException; +use Mirspay\Subscriber\Exception\NotificationChannelException; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; diff --git a/src/Subscriber/Channel/NotificationChannelCollection.php b/src/Mirspay/Subscriber/Channel/NotificationChannelCollection.php similarity index 90% rename from src/Subscriber/Channel/NotificationChannelCollection.php rename to src/Mirspay/Subscriber/Channel/NotificationChannelCollection.php index 1de0ba6..43c8132 100644 --- a/src/Subscriber/Channel/NotificationChannelCollection.php +++ b/src/Mirspay/Subscriber/Channel/NotificationChannelCollection.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Subscriber\Exception\ChannelMessageNotRegistered; -use App\Subscriber\Exception\NotificationChannelNotRegisteredException; +use Mirspay\Subscriber\Exception\ChannelMessageNotRegistered; +use Mirspay\Subscriber\Exception\NotificationChannelNotRegisteredException; use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; class NotificationChannelCollection diff --git a/src/Subscriber/Channel/NotificationChannelInterface.php b/src/Mirspay/Subscriber/Channel/NotificationChannelInterface.php similarity index 89% rename from src/Subscriber/Channel/NotificationChannelInterface.php rename to src/Mirspay/Subscriber/Channel/NotificationChannelInterface.php index 185ac10..56eb512 100644 --- a/src/Subscriber/Channel/NotificationChannelInterface.php +++ b/src/Mirspay/Subscriber/Channel/NotificationChannelInterface.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Subscriber\Exception\ChannelMessageException; -use App\Subscriber\Exception\NotificationChannelException; +use Mirspay\Subscriber\Exception\ChannelMessageException; +use Mirspay\Subscriber\Exception\NotificationChannelException; /** * Notification channel. diff --git a/src/Subscriber/Channel/SimpleArrayChannelMessage.php b/src/Mirspay/Subscriber/Channel/SimpleArrayChannelMessage.php similarity index 90% rename from src/Subscriber/Channel/SimpleArrayChannelMessage.php rename to src/Mirspay/Subscriber/Channel/SimpleArrayChannelMessage.php index 1601c4d..33d1d70 100644 --- a/src/Subscriber/Channel/SimpleArrayChannelMessage.php +++ b/src/Mirspay/Subscriber/Channel/SimpleArrayChannelMessage.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Subscriber\Channel; +namespace Mirspay\Subscriber\Channel; -use App\Subscriber\Exception\ChannelMessageException; +use Mirspay\Subscriber\Exception\ChannelMessageException; final class SimpleArrayChannelMessage extends AbstractChannelMessage { diff --git a/src/Subscriber/Exception/ChannelMessageException.php b/src/Mirspay/Subscriber/Exception/ChannelMessageException.php similarity index 71% rename from src/Subscriber/Exception/ChannelMessageException.php rename to src/Mirspay/Subscriber/Exception/ChannelMessageException.php index e43f8b0..62542e7 100644 --- a/src/Subscriber/Exception/ChannelMessageException.php +++ b/src/Mirspay/Subscriber/Exception/ChannelMessageException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Subscriber\Exception; +namespace Mirspay\Subscriber\Exception; use Exception; diff --git a/src/Subscriber/Exception/ChannelMessageNotRegistered.php b/src/Mirspay/Subscriber/Exception/ChannelMessageNotRegistered.php similarity index 85% rename from src/Subscriber/Exception/ChannelMessageNotRegistered.php rename to src/Mirspay/Subscriber/Exception/ChannelMessageNotRegistered.php index 43b638b..d66098c 100644 --- a/src/Subscriber/Exception/ChannelMessageNotRegistered.php +++ b/src/Mirspay/Subscriber/Exception/ChannelMessageNotRegistered.php @@ -2,9 +2,7 @@ declare(strict_types=1); -namespace App\Subscriber\Exception; - -use Exception; +namespace Mirspay\Subscriber\Exception; final class ChannelMessageNotRegistered extends ChannelMessageException { diff --git a/src/Subscriber/Exception/NotificationChannelException.php b/src/Mirspay/Subscriber/Exception/NotificationChannelException.php similarity index 72% rename from src/Subscriber/Exception/NotificationChannelException.php rename to src/Mirspay/Subscriber/Exception/NotificationChannelException.php index 4f58466..7a0474c 100644 --- a/src/Subscriber/Exception/NotificationChannelException.php +++ b/src/Mirspay/Subscriber/Exception/NotificationChannelException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Subscriber\Exception; +namespace Mirspay\Subscriber\Exception; use Exception; diff --git a/src/Subscriber/Exception/NotificationChannelNotRegisteredException.php b/src/Mirspay/Subscriber/Exception/NotificationChannelNotRegisteredException.php similarity index 87% rename from src/Subscriber/Exception/NotificationChannelNotRegisteredException.php rename to src/Mirspay/Subscriber/Exception/NotificationChannelNotRegisteredException.php index b13f33d..d7ca4ce 100644 --- a/src/Subscriber/Exception/NotificationChannelNotRegisteredException.php +++ b/src/Mirspay/Subscriber/Exception/NotificationChannelNotRegisteredException.php @@ -2,9 +2,7 @@ declare(strict_types=1); -namespace App\Subscriber\Exception; - -use Exception; +namespace Mirspay\Subscriber\Exception; final class NotificationChannelNotRegisteredException extends NotificationChannelException { diff --git a/src/Subscriber/Exception/SubscriberExistsException.php b/src/Mirspay/Subscriber/Exception/SubscriberExistsException.php similarity index 82% rename from src/Subscriber/Exception/SubscriberExistsException.php rename to src/Mirspay/Subscriber/Exception/SubscriberExistsException.php index 364d96c..c3f2767 100644 --- a/src/Subscriber/Exception/SubscriberExistsException.php +++ b/src/Mirspay/Subscriber/Exception/SubscriberExistsException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Subscriber\Exception; +namespace Mirspay\Subscriber\Exception; use Exception; diff --git a/src/Payment/Common/Builder/PurchaseRequestBuilderInterface.php b/src/Payment/Common/Builder/PurchaseRequestBuilderInterface.php deleted file mode 100644 index 222365c..0000000 --- a/src/Payment/Common/Builder/PurchaseRequestBuilderInterface.php +++ /dev/null @@ -1,11 +0,0 @@ - Date: Mon, 9 Sep 2024 19:12:59 +0300 Subject: [PATCH 2/5] #5 gitignore --- src/{Entity => Mirspay/Controller}/.gitignore | 0 src/{Repository => Mirspay/Entity}/.gitignore | 0 src/Mirspay/Repository/.gitignore | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/{Entity => Mirspay/Controller}/.gitignore (100%) rename src/{Repository => Mirspay/Entity}/.gitignore (100%) create mode 100644 src/Mirspay/Repository/.gitignore diff --git a/src/Entity/.gitignore b/src/Mirspay/Controller/.gitignore similarity index 100% rename from src/Entity/.gitignore rename to src/Mirspay/Controller/.gitignore diff --git a/src/Repository/.gitignore b/src/Mirspay/Entity/.gitignore similarity index 100% rename from src/Repository/.gitignore rename to src/Mirspay/Entity/.gitignore diff --git a/src/Mirspay/Repository/.gitignore b/src/Mirspay/Repository/.gitignore new file mode 100644 index 0000000..e69de29 From 4c936b54ed3ddda85945be808e16e401eb604833 Mon Sep 17 00:00:00 2001 From: Oleksii Skorobogatko Date: Tue, 10 Sep 2024 10:07:32 +0300 Subject: [PATCH 3/5] #5 fix namespace after merging master --- tests/Unit/Dto/PaymentStatusDtoTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Unit/Dto/PaymentStatusDtoTest.php b/tests/Unit/Dto/PaymentStatusDtoTest.php index 067f340..dd685e5 100644 --- a/tests/Unit/Dto/PaymentStatusDtoTest.php +++ b/tests/Unit/Dto/PaymentStatusDtoTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Tests\Unit\Dto; +namespace Mirspay\Tests\Unit\Dto; -use App\Dto\PaymentStatusDto; -use App\Payment\Common\Message\ResponseInterface; +use Mirspay\Dto\PaymentStatusDto; +use Mirspay\Payment\Common\Message\ResponseInterface; use PHPUnit\Framework\TestCase; final class PaymentStatusDtoTest extends TestCase From 961debc50d163b448fc019086188f80b6332d09f Mon Sep 17 00:00:00 2001 From: Oleksii Skorobogatko Date: Sat, 28 Sep 2024 12:49:02 +0300 Subject: [PATCH 4/5] #5 add docker trusted proxy --- config/packages/framework.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 3d0ca71..9b85abf 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -18,8 +18,8 @@ framework: php_errors: log: true - # expose.dev - trusted_proxies: '127.0.0.1' + # expose.dev (local and docker) + trusted_proxies: '127.0.0.0/8,172.16.0.0/12' trusted_headers: [ 'x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix' ] when@test: From c7460893e23dc88e332e2540c3bade31a3758ef0 Mon Sep 17 00:00:00 2001 From: Oleksii Skorobogatko Date: Sat, 28 Sep 2024 12:49:23 +0300 Subject: [PATCH 5/5] #5 note how to debug payment callbacks --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index eac19f2..406f75f 100644 --- a/README.md +++ b/README.md @@ -106,3 +106,37 @@ The request will contain json data like this: } } ``` + +## How to debug payment gateway callbacks + +In order to debug payment gateway callback responses, [expose](https://expose.dev/) tool can be used to create a tunnel +to your local development environment. +If you use docker, start `expose` with the following command: +```shell +expose share http://localhost +``` + +You will see external _Public HTTP_ and _Public HTTPS_ urls in output. +Use one of those urls and send Create Order request like this: +``` +curl --location 'https://okdfskdfj126722jsnxz.sharedwithexpose.com/api/v1/order' \ +--header 'Content-Type: application/json' \ +--data '{ + "order_num": "00001", + "payment_gateway": "liqpay", + "description": "Order #001", + "return_url": "https://super-site.com/thank-you", + "products": [ + { + "sku": "A01001", + "price": 1900, + "qty": 1, + "name": "Beer" + } + ] +}' +``` +Make sure `status_check` in the response has an external url, +that means your host is shared and the payment gateway will send a callback via the external url. + +If you still have localhost, check `trusted_proxies` settings in `config/packages/framework.yaml`.