doku
This commit is contained in:
@@ -2116,11 +2116,20 @@ final class Router
|
||||
: $this->currentTimestamp();
|
||||
$settledValueAmount = null;
|
||||
$settledValueCurrency = null;
|
||||
$settledFxFetchId = null;
|
||||
if ($this->isCryptoCurrencyCode($purchaseCurrency)) {
|
||||
$settledValueCurrency = $this->requiredCurrency($settings['report_currency'] ?? 'EUR', 'report_currency');
|
||||
$settledFxFetchId = $this->resolveMeasurementFxFetchId($projectKey, ['measured_at' => $purchasedAt], true);
|
||||
if ($settledFxFetchId === null) {
|
||||
throw new ApiException(
|
||||
'Es konnte kein FX-Snapshot fuer die Krypto-Zahlung gespeichert werden. Der Miner wird nicht ohne historische Kursreferenz angelegt.',
|
||||
422,
|
||||
['currency' => $purchaseCurrency, 'purchased_at' => $purchasedAt]
|
||||
);
|
||||
}
|
||||
$settledValueAmount = $purchaseCurrency === $settledValueCurrency
|
||||
? $purchaseCost
|
||||
: $this->convertMiningAssetAmount((float) $purchaseCost, $purchaseCurrency, $settledValueCurrency, $purchasedAt);
|
||||
: $this->convertMiningAssetAmount((float) $purchaseCost, $purchaseCurrency, $settledValueCurrency, $purchasedAt, $settledFxFetchId);
|
||||
if ($settledValueAmount === null) {
|
||||
throw new ApiException(
|
||||
'Der aktuelle Kurs fuer die Krypto-Zahlung konnte nicht ermittelt werden. Der Miner wird nicht ohne feste Bewertung gespeichert.',
|
||||
@@ -2145,6 +2154,7 @@ final class Router
|
||||
'reference_price_currency' => $referencePriceCurrency,
|
||||
'settled_value_amount' => $settledValueAmount,
|
||||
'settled_value_currency' => $settledValueCurrency,
|
||||
'settled_fx_fetch_id' => $settledFxFetchId,
|
||||
'auto_renew' => $isAutoRenew ? 1 : 0,
|
||||
'note' => $this->optionalString($input['note'] ?? ($offer['note'] ?? null), 1000),
|
||||
'is_active' => 1,
|
||||
|
||||
Reference in New Issue
Block a user