Skip to content

Commit

Permalink
Merge pull request #558 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 4.1.2
  • Loading branch information
peterojo authored Sep 30, 2024
2 parents 14cd95b + 5aecbf9 commit cb4ef53
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Adyen/plugin-developers
* @brankologeecom @MarijaIv @tamaralogeecom @AleksandarBoljanovic @goran-stamenkovski-logeecom @teodoratimoti @DamjanLogeecom
95 changes: 95 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -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}}"
5 changes: 5 additions & 0 deletions .github/workflows/upload-release-asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 4 additions & 3 deletions src/Handlers/AbstractPaymentMethodHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -640,7 +641,7 @@ protected function preparePaymentsRequest(
$currency = $salesChannelContext->getCurrency();

//Building open invoice line

$lineItem = new LineItem();

$lineItem->setDescription($productName);
Expand Down
4 changes: 1 addition & 3 deletions src/Migration/Migration1626331358AdyenRefund.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
4 changes: 1 addition & 3 deletions src/Migration/Migration1646742586AdyenPaymentCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
4 changes: 1 addition & 3 deletions src/Migration/Migration1669129247AdyenPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
27 changes: 27 additions & 0 deletions src/Migration/Migration1727273181AlterAdyenRefund.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types=1);

namespace Adyen\Shopware\Migration;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Shopware\Core\Framework\Migration\MigrationStep;

class Migration1727273181AlterAdyenRefund extends MigrationStep
{
public function getCreationTimestamp(): int
{
return 1727273181;
}

public function update(Connection $connection): void
{
try {
$connection->executeStatement(<<<SQL
ALTER TABLE `adyen_refund` DROP FOREIGN KEY `fk.adyen_refund.order_transaction_id`;
SQL
);
} catch (Exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}
}
27 changes: 27 additions & 0 deletions src/Migration/Migration1727273183AlterAdyenPaymentCapture.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types=1);

namespace Adyen\Shopware\Migration;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Shopware\Core\Framework\Migration\MigrationStep;

class Migration1727273183AlterAdyenPaymentCapture extends MigrationStep
{
public function getCreationTimestamp(): int
{
return 1727273183;
}

public function update(Connection $connection): void
{
try {
$connection->executeStatement(<<<SQL
ALTER TABLE `adyen_payment_capture` DROP FOREIGN KEY `fk.adyen_payment_capture.order_transaction_id`;
SQL
);
} catch (Exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}
}
27 changes: 27 additions & 0 deletions src/Migration/Migration1727273187AlterAdyenPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types=1);

namespace Adyen\Shopware\Migration;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Shopware\Core\Framework\Migration\MigrationStep;

class Migration1727273187AlterAdyenPayment extends MigrationStep
{
public function getCreationTimestamp(): int
{
return 1727273187;
}

public function update(Connection $connection): void
{
try {
$connection->executeStatement(<<<SQL
ALTER TABLE `adyen_payment` DROP FOREIGN KEY `fk.adyen_payment.order_transaction_id`;
SQL
);
} catch (Exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}
}
2 changes: 2 additions & 0 deletions src/ScheduledTask/ProcessNotificationsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: ProcessNotifications::class)]
class ProcessNotificationsHandler extends ScheduledTaskHandler
{
use LoggerAwareTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/ScheduledTask/ScheduleNotificationsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
use Psr\Log\LoggerAwareTrait;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: ScheduleNotifications::class)]
class ScheduleNotificationsHandler extends ScheduledTaskHandler
{
use LoggerAwareTrait;
Expand Down
5 changes: 4 additions & 1 deletion src/Service/CaptureService.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public function doOpenInvoiceCapture(string $orderNumber, $captureAmount, Contex
$order = $this->orderRepository->getOrderByOrderNumber(
$orderNumber,
$context,
['transactions', 'currency', 'lineItems', 'deliveries', 'deliveries.shippingMethod']
[
'transactions', 'currency', 'lineItems', 'deliveries',
'deliveries.shippingMethod', 'deliveries.stateMachineState'
]
);

if (is_null($order)) {
Expand Down

0 comments on commit cb4ef53

Please sign in to comment.