Skip to content

Commit

Permalink
Merge branch 'main' into fix/CS-5960
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamara committed Sep 30, 2024
2 parents d0ceb21 + cb4ef53 commit 1c0bde9
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
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 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.
}
}
}
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 1c0bde9

Please sign in to comment.