Skip to content

Commit

Permalink
Update core system
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvan Ngalle committed Nov 20, 2024
1 parent 4deda83 commit 4551e4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ return User::first()->withdrawal($request)
Check if user can make transaction if his finance account is not disabled

```php
return Company::first()->canMakeTransaction() ? Company::first()->withdrawal($request) : 'Error';
return Company::first()->canMakeTransaction() ? Company::first()->withdrawal($request) : 'Your account is disabled';
```

Check if user can make transaction if his finance account has enough balance base on threshold use true to force balance calculation
Expand Down
4 changes: 3 additions & 1 deletion src/Traits/FinanceAccountTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function withdrawal(string $providerId, float $amount, string $descriptio
return $this->makeTransaction($providerId, $amount, $description, FinanceTransaction::WITHDRAWAL_MOVEMENT);
}

public function setThreshold(float $minBalance): void
public function setThreshold(float $minBalance): FinanceAccount
{
if (empty($this->finance_account)) {
$this->balanceChecksum();
Expand All @@ -165,5 +165,7 @@ public function setThreshold(float $minBalance): void
$this->finance_account->update(
[FinanceAccount::THRESHOLD => $minBalance]
);

return $this->finance_account;
}
}

0 comments on commit 4551e4f

Please sign in to comment.