diff --git a/Gateway/Request/Header/ExternalPlatformHeaderDataBuilder.php b/Gateway/Request/Header/ExternalPlatformHeaderDataBuilder.php index d7ce3f0b2..0cf03c0f7 100644 --- a/Gateway/Request/Header/ExternalPlatformHeaderDataBuilder.php +++ b/Gateway/Request/Header/ExternalPlatformHeaderDataBuilder.php @@ -51,18 +51,9 @@ public function build(array $buildSubject): array return ['headers' => $headers]; } - public function getMagentoDetails(): array - { - return [ - 'name' => $this->productMetadata->getName(), - 'version' => $this->productMetadata->getVersion(), - 'edition' => $this->productMetadata->getEdition(), - ]; - } - public function buildRequestHeaders($payment = null): array { - $magentoDetails = $this->getMagentoDetails(); + $magentoDetails = $this->adyenHelper->getMagentoDetails(); $headers = [ ExternalPlatformHeaderDataBuilderInterface::EXTERNAL_PLATFORM_NAME => $magentoDetails['name'], ExternalPlatformHeaderDataBuilderInterface::EXTERNAL_PLATFORM_VERSION => $magentoDetails['version'], diff --git a/Helper/Data.php b/Helper/Data.php index 5c6924464..63775c526 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -1159,6 +1159,15 @@ public function initializeAdyenClient( return $client; } + public function getMagentoDetails(): array + { + return [ + 'name' => $this->productMetadata->getName(), + 'version' => $this->productMetadata->getVersion(), + 'edition' => $this->productMetadata->getEdition(), + ]; + } + public function buildApplicationInfo(Client $client) :ApplicationInfo { $applicationInfo = new ApplicationInfo(); diff --git a/Test/Unit/Gateway/Request/HeaderDataBuilderTest.php b/Test/Unit/Gateway/Request/ExternalPlatformHeaderDataBuilderTest.php similarity index 90% rename from Test/Unit/Gateway/Request/HeaderDataBuilderTest.php rename to Test/Unit/Gateway/Request/ExternalPlatformHeaderDataBuilderTest.php index 7c15e659a..df24bda52 100644 --- a/Test/Unit/Gateway/Request/HeaderDataBuilderTest.php +++ b/Test/Unit/Gateway/Request/ExternalPlatformHeaderDataBuilderTest.php @@ -2,6 +2,7 @@ namespace Adyen\Payment\Test\Unit\Gateway\Request; +use Adyen\Payment\Gateway\Request\Header\ExternalPlatformHeaderDataBuilder; use Adyen\Payment\Gateway\Request\HeaderDataBuilder; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Adyen\Payment\Helper\Data; @@ -14,7 +15,7 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -class HeaderDataBuilderTest extends AbstractAdyenTestCase +class ExternalPlatformHeaderDataBuilderTest extends AbstractAdyenTestCase { /** * @var HeaderDataBuilder @@ -35,7 +36,7 @@ protected function setUp(): void ->getMock(); $this->headerDataBuilder = $objectManager->getObject( - HeaderDataBuilder::class, + ExternalPlatformHeaderDataBuilder::class, [ 'adyenHelper' => $this->adyenHelperMock ]