2015-04-05 20:47:19 +02:00
|
|
|
<?php
|
2022-12-29 19:42:26 +01:00
|
|
|
|
2016-05-20 12:41:23 +02:00
|
|
|
/**
|
|
|
|
* CurrencyRepositoryInterface.php
|
2020-02-16 14:00:57 +01:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2016-05-20 12:41:23 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2016-10-05 06:52:15 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2017-10-21 08:40:00 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-10-21 08:40:00 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:37:26 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-10-21 08:40:00 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2016-05-20 12:41:23 +02:00
|
|
|
*/
|
2017-04-09 07:44:22 +02:00
|
|
|
declare(strict_types=1);
|
2015-04-05 20:47:19 +02:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Currency;
|
|
|
|
|
2017-04-13 20:47:59 +02:00
|
|
|
use Carbon\Carbon;
|
|
|
|
use FireflyIII\Models\CurrencyExchangeRate;
|
2015-04-05 20:47:19 +02:00
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
2017-11-15 12:25:49 +01:00
|
|
|
* Interface CurrencyRepositoryInterface.
|
2015-04-05 20:47:19 +02:00
|
|
|
*/
|
|
|
|
interface CurrencyRepositoryInterface
|
|
|
|
{
|
2024-12-22 08:43:12 +01:00
|
|
|
public function find(int $currencyId): ?TransactionCurrency;
|
|
|
|
|
2018-11-10 10:04:46 +01:00
|
|
|
/**
|
|
|
|
* Find by currency code, return NULL if unfound.
|
|
|
|
*
|
2023-10-28 06:58:33 +02:00
|
|
|
* Used in the download exchange rates cron job. Does not require user object.
|
2018-02-16 15:19:19 +01:00
|
|
|
*/
|
2023-10-28 06:58:33 +02:00
|
|
|
public function findByCode(string $currencyCode): ?TransactionCurrency;
|
2019-03-08 05:47:51 +01:00
|
|
|
|
2019-04-06 08:10:50 +02:00
|
|
|
/**
|
2023-10-28 06:58:33 +02:00
|
|
|
* Returns the complete set of transactions but needs
|
|
|
|
* no user object.
|
2019-04-06 08:10:50 +02:00
|
|
|
*
|
2023-10-28 06:58:33 +02:00
|
|
|
* Used by the download exchange rate cron job.
|
2017-08-18 15:14:44 +02:00
|
|
|
*/
|
2023-10-28 06:58:33 +02:00
|
|
|
public function getCompleteSet(): Collection;
|
2015-04-05 20:47:19 +02:00
|
|
|
|
2017-04-13 20:47:59 +02:00
|
|
|
/**
|
2018-06-28 07:32:58 +02:00
|
|
|
* Get currency exchange rate.
|
|
|
|
*
|
2023-10-28 06:58:33 +02:00
|
|
|
* Used in the download exchange rate cron job. Needs the user object!
|
2017-04-13 20:47:59 +02:00
|
|
|
*/
|
2018-06-28 07:32:58 +02:00
|
|
|
public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate;
|
2017-04-13 20:47:59 +02:00
|
|
|
|
2023-10-22 07:51:26 +02:00
|
|
|
/**
|
2023-10-28 06:58:33 +02:00
|
|
|
* Set currency exchange rate.
|
2023-10-22 07:51:26 +02:00
|
|
|
*
|
2023-10-28 06:58:33 +02:00
|
|
|
* Used in download exchange rate cron job. Needs the user object!
|
2022-12-29 19:42:26 +01:00
|
|
|
*/
|
|
|
|
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate;
|
2015-04-07 18:25:21 +02:00
|
|
|
}
|