Replace enum

This commit is contained in:
James Cole
2025-01-03 09:05:19 +01:00
parent 21165eb3e0
commit 44eafeeae5
55 changed files with 148 additions and 106 deletions

View File

@@ -343,7 +343,7 @@ class CreditRecalculateService
}
// in any other case, remove amount from left of debt.
if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) {
if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) {
$usedAmount = app('steam')->negative($usedAmount);
return bcadd($leftOfDebt, $usedAmount);
@@ -380,7 +380,7 @@ class CreditRecalculateService
*/
private function isWithdrawalIn(string $amount, string $transactionType): bool
{
return TransactionType::WITHDRAWAL === $transactionType && 1 === bccomp($amount, '0');
return TransactionTypeEnum::WITHDRAWAL->value === $transactionType && 1 === bccomp($amount, '0');
}
/**
@@ -396,7 +396,7 @@ class CreditRecalculateService
*/
private function isWithdrawalOut(string $amount, string $transactionType): bool
{
return TransactionType::WITHDRAWAL === $transactionType && -1 === bccomp($amount, '0');
return TransactionTypeEnum::WITHDRAWAL->value === $transactionType && -1 === bccomp($amount, '0');
}
/**