Skip to content

Commit

Permalink
Merge pull request #81 from heseya/bugfix/8.x.x/B2B-284
Browse files Browse the repository at this point in the history
Fix error in order vat rate calculations
  • Loading branch information
pa-cholek authored Oct 8, 2024
2 parents 0ec313f + e492d30 commit 5f03495
Show file tree
Hide file tree
Showing 2 changed files with 450 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Services/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public function store(OrderDto $dto): Order
$currency = $priceMap->currency;

$vat_rate = $this->salesChannelService->getVatRate($salesChannel);
$vat_rate_as_percent = $vat_rate->toFloat() * 100;

DB::beginTransaction();

Expand Down Expand Up @@ -209,7 +210,7 @@ public function store(OrderDto $dto): Order
'shipping_place' => $shippingPlace,
'shipping_type' => $shippingMethod->shipping_type ?? $digitalShippingMethod->shipping_type ?? null,
'payment_method_type' => $paymentMethod->type,
'vat_rate' => $vat_rate,
'vat_rate' => $vat_rate_as_percent,
] + $dto->toArray(),
);

Expand All @@ -235,7 +236,7 @@ public function store(OrderDto $dto): Order
'base_price_initial' => $price,
'base_price' => $price,
'name' => $product->getTranslation('name', $language),
'vat_rate' => $vat_rate->multipliedBy(100)->toFloat(),
'vat_rate' => $vat_rate_as_percent,
'shipping_digital' => $product->shipping_digital,
]);

Expand Down
Loading

0 comments on commit 5f03495

Please sign in to comment.