diff --git a/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js b/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js index 69354d314..c14943c9e 100644 --- a/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js +++ b/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js @@ -263,7 +263,7 @@ Component.override('sw-order-detail-general', { MolliePaymentsRefundBundleRepositoryService.setOrderId(this.order.id); MolliePaymentsRefundBundleRepositoryService.fetch().then((response) => { - this.isShippingPossible = response.data.shipping; + this.isShippingPossible = response.data.shipping.shippableQuantity > 0; }); this.refundedManagerService.isRefundManagerAvailable(this.order.salesChannelId, this.order.id).then((possible)=>{ diff --git a/src/Service/MollieApi/Shipment.php b/src/Service/MollieApi/Shipment.php index 4fc2b116d..a2daf793f 100644 --- a/src/Service/MollieApi/Shipment.php +++ b/src/Service/MollieApi/Shipment.php @@ -181,12 +181,13 @@ public function getTotals(string $mollieOrderId, string $salesChannelId): array return [ 'amount' => 0.0, 'quantity' => 0, + 'shippable' => 0 ]; } $totalAmount = 0.0; $totalQuantity = 0; - + $shippableQuantity = 0; foreach ($mollieOrder->lines() as $mollieOrderLine) { /** @var OrderLine $mollieOrderLine */ if ($mollieOrderLine->type === OrderLineType::TYPE_SHIPPING_FEE) { @@ -197,13 +198,14 @@ public function getTotals(string $mollieOrderId, string $salesChannelId): array if ($mollieOrderLine->amountShipped) { $totalAmount += floatval($mollieOrderLine->amountShipped->value); } - + $shippableQuantity += $mollieOrderLine->shippableQuantity; $totalQuantity += $mollieOrderLine->quantityShipped; } return [ 'amount' => $totalAmount, 'quantity' => $totalQuantity, + 'shippableQuantity' => $shippableQuantity ]; } } diff --git a/tests/PHPUnit/Service/MollieApi/ShipmentTest.php b/tests/PHPUnit/Service/MollieApi/ShipmentTest.php index 1251dec14..4718ecb8f 100644 --- a/tests/PHPUnit/Service/MollieApi/ShipmentTest.php +++ b/tests/PHPUnit/Service/MollieApi/ShipmentTest.php @@ -195,7 +195,8 @@ public function testGetTotals() $expectedTotals = [ 'amount' => 175.0, - 'quantity' => 5 + 'quantity' => 5, + 'shippableQuantity' => 4 ]; $actualTotals = $this->shipmentApiService->getTotals('mollieOrderId', 'salesChannelId');