diff --git a/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php index 76f78902..9b0ea182 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php @@ -5,10 +5,11 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\AkbankPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\AkbankPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\AkbankPosResponseValueMapper; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\AkbankPos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -31,13 +32,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new AkbankPosRequestValueMapper(); - $responseValueFormatter = new BasicResponseValueFormatter(); - $responseValueMapper = new AkbankPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(AkbankPos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(AkbankPos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(AkbankPos::class); $this->responseDataMapper = new AkbankPosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php index 8fa1a57c..4e6bfe1b 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\EstPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\EstPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\EstPosResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\EstPosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\EstV3Pos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new EstPosRequestValueMapper(); - $responseValueFormatter = new EstPosResponseValueFormatter(); - $responseValueMapper = new EstPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(EstV3Pos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(EstV3Pos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(EstV3Pos::class); $this->responseDataMapper = new EstPosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php index c97775f7..3d5d8ae0 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\GarantiPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\GarantiPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\GarantiPosResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\GarantiPosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\GarantiPos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new GarantiPosRequestValueMapper(); - $responseValueFormatter = new GarantiPosResponseValueFormatter(); - $responseValueMapper = new GarantiPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(GarantiPos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(GarantiPos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(GarantiPos::class); $this->responseDataMapper = new GarantiPosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php index c49e0370..b56911ee 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\InterPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\InterPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\InterPosResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\InterPosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\InterPos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new InterPosRequestValueMapper(); - $responseValueFormatter = new InterPosResponseValueFormatter(); - $responseValueMapper = new InterPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(InterPos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(InterPos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(InterPos::class); $this->responseDataMapper = new InterPosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexCPV4PosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexCPV4PosResponseDataMapperTest.php index 9dd70f83..a37eedf1 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexCPV4PosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexCPV4PosResponseDataMapperTest.php @@ -6,10 +6,11 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; use Generator; -use Mews\Pos\DataMapper\RequestValueMapper\PayFlexCPV4PosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\PayFlexCPV4PosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\PayFlexCPV4PosResponseValueMapper; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\PayFlexCPV4Pos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,10 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new PayFlexCPV4PosRequestValueMapper(); - $responseValueFormatter = new BasicResponseValueFormatter(); - $responseValueMapper = new PayFlexCPV4PosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(PayFlexCPV4Pos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(PayFlexCPV4Pos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayFlexCPV4Pos::class); + $this->responseDataMapper = new PayFlexCPV4PosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php index 15083d73..4b77cdf3 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\PayFlexV4PosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\PayFlexV4PosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\PayFlexV4PosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\PayFlexV4Pos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new PayFlexV4PosRequestValueMapper(); - $responseValueFormatter = new BasicResponseValueFormatter(); - $responseValueMapper = new PayFlexV4PosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(PayFlexV4Pos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(PayFlexV4Pos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayFlexV4Pos::class); $this->responseDataMapper = new PayFlexV4PosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php index 3a5d5119..bf3c7726 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php @@ -5,10 +5,11 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\PayForPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\PayForPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\PayForPosResponseValueMapper; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\PayForPos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -30,13 +31,9 @@ protected function setUp(): void parent::setUp(); $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new PayForPosRequestValueMapper(); - $responseValueFormatter = new BasicResponseValueFormatter(); - $responseValueMapper = new PayForPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(PayForPos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(PayForPos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayForPos::class); $this->responseDataMapper = new PayForPosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php index 7dcd22b3..08e71496 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\PosNetRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\PosNetResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\PosNetResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\PosNetResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\PosNet; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -31,13 +32,9 @@ protected function setUp(): void parent::setUp(); $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new PosNetRequestValueMapper(); - $responseValueFormatter = new PosNetResponseValueFormatter(); - $responseValueMapper = new PosNetResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(PosNet::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(PosNet::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PosNet::class); $this->responseDataMapper = new PosNetResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php index a3e01689..28ffadef 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\PosNetV1PosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\PosNetV1PosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\PosNetResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\PosNetV1PosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\PosNetV1Pos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -33,13 +34,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new PosNetV1PosRequestValueMapper(); - $responseValueFormatter = new PosNetResponseValueFormatter(); - $responseValueMapper = new PosNetV1PosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(PosNetV1Pos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(PosNetV1Pos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PosNetV1Pos::class); $this->responseDataMapper = new PosNetV1PosResponseDataMapper( $responseValueFormatter, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/ToslaPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/ToslaPosResponseDataMapperTest.php index 7e14812d..d0e10ed7 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/ToslaPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/ToslaPosResponseDataMapperTest.php @@ -5,11 +5,12 @@ namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper; -use Mews\Pos\DataMapper\RequestValueMapper\ToslaPosRequestValueMapper; use Mews\Pos\DataMapper\ResponseDataMapper\ToslaPosResponseDataMapper; -use Mews\Pos\DataMapper\ResponseValueFormatter\ToslaPosResponseValueFormatter; -use Mews\Pos\DataMapper\ResponseValueMapper\ToslaPosResponseValueMapper; use Mews\Pos\Exceptions\NotImplementedException; +use Mews\Pos\Factory\RequestValueMapperFactory; +use Mews\Pos\Factory\ResponseValueFormatterFactory; +use Mews\Pos\Factory\ResponseValueMapperFactory; +use Mews\Pos\Gateways\ToslaPos; use Mews\Pos\PosInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -32,13 +33,9 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); - $requestValueMapper = new ToslaPosRequestValueMapper(); - $responseValueFormatter = new ToslaPosResponseValueFormatter(); - $responseValueMapper = new ToslaPosResponseValueMapper( - $requestValueMapper->getCurrencyMappings(), - $requestValueMapper->getTxTypeMappings(), - $requestValueMapper->getSecureTypeMappings() - ); + $requestValueMapper = RequestValueMapperFactory::createForGateway(ToslaPos::class); + $responseValueMapper = ResponseValueMapperFactory::createForGateway(ToslaPos::class, $requestValueMapper); + $responseValueFormatter = ResponseValueFormatterFactory::createForGateway(ToslaPos::class); $this->responseDataMapper = new ToslaPosResponseDataMapper( $responseValueFormatter,