diff --git a/src/Service/Order/UpdateOrderLineItems.php b/src/Service/Order/UpdateOrderLineItems.php index c014762c9..2ce73f5c6 100644 --- a/src/Service/Order/UpdateOrderLineItems.php +++ b/src/Service/Order/UpdateOrderLineItems.php @@ -33,6 +33,7 @@ public function __construct(OrderLineItemRepositoryInterface $orderLineRepositor */ public function updateOrderLineItems(array $orderLines, OrderLineItemCollection $shopwareOrderLines, SalesChannelContext $salesChannelContext): void { + $updateLines = []; foreach ($orderLines as $orderLine) { if ($orderLine->type === OrderLineType::TYPE_SHIPPING_FEE) { continue; @@ -44,8 +45,8 @@ public function updateOrderLineItems(array $orderLines, OrderLineItemCollection continue; } /** @var OrderLineItemEntity $shopwareLine */ - $shopwareLine = $shopwareOrderLines->get($shopwareLineItemId); - if (!$shopwareLine instanceof OrderLineItemEntity) { + $shopwareLine = $shopwareOrderLines->get($shopwareLineItemId); + if (! $shopwareLine instanceof OrderLineItemEntity) { continue; } @@ -53,14 +54,16 @@ public function updateOrderLineItems(array $orderLines, OrderLineItemCollection $originalCustomFields = $shopwareLine->getPayload()['customFields'] ?? []; $originalCustomFields['order_line_id'] = $orderLine->id; - $data = [ + $updateLines[] = [ 'id' => $shopwareLine->getId(), 'customFields' => [ 'mollie_payments' => $originalCustomFields - ] + ], ]; - - $this->orderLineRepository->update([$data], $salesChannelContext->getContext()); } + if (count($updateLines) === 0) { + return; + } + $this->orderLineRepository->update($updateLines, $salesChannelContext->getContext()); } } diff --git a/tests/Cypress/cypress/e2e/storefront/subscriptions/subscription.cy.js b/tests/Cypress/cypress/e2e/storefront/subscriptions/subscription.cy.js index 3baa86497..f02a3163a 100644 --- a/tests/Cypress/cypress/e2e/storefront/subscriptions/subscription.cy.js +++ b/tests/Cypress/cypress/e2e/storefront/subscriptions/subscription.cy.js @@ -438,8 +438,8 @@ function assertValidSubscriptionInAdmin(){ } function assertAvailablePaymentMethods() { - cy.contains('Pay later').should('not.exist'); - cy.contains('paysafecard').should('not.exist'); + cy.get('.payment-methods input.klarnapaylater').should('not.exist'); + cy.get('.payment-methods input.paysafecard').should('not.exist'); cy.contains('iDEAL').should('exist'); cy.contains('Card').should('exist');