Skip to content

Commit

Permalink
Merge pull request #133 from Invertus/DGS-328/totla-paid-fix
Browse files Browse the repository at this point in the history
DGS-328/ Multiple payment transaction and total price fix
  • Loading branch information
GytisZum authored Jul 11, 2024
2 parents 74847d5 + 9664a7d commit fddb1ba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Service/ShipmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,14 @@ public function createShipmentFromOrder(Order $order)
private function createNonDistributedShipment(Order $order, $idProduct, $isTestMode)
{
$products = $order->getProducts();
$parcelPrice = 0;
$parcelPrice = $order->getTotalPaid();
$parcelWeight = 0;
$orderShippingCost = $order->total_shipping_tax_incl ?: 0;

foreach ($products as $product) {
$parcelPrice += $this->calculateProductsPrice($product);
$parcelWeight += $product['weight'] * $product['product_quantity'];
}

$parcelPrice = $this->calculateParcelPriceWithOrderDiscount($order, $parcelPrice);
$parcelPrice += $orderShippingCost;
$shipment = $this->createShipment($order, $idProduct, $isTestMode, 1, $parcelWeight, $parcelPrice);

if (!$shipment->id) {
Expand Down

0 comments on commit fddb1ba

Please sign in to comment.