Rename ApiMoney to MoneyWithConversion
This commit is contained in:
@@ -4,7 +4,7 @@ namespace App\ApiResource\Accounting;
|
||||
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Accounting\Accounting;
|
||||
use App\Mapping\Transformer\AccountingOwnerMapTransformer;
|
||||
use App\State\Accounting\AccountingStateProcessor;
|
||||
@@ -51,5 +51,5 @@ class AccountingApiResource
|
||||
public string $currency;
|
||||
|
||||
#[API\ApiProperty(security: 'is_granted("ACCOUNTING_VIEW", object)')]
|
||||
public ApiMoney $balance;
|
||||
public MoneyWithConversion $balance;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\ApiResource\Accounting;
|
||||
|
||||
use ApiPlatform\Metadata as API;
|
||||
use ApiPlatform\Metadata\QueryParameter;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\State\Accounting\AccountingBalancePointStateProvider;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -57,7 +57,7 @@ class AccountingBalancePoint
|
||||
/**
|
||||
* Resulting balance for items in this point.
|
||||
*/
|
||||
public ApiMoney $balance;
|
||||
public MoneyWithConversion $balance;
|
||||
|
||||
/**
|
||||
* The number of items aggregated in this point.
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\ApiResource\Accounting;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Accounting\Transaction;
|
||||
use App\State\ApiResourceStateProvider;
|
||||
|
||||
@@ -33,7 +33,7 @@ class TransactionApiResource
|
||||
/**
|
||||
* The monetary value received at target and issued at origin.
|
||||
*/
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* The Accounting from which the Transaction comes from.
|
||||
|
||||
@@ -6,7 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter;
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\Accounting\AccountingApiResource;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Dto\Gateway\ChargeUpdationDto;
|
||||
use App\Entity\Gateway\Charge;
|
||||
use App\Filter\GatewayFilter;
|
||||
@@ -81,7 +81,7 @@ class ChargeApiResource
|
||||
#[Assert\NotBlank()]
|
||||
#[API\ApiFilter(Filter\RangeFilter::class, properties: ['money.amount'])]
|
||||
#[API\ApiFilter(Filter\SearchFilter::class, properties: ['money.currency' => 'exact'])]
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* The status of the charge item with the Gateway.
|
||||
|
||||
@@ -6,7 +6,7 @@ use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Matchfunding\MatchAgainst;
|
||||
use App\Entity\Matchfunding\MatchStrategy;
|
||||
use App\Mapping\Transformer\MatchFormulaMapTransformer;
|
||||
@@ -81,7 +81,7 @@ class MatchStrategyApiResource
|
||||
*/
|
||||
#[Assert\NotBlank()]
|
||||
#[Assert\Valid()]
|
||||
public ApiMoney $limit;
|
||||
public MoneyWithConversion $limit;
|
||||
|
||||
/**
|
||||
* The `x` factor used to calculate the resulting match of funds with the MatchFormula.
|
||||
|
||||
@@ -7,7 +7,7 @@ use App\Money\Conversion\Conversion;
|
||||
use App\Money\MoneyInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class ApiMoney implements MoneyInterface
|
||||
class MoneyWithConversion implements MoneyInterface
|
||||
{
|
||||
/**
|
||||
* An amount of currency.\
|
||||
@@ -5,8 +5,8 @@ namespace App\ApiResource\Project;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\LocalizedApiResourceTrait;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Project\BudgetItem;
|
||||
use App\Entity\Project\BudgetItemType;
|
||||
use App\Entity\Project\ProjectDeadline;
|
||||
@@ -58,7 +58,7 @@ class BudgetItemApiResource
|
||||
*/
|
||||
#[Assert\NotBlank()]
|
||||
#[Assert\Valid()]
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* Defines the budget category for this item within the project.
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
|
||||
namespace App\ApiResource\Project;
|
||||
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
|
||||
class BudgetSummary
|
||||
{
|
||||
/**
|
||||
* The total money by the included items.
|
||||
*/
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* The total money of type 'task'.
|
||||
*/
|
||||
public ApiMoney $task;
|
||||
public MoneyWithConversion $task;
|
||||
|
||||
/**
|
||||
* The total money of type 'material'.
|
||||
*/
|
||||
public ApiMoney $material;
|
||||
public MoneyWithConversion $material;
|
||||
|
||||
/**
|
||||
* The total money of type 'infrastructure'.
|
||||
*/
|
||||
public ApiMoney $infra;
|
||||
public MoneyWithConversion $infra;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\LocalizedApiResourceTrait;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Project\Reward;
|
||||
use App\State\ApiResourceStateProvider;
|
||||
use App\State\Project\RewardStateProcessor;
|
||||
@@ -56,7 +56,7 @@ class RewardApiResource
|
||||
*/
|
||||
#[Assert\NotBlank()]
|
||||
#[API\ApiFilter(OrderFilter::class, properties: ['money.amount'])]
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* Rewards might be finite, i.e: has a limited amount of existing unitsTotal.
|
||||
|
||||
@@ -8,7 +8,7 @@ use ApiPlatform\Doctrine\Orm\State\Options;
|
||||
use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\Accounting\AccountingApiResource;
|
||||
use App\ApiResource\Accounting\TransactionApiResource;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Project\Support;
|
||||
use App\Money\Totalization\TotalizedMoney;
|
||||
use App\State\ApiResourceStateProvider;
|
||||
@@ -87,7 +87,7 @@ class SupportApiResource
|
||||
/**
|
||||
* The total monetary value of the Transactions going to the Project.
|
||||
*/
|
||||
public ApiMoney $money;
|
||||
public MoneyWithConversion $money;
|
||||
|
||||
/**
|
||||
* User's will to have their support to the Project be shown publicly.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Mapping\Transformer;
|
||||
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\ApiResource\Project\Budget;
|
||||
use App\ApiResource\Project\BudgetSummary;
|
||||
use App\Entity\Project\BudgetItem;
|
||||
@@ -46,22 +46,22 @@ class BudgetMapTransformer implements PropertyTransformerInterface
|
||||
|
||||
$summary = new BudgetSummary();
|
||||
|
||||
$summary->money = ApiMoney::of($this->budgetService->calcBudget(
|
||||
$summary->money = MoneyWithConversion::of($this->budgetService->calcBudget(
|
||||
$items,
|
||||
$currency
|
||||
)[$deadline]);
|
||||
|
||||
$summary->task = ApiMoney::of($this->budgetService->calcBudget(
|
||||
$summary->task = MoneyWithConversion::of($this->budgetService->calcBudget(
|
||||
$this->filterItemsByType($items, BudgetItemType::Task),
|
||||
$currency
|
||||
)[$deadline]);
|
||||
|
||||
$summary->material = ApiMoney::of($this->budgetService->calcBudget(
|
||||
$summary->material = MoneyWithConversion::of($this->budgetService->calcBudget(
|
||||
$this->filterItemsByType($items, BudgetItemType::Material),
|
||||
$currency
|
||||
)[$deadline]);
|
||||
|
||||
$summary->infra = ApiMoney::of($this->budgetService->calcBudget(
|
||||
$summary->infra = MoneyWithConversion::of($this->budgetService->calcBudget(
|
||||
$this->filterItemsByType($items, BudgetItemType::Infrastructure),
|
||||
$currency
|
||||
)[$deadline]);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Service;
|
||||
|
||||
use App\ApiResource\Accounting\AccountingBalancePoint;
|
||||
use App\ApiResource\ApiMoney;
|
||||
use App\ApiResource\MoneyWithConversion;
|
||||
use App\Entity\Accounting\Accounting;
|
||||
use App\Entity\Accounting\Transaction;
|
||||
use App\Entity\User\User;
|
||||
@@ -72,7 +72,7 @@ class AccountingService
|
||||
$point = new AccountingBalancePoint();
|
||||
$point->start = $lowerBound;
|
||||
$point->end = $upperBound;
|
||||
$point->balance = ApiMoney::of($balance);
|
||||
$point->balance = MoneyWithConversion::of($balance);
|
||||
$point->length = count($transactions);
|
||||
|
||||
return $point;
|
||||
|
||||
Reference in New Issue
Block a user