Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't Intiate wallet with 0 amount #19

Closed
greatsami opened this issue Mar 1, 2024 · 1 comment
Closed

[Bug]: Can't Intiate wallet with 0 amount #19

greatsami opened this issue Mar 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@greatsami
Copy link

What happened?

I try to intiate wallets for new register user but I faced exception error:

Invalie value to deposit

How to reproduce the bug

I updated the triat vendor/hpwebdeveloper/laravel-pay-pocket/src/Traits/HandlesDeposit.php

line 26:
from if ($amount =< 0) { to if ($amount < 0) {

its works

Package Version

2.0.0

PHP Version

8.2.12

Laravel Version

10.46.0

Which operating systems does with happen with?

Windows

Notes

No response

@greatsami greatsami added the bug Something isn't working label Mar 1, 2024
@3m1n3nc3
Copy link
Contributor

This is not a bug but an intended behaviour, you're not supposed to deposit an amount less than 0 to the wallet.
I think what you should rather do shoud be somthing like this:

use HPWebdeveloper\LaravelPayPocket\Exceptions\InvalidValueException;

$user = auth()->user();

try {
    $user->deposit('wallet_2', 67.89);
} catch (InvalidValueException $e) {
    // Do anything here.
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants