diff --git a/README.md b/README.md index 1e0a521..9cb383a 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`. 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 @@ -