From 62df218e32fc92eaacaba8b1754c93582b95cb4a Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Fri, 21 Jun 2024 11:13:14 +0200 Subject: [PATCH 1/2] NTR: change tests --- .../cypress/e2e/storefront/subscriptions/subscription.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'); From 9db779ecd4de85452d051c7132003794903d0a03 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Fri, 21 Jun 2024 11:08:21 +0200 Subject: [PATCH 2/2] NTR: updaet lines --- src/Service/Order/UpdateOrderLineItems.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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()); } }