Add cron job to download transaction currencies from Azure (if enabled by user).

This commit is contained in:
James Cole
2022-06-09 17:47:01 +02:00
parent de3376c966
commit beed44f065
8 changed files with 362 additions and 3 deletions

View File

@@ -441,6 +441,27 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return null;
}
/**
* TODO must be a factory
* @param TransactionCurrency $fromCurrency
* @param TransactionCurrency $toCurrency
* @param Carbon $date
* @param float $rate
* @return CurrencyExchangeRate
*/
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate
{
return CurrencyExchangeRate::create(
[
'user_id' => $this->user->id,
'from_currency_id' => $fromCurrency->id,
'to_currency_id' => $toCurrency->id,
'date' => $date,
'rate' => $rate,
]
);
}
/**
* @inheritDoc
*/

View File

@@ -202,6 +202,16 @@ interface CurrencyRepositoryInterface
*/
public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate;
/**
* TODO must be a factory
* @param TransactionCurrency $fromCurrency
* @param TransactionCurrency $toCurrency
* @param Carbon $date
* @param float $rate
* @return CurrencyExchangeRate
*/
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate;
/**
* @param TransactionCurrency $currency
*