Skip to content

Commit 15aade0

Browse files
authored
[ECP-9911] Append Magento edition to externalPlatform.name in applicationInfo (#3259)
* [ECP-9911] Merge Magento edition into externalPlatform name in applicationInfo * Fix unit tests
1 parent c580d67 commit 15aade0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Helper/Data.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ public function initializeAdyenClient(
461461
$hasPlatformIntegrator = $this->configHelper->getHasPlatformIntegrator();
462462
$platformIntegratorName = $this->configHelper->getPlatformIntegratorName();
463463
$platformIntegrator = ($hasPlatformIntegrator && $platformIntegratorName) ? $platformIntegratorName : '';
464-
$client->setExternalPlatform($platformData['name'], $platformData['version'], $platformIntegrator);
464+
$platformName = $platformData['name'] . ' ' . $platformData['edition'];
465+
$client->setExternalPlatform($platformName, $platformData['version'], $platformIntegrator);
465466

466467
if ($isDemo) {
467468
$client->setEnvironment(Environment::TEST);

Helper/PointOfSale.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function addSaleToAcquirerData(array $request, Order $order) : array
7070
$saleToAcquirerData[ApplicationInfo::APPLICATION_INFO][ApplicationInfo::EXTERNAL_PLATFORM]
7171
[ApplicationInfo::VERSION] = $this->productMetadata->getVersion();
7272
$saleToAcquirerData[ApplicationInfo::APPLICATION_INFO][ApplicationInfo::EXTERNAL_PLATFORM]
73-
[ApplicationInfo::NAME] = $this->productMetadata->getName();
73+
[ApplicationInfo::NAME] = $this->productMetadata->getName() . ' ' . $this->productMetadata->getEdition();
7474
$saleToAcquirerDataBase64 = base64_encode(json_encode($saleToAcquirerData));
7575
$request['SaleToPOIRequest']['PaymentRequest']['SaleData']['SaleToAcquirerData'] = $saleToAcquirerDataBase64;
7676

Test/Unit/Helper/DataTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function testInitializeAdyenClientInDemoMode(): void
225225

226226
$this->platformInfo
227227
->method('getMagentoDetails')
228-
->willReturn(['name' => 'Magento', 'version' => '2.4.6']);
228+
->willReturn(['name' => 'Magento', 'version' => '2.4.6', 'edition' => 'Community']);
229229

230230
$this->scopeConfig
231231
->method('getValue')
@@ -607,7 +607,7 @@ public function testInitializeAdyenClientWithClientConfigMoto(): void
607607
->willReturn('9.0.0');
608608
$this->platformInfo
609609
->method('getMagentoDetails')
610-
->willReturn(['name' => 'Magento', 'version' => '2.4.6']);
610+
->willReturn(['name' => 'Magento', 'version' => '2.4.6', 'edition' => 'Community']);
611611

612612
$this->scopeConfig
613613
->method('getValue')
@@ -828,7 +828,7 @@ public function testInitializeAdyenClientInLiveMode(): void
828828

829829
$this->platformInfo->method('getModuleName')->willReturn('Adyen_Payment');
830830
$this->platformInfo->method('getModuleVersion')->willReturn('9.0.0');
831-
$this->platformInfo->method('getMagentoDetails')->willReturn(['name' => 'Magento', 'version' => '2.4.6']);
831+
$this->platformInfo->method('getMagentoDetails')->willReturn(['name' => 'Magento', 'version' => '2.4.6', 'edition' => 'Community']);
832832
$this->scopeConfig->method('getValue')->willReturn(null);
833833

834834
$this->configHelper->method('getLiveEndpointPrefix')->with($storeId)->willReturn($livePrefix);
@@ -853,7 +853,7 @@ public function testInitializeAdyenClientWithClientConfigNonMoto(): void
853853

854854
$this->platformInfo->method('getModuleName')->willReturn('Adyen_Payment');
855855
$this->platformInfo->method('getModuleVersion')->willReturn('9.0.0');
856-
$this->platformInfo->method('getMagentoDetails')->willReturn(['name' => 'Magento', 'version' => '2.4.6']);
856+
$this->platformInfo->method('getMagentoDetails')->willReturn(['name' => 'Magento', 'version' => '2.4.6', 'edition' => 'Community']);
857857
$this->scopeConfig->method('getValue')->willReturn(null);
858858

859859
$client = $this->dataHelper->initializeAdyenClientWithClientConfig([

0 commit comments

Comments
 (0)