diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4d4d1c6d..33a67474 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @Adyen/plugin-developers +* @brankologeecom @MarijaIv @tamaralogeecom @AleksandarBoljanovic @goran-stamenkovski-logeecom @teodoratimoti @DamjanLogeecom diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..63ca9d6c --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,95 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "develop", "develop*", "main*" ] + pull_request: + branches: [ "develop", "develop*", "main*" ] + paths-ignore: + - 'src/Resources/public/js/**' + schedule: + - cron: '16 17 * * 2' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/upload-release-asset.yml b/.github/workflows/upload-release-asset.yml index 22c45144..b2111bd8 100644 --- a/.github/workflows/upload-release-asset.yml +++ b/.github/workflows/upload-release-asset.yml @@ -12,6 +12,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2+' + - name: Prepare release artifact run: .github/workflows/scripts/prepare-release-asset.sh diff --git a/composer.json b/composer.json index b0a45663..64df2db8 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ } ], "description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen", - "version": "4.1.1", + "version": "4.1.2", "type": "shopware-platform-plugin", "license": "MIT", "require": { diff --git a/src/Handlers/AbstractPaymentMethodHandler.php b/src/Handlers/AbstractPaymentMethodHandler.php index d5f78b5c..ce295919 100644 --- a/src/Handlers/AbstractPaymentMethodHandler.php +++ b/src/Handlers/AbstractPaymentMethodHandler.php @@ -613,12 +613,13 @@ protected function preparePaymentsRequest( !is_null($orderLine->getProductId()) ? $this->getProduct($orderLine->getProductId(), $salesChannelContext->getContext()) : null; + $domainUrl = $salesChannelContext->getSalesChannel()->getDomains()?->first()?->getUrl(); // Add url for only real product and not for the custom cart items. - if (!is_null($product->getId())) { + if (!is_null($product->getId()) && !is_null($domainUrl)) { $productUrl = sprintf( "%s/detail/%s", - $salesChannelContext->getSalesChannel()->getDomains()->first()->getUrl(), + $domainUrl, $product->getId() ); } else { @@ -640,7 +641,7 @@ protected function preparePaymentsRequest( $currency = $salesChannelContext->getCurrency(); //Building open invoice line - + $lineItem = new LineItem(); $lineItem->setDescription($productName); diff --git a/src/Migration/Migration1626331358AdyenRefund.php b/src/Migration/Migration1626331358AdyenRefund.php index df7337bc..211a6954 100644 --- a/src/Migration/Migration1626331358AdyenRefund.php +++ b/src/Migration/Migration1626331358AdyenRefund.php @@ -24,9 +24,7 @@ public function update(Connection $connection): void `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, `amount` INT(11) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk.adyen_refund.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL ); diff --git a/src/Migration/Migration1646742586AdyenPaymentCapture.php b/src/Migration/Migration1646742586AdyenPaymentCapture.php index 89a1cf0a..4e90bf0a 100644 --- a/src/Migration/Migration1646742586AdyenPaymentCapture.php +++ b/src/Migration/Migration1646742586AdyenPaymentCapture.php @@ -24,9 +24,7 @@ public function update(Connection $connection): void `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, `amount` INT(11) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk.adyen_payment_capture.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL ); diff --git a/src/Migration/Migration1669129247AdyenPayment.php b/src/Migration/Migration1669129247AdyenPayment.php index 785d48f3..0bf026d5 100644 --- a/src/Migration/Migration1669129247AdyenPayment.php +++ b/src/Migration/Migration1669129247AdyenPayment.php @@ -31,9 +31,7 @@ public function update(Connection $connection): void `updated_at` DATETIME(3) DEFAULT NULL COMMENT 'Updated at', PRIMARY KEY (`id`), KEY `ADYEN_PAYMENT_MERCHANT_REFERENCE` (`merchant_reference`), - KEY `ADYEN_PAYMENT_MERCHANT_ORDER_REFERENCE` (`merchant_order_reference`), - CONSTRAINT `fk.adyen_payment.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + KEY `ADYEN_PAYMENT_MERCHANT_ORDER_REFERENCE` (`merchant_order_reference`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL; diff --git a/src/Migration/Migration1727273181AlterAdyenRefund.php b/src/Migration/Migration1727273181AlterAdyenRefund.php new file mode 100755 index 00000000..c7a4d6c2 --- /dev/null +++ b/src/Migration/Migration1727273181AlterAdyenRefund.php @@ -0,0 +1,27 @@ +executeStatement(<<executeStatement(<<executeStatement(<<orderRepository->getOrderByOrderNumber( $orderNumber, $context, - ['transactions', 'currency', 'lineItems', 'deliveries', 'deliveries.shippingMethod'] + [ + 'transactions', 'currency', 'lineItems', 'deliveries', + 'deliveries.shippingMethod', 'deliveries.stateMachineState' + ] ); if (is_null($order)) {