diff --git a/composer.json b/composer.json index 4ff7c68a..8d8779df 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "firebase/php-jwt": "^6.10", "payum/core": "^1.7", "sylius/core-bundle": "^1.12", + "sylius/refund-plugin": "^1.5", "sylius/resource-bundle": "^1.10", "symfony/config": "5.4.* || ^6.0", "symfony/dependency-injection": "5.4.* || ^6.0", @@ -28,7 +29,7 @@ "symfony/http-foundation": "5.4.* || ^6.0", "symfony/http-kernel": "5.4.* || ^6.0", "symfony/routing": "5.4.* || ^6.0", - "symfony/uid": "5.4.*", + "symfony/uid": "5.4.* || ^6.0", "tpay-com/tpay-openapi-php": "^1.8" }, "conflict": { @@ -50,7 +51,6 @@ "polishsymfonycommunity/symfony-mocker-container": "^1.0", "shipmonk/composer-dependency-analyser": "^1.7", "sylius-labs/coding-standard": "^4.2", - "sylius/refund-plugin": "^1.5", "sylius/sylius": "^1.12", "symfony/browser-kit": "^5.4 || ^6.0", "symfony/debug-bundle": "^5.4 || ^6.0", diff --git a/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php b/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php index fd3dc611..ea1a7da1 100644 --- a/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php +++ b/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php @@ -11,6 +11,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Tpay\OpenApi\Utilities\Logger; final class CommerceWeaversSyliusTpayExtension extends AbstractResourceExtension implements PrependExtensionInterface { @@ -43,6 +44,7 @@ public function prepend(ContainerBuilder $container): void $container, ); + $this->setUpTpayLogger($container); $this->prependDoctrineMigrations($container); $this->prependDoctrineMapping($container); } @@ -105,4 +107,19 @@ private function getCurrentConfiguration(ContainerBuilder $container): array return $this->processConfiguration($configuration, $configs); } + + private function setUpTpayLogger(ContainerBuilder $container): void + { + if (!$container->hasParameter('kernel.logs_dir')) { + return; + } + + $logsDir = $container->getParameter('kernel.logs_dir'); + + if (!is_string($logsDir)) { + return; + } + + Logger::setLogPath(sprintf('%s/tpay_open_api_', $logsDir)); + } } diff --git a/src/Payum/Action/Api/BaseApiAwareAction.php b/src/Payum/Action/Api/BaseApiAwareAction.php index 5d54aa3e..b77fe6b8 100644 --- a/src/Payum/Action/Api/BaseApiAwareAction.php +++ b/src/Payum/Action/Api/BaseApiAwareAction.php @@ -8,7 +8,6 @@ use Payum\Core\Action\ActionInterface; use Payum\Core\ApiAwareInterface; use Payum\Core\ApiAwareTrait; -use Tpay\OpenApi\Utilities\Logger; use Tpay\OpenApi\Utilities\TpayException; /** @@ -21,7 +20,6 @@ abstract class BaseApiAwareAction implements ActionInterface, ApiAwareInterface public function __construct() { $this->apiClass = TpayApi::class; - Logger::setLogPath(dirname(__DIR__, 4) . '/tests/Application/var/log/'); } protected function do(callable $func, callable $onSuccess, callable $onFailure): void diff --git a/src/Repository/FindByChannelWithGatewayConfigTraitInterface.php b/src/Repository/FindByChannelWithGatewayConfigTraitInterface.php deleted file mode 100644 index 7ca1f239..00000000 --- a/src/Repository/FindByChannelWithGatewayConfigTraitInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -