Skip to content

Commit c4751a5

Browse files
Copilotwilr
andauthored
Simplify exchange rate storage logic in OrderProcessor
Agent-Logs-Url: https://github.com/silvershop/silvershop-core/sessions/9ea8f7d5-bfca-4c21-a17f-f048b08ff414 Co-authored-by: wilr <101629+wilr@users.noreply.github.com>
1 parent e9eb878 commit c4751a5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Checkout/OrderProcessor.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,11 @@ function ($severity, $message, $file, $line): bool {
340340
// Store the exchange rate at time of placement for historical records
341341
if (!$this->order->ExchangeRate) {
342342
$currencyService = Injector::inst()->get(CurrencyService::class);
343-
$orderCurrency = $this->order->Currency ?: $currencyService->getActiveCurrency();
344343
$baseCurrency = ShopConfigExtension::get_site_currency();
345344
if (!$this->order->Currency) {
346-
$this->order->Currency = $orderCurrency;
345+
$this->order->Currency = $currencyService->getActiveCurrency();
347346
}
348-
$this->order->ExchangeRate = $currencyService->getExchangeRate($baseCurrency, $orderCurrency);
347+
$this->order->ExchangeRate = $currencyService->getExchangeRate($baseCurrency, $this->order->Currency);
349348
}
350349

351350
//allow decorators to do stuff when order is saved.

0 commit comments

Comments
 (0)