Skip to content

Commit

Permalink
Merge pull request #563 from Adyen/develop-3
Browse files Browse the repository at this point in the history
Release 3.16.2
  • Loading branch information
goran-stamenkovski-logeecom authored Oct 1, 2024
2 parents 952c1c9 + dcc0c75 commit ee350e5
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 26 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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
docker exec shopware6 bash -c 'php bin/console adyen:fetch-logos'
- name: Run E2E Tests
run: docker-compose -f .github/workflows/templates/docker-compose.playwright.yml run --rm playwright /e2e.sh
run: docker compose -f .github/workflows/templates/docker-compose.playwright.yml run --rm playwright /e2e.sh
env:
INTEGRATION_TESTS_BRANCH: develop
SHOPWARE_BASE_URL: ${{secrets.SHOPWARE_BASE_URL}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates/docker-compose.playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
playwright:
image: mcr.microsoft.com/playwright:focal
image: mcr.microsoft.com/playwright:v1.47.0-focal
networks:
- localnetwork
shm_size: 1gb
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": "3.16.1",
"version": "3.16.2",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down
6 changes: 3 additions & 3 deletions src/AdyenPaymentShopware6.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function installJsAssets($shopwareVersion)
$adminAssetPath = __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware6.js';
if (\version_compare($shopwareVersion, '6.5.0.0', '<')) {
$resultStorefront = $this->safeCopyAsset(
__DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware64.js.dist',
__DIR__ . '/Resources/app/storefront/build/storefront/js/adyen-payment-shopware64.js.dist',
$storefrontAssetPath
);
$resultAdmin = $this->safeCopyAsset(
Expand All @@ -62,11 +62,11 @@ public function installJsAssets($shopwareVersion)
);
} else {
$resultStorefront = $this->safeCopyAsset(
__DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware65.js.dist',
__DIR__ . '/Resources/app/storefront/build/storefront/js/adyen-payment-shopware65.js.dist',
$storefrontAssetPath
);
$resultAdmin = $this->safeCopyAsset(
__DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist',
__DIR__ . '/Resources/public/administration/js/adyen-payment-shopware65.js.dist',
$adminAssetPath
);
}
Expand Down
10 changes: 8 additions & 2 deletions src/Handlers/AbstractPaymentMethodHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,17 @@ protected function preparePaymentsRequest(
$this->getProduct($orderLine->getProductId(), $salesChannelContext->getContext()) :
null;

$domainUrl= null;
$domains = $salesChannelContext->getSalesChannel()->getDomains();
if ($domains && $domains->first()) {
$domainUrl = $domains->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 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
32 changes: 32 additions & 0 deletions src/Migration/Migration1727273181AlterAdyenRefund.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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 $exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}

public function updateDestructive(Connection $connection): void
{
// implement update destructive
}
}
32 changes: 32 additions & 0 deletions src/Migration/Migration1727273183AlterAdyenPaymentCapture.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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 $exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}

public function updateDestructive(Connection $connection): void
{
// implement update destructive
}
}
32 changes: 32 additions & 0 deletions src/Migration/Migration1727273187AlterAdyenPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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 $exception) {
// Intentionally left empty, if foreign key is missing, the migration should be skipped.
}
}

public function updateDestructive(Connection $connection): void
{
// implement update destructive
}
}
2 changes: 1 addition & 1 deletion src/Service/PaymentMethodsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function getPaymentMethods(SalesChannelContext $context, $orderId = ''):
return CacheValueCompressor::uncompress($paymentMethodsResponseCache->get());
}

$responseData = [];
$responseData = new PaymentMethodsResponse();
try {
$paymentsApiService = new PaymentsApi(
$this->clientService->getClient($context->getSalesChannelId())
Expand Down
45 changes: 39 additions & 6 deletions src/Storefront/Controller/FrontendProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
use Adyen\Shopware\Controller\StoreApi\Payment\PaymentController;
use Adyen\Shopware\Exception\ValidationException;
use Shopware\Core\Checkout\Cart\SalesChannel\AbstractCartOrderRoute;
use Shopware\Core\Checkout\Cart\SalesChannel\CartOrderRoute;
use Shopware\Core\Checkout\Cart\SalesChannel\CartService;
use Shopware\Core\Checkout\Order\SalesChannel\SetPaymentOrderRouteResponse;
use Shopware\Core\Checkout\Payment\SalesChannel\AbstractHandlePaymentMethodRoute;
use Shopware\Core\Checkout\Payment\SalesChannel\HandlePaymentMethodRoute;
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
use Shopware\Core\System\SalesChannel\ContextTokenResponse;
use Shopware\Core\System\SalesChannel\SalesChannel\AbstractContextSwitchRoute;
use Shopware\Core\System\SalesChannel\SalesChannel\ContextSwitchRoute;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -50,15 +47,51 @@
*/
class FrontendProxyController extends StorefrontController
{
/**
* @var AbstractCartOrderRoute
*/
private AbstractCartOrderRoute $cartOrderRoute;

private CartOrderRoute $cartOrderRoute;
/**
* @var CartService
*/
private CartService $cartService;
private ContextSwitchRoute $contextSwitchRoute;
private HandlePaymentMethodRoute $handlePaymentMethodRoute;

/**
* @var AbstractContextSwitchRoute
*/
private AbstractContextSwitchRoute $contextSwitchRoute;

/**
* @var AbstractHandlePaymentMethodRoute
*/
private AbstractHandlePaymentMethodRoute $handlePaymentMethodRoute;

/**
* @var PaymentController
*/
private PaymentController $paymentController;

/**
* @var OrderApiController
*/
private OrderApiController $orderApiController;

/**
* @var DonateController
*/
private DonateController $donateController;


/**
* @param AbstractCartOrderRoute $cartOrderRoute
* @param AbstractHandlePaymentMethodRoute $handlePaymentMethodRoute
* @param AbstractContextSwitchRoute $contextSwitchRoute
* @param CartService $cartService
* @param PaymentController $paymentController
* @param OrderApiController $orderApiController
* @param DonateController $donateController
*/
public function __construct(
AbstractCartOrderRoute $cartOrderRoute,
AbstractHandlePaymentMethodRoute $handlePaymentMethodRoute,
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/PaymentSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function onShoppingCartLoaded(PageLoadedEvent $event)
$giftcards = [];
if ($paymentMethod && $paymentMethod->getActive()) {
$giftcards = $this->paymentMethodsFilterService->filterAdyenPaymentMethodsByType(
$paymentMethods->getPaymentMethods(),
$paymentMethods->getPaymentMethods() ?? [],
'giftcard'
);
}
Expand Down

0 comments on commit ee350e5

Please sign in to comment.