Skip to content

Commit

Permalink
NTR: fix shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Dec 5, 2024
1 parent 595cd5c commit 79ded2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)=>{
Expand Down
6 changes: 4 additions & 2 deletions src/Service/MollieApi/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
];
}
}

0 comments on commit 79ded2b

Please sign in to comment.