diff --git a/.github/codeql-config.yml b/.github/codeql-config.yml new file mode 100644 index 0000000000..abb6ff1557 --- /dev/null +++ b/.github/codeql-config.yml @@ -0,0 +1,2 @@ +paths-ignore: + - 'view/base/web/js' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f064369e94..e0cf74b785 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,8 +2,7 @@ name: "CodeQL" on: pull_request: - paths-ignore: - - 'view/base/web/js/**' + workflow_dispatch: jobs: analyze: @@ -24,15 +23,13 @@ jobs: uses: actions/checkout@v3 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: +security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + config-file: ./.github/codeql-config.yml - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{ matrix.language }}" diff --git a/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php b/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php index 16de30dd46..400f9a8202 100644 --- a/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php +++ b/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php @@ -40,9 +40,9 @@ public function __construct( } /** - * @return $this|ApplePayDomainAssociationFileButton + * @return ApplePayDomainAssociationFileButton */ - protected function _prepareLayout(): ApplePayDomainAssociationFileButton|static + protected function _prepareLayout(): ApplePayDomainAssociationFileButton { parent::_prepareLayout(); diff --git a/Model/Ui/AdyenCcConfigProvider.php b/Model/Ui/AdyenCcConfigProvider.php index f8722f0e9a..220ad3205c 100755 --- a/Model/Ui/AdyenCcConfigProvider.php +++ b/Model/Ui/AdyenCcConfigProvider.php @@ -16,6 +16,7 @@ use Adyen\Payment\Helper\PaymentMethods; use Adyen\Payment\Helper\Vault; use Magento\Checkout\Model\ConfigProviderInterface; +use Magento\Framework\App\Request\Http; use Magento\Framework\App\RequestInterface; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\UrlInterface; @@ -38,6 +39,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface private Config $configHelper; private PaymentMethods $paymentMethodsHelper; private Vault $vaultHelper; + private Http $httpRequest; public function __construct( Data $adyenHelper, @@ -49,7 +51,8 @@ public function __construct( SerializerInterface $serializer, Config $configHelper, PaymentMethods $paymentMethodsHelper, - Vault $vaultHelper + Vault $vaultHelper, + Http $httpRequest ) { $this->adyenHelper = $adyenHelper; $this->request = $request; @@ -61,6 +64,7 @@ public function __construct( $this->configHelper = $configHelper; $this->paymentMethodsHelper = $paymentMethodsHelper; $this->vaultHelper = $vaultHelper; + $this->httpRequest = $httpRequest; } public function getConfig(): array @@ -111,6 +115,7 @@ public function getConfig(): array $config['payment']['adyenCc']['isCardRecurringEnabled'] = $cardRecurringEnabled; $config['payment']['adyenCc']['icons'] = $this->getIcons(); $config['payment']['adyenCc']['isClickToPayEnabled'] = $this->configHelper->isClickToPayEnabled($storeId); + $config['payment']['adyenCc']['controllerName'] = $this->httpRequest->getControllerName(); // has installments by default false $config['payment']['adyenCc']['hasInstallments'] = false; diff --git a/Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php b/Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php index 96c9bfb9e6..9be8ad0253 100644 --- a/Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php +++ b/Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php @@ -17,6 +17,7 @@ use Adyen\Payment\Helper\Vault; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\Request\Http; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\UrlInterface; use Magento\Framework\View\Asset\File; @@ -47,6 +48,7 @@ protected function setUp(): void { $this->adyenHelperMock = $this->createMock(Data::class); $this->requestMock = $this->createMock(RequestInterface::class); + $this->requestHttpMock = $this->createMock(Http::class); $this->urlBuilderMock = $this->createMock(UrlInterface::class); $this->assetSourceMock = $this->createMock(Source::class); $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); @@ -66,7 +68,8 @@ protected function setUp(): void $this->serializerMock, $this->configHelperMock, $this->paymentMethodsHelperMock, - $this->vaultHelperMock + $this->vaultHelperMock, + $this->requestHttpMock, ); } @@ -90,6 +93,7 @@ public function testGetConfig($enableInstallments) $store = $this->createMock(StoreInterface::class); $store->method('getId')->willReturn($storeId); $this->storeManagerMock->method('getStore')->willReturn($store); + $controllerName = 'index'; $this->configHelperMock->method('getAdyenCcConfigData') ->willReturnMap([ @@ -121,10 +125,19 @@ public function testGetConfig($enableInstallments) $this->ccConfigMock->expects($this->once()) ->method('getCvvImageUrl'); + $this->requestHttpMock->expects( + $this->once() + )->method( + 'getControllerName' + )->willReturn( + $controllerName + ); + $configObject = $this->adyenCcConfigProvider->getConfig(); $this->assertArrayHasKey('installments', $configObject['payment']['adyenCc']); $this->assertArrayHasKey('isClickToPayEnabled', $configObject['payment']['adyenCc']); + $this->assertArrayHasKey('controllerName', $configObject['payment']['adyenCc']); $this->assertArrayHasKey('icons', $configObject['payment']['adyenCc']); $this->assertArrayHasKey('isCardRecurringEnabled', $configObject['payment']['adyenCc']); $this->assertArrayHasKey('locale', $configObject['payment']['adyenCc']); diff --git a/VERSION b/VERSION index 7961dfd420..ac72f7619e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.14.0 +9.14.1 diff --git a/composer.json b/composer.json index 95aeb601a9..71625cc86b 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "adyen/module-payment", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "type": "magento2-module", - "version": "9.14.0", + "version": "9.14.1", "license": "MIT", "repositories": [ { @@ -18,7 +18,7 @@ "magento/module-vault": ">=101.2.4", "magento/module-multishipping": ">=100.4.4", "magento/module-graph-ql": ">=100.4.4", - "magento/module-instant-purchase": ">=100.4.4", + "magento/module-instant-purchase": ">=100.4.3", "ext-json": "*" }, "require-dev": { diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js index 6986f4f42f..ef864daa10 100755 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js @@ -107,7 +107,7 @@ define( // Check the paymentMethods response to enable Credit Card payments if (!!paymentMethodsResponse && - !paymentMethodsResponse.paymentMethodsResponse.paymentMethods.find(self.isSchemePaymentsEnabled)) { + !paymentMethodsResponse.paymentMethodsResponse?.paymentMethods.find(self.isSchemePaymentsEnabled)) { return; } @@ -533,10 +533,7 @@ define( return true; }, getControllerName: function() { - return window.checkoutConfig.payment.iframe.controllerName[this.getCode()]; - }, - getPlaceOrderUrl: function() { - return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()]; + return window.checkoutConfig.payment.adyenCc.controllerName; }, grandTotal: function () { for (const totalsegment of quote.getTotals()()['total_segments']) { diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-giftcard-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-giftcard-method.js index a5a9bf19ca..415e58e968 100644 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-giftcard-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-giftcard-method.js @@ -95,7 +95,7 @@ define( fullScreenLoader.startLoader(); let giftcards = []; - let paymentMethods = paymentMethodsResponse.paymentMethodsResponse.paymentMethods; + let paymentMethods = paymentMethodsResponse.paymentMethodsResponse?.paymentMethods; if (!!paymentMethods && paymentMethods.length > 0) { giftcards.push({ diff --git a/view/frontend/web/template/payment/cc-form.html b/view/frontend/web/template/payment/cc-form.html index a0df9a907b..07def5352f 100755 --- a/view/frontend/web/template/payment/cc-form.html +++ b/view/frontend/web/template/payment/cc-form.html @@ -43,20 +43,16 @@ -