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

[Feature Request]: Restricted Wallets #8

Open
3m1n3nc3 opened this issue Jan 3, 2024 · 8 comments
Open

[Feature Request]: Restricted Wallets #8

3m1n3nc3 opened this issue Jan 3, 2024 · 8 comments
Assignees
Labels
feature Improvements or additions to documentation

Comments

@3m1n3nc3
Copy link
Contributor

3m1n3nc3 commented Jan 3, 2024

What happened?

This is not a bug report but the feature flags were not working so I had to use this.

How to reproduce the bug

Make a transaction.

Package Version

1.0.3

PHP Version

8.2.0

Laravel Version

9.0.0

Which operating systems does with happen with?

macOS, Windows, Linux

Notes

I moved from a custom built solution to this library because it had features I needed and do not care to reimplement,

  1. Wallets should be able to be marked as restricted so that when $user->pay(amount) method is called, the system does not attempt to charge from those restricted wallets, like in a case when we have a dedicated escrow wallet.
  2. Secondly my previous solution allowed me to tell the user exactly where the transaction originated, for instance Funds transfer from User XXX, it gets really handy and I would love to see it implemented.
@3m1n3nc3 3m1n3nc3 added the bug Something isn't working label Jan 3, 2024
@HPWebdeveloper HPWebdeveloper added feature Improvements or additions to documentation and removed bug Something isn't working labels Jan 3, 2024
@3m1n3nc3
Copy link
Contributor Author

3m1n3nc3 commented Jan 3, 2024

If you will allow me, I can add the features and create a PR.

@HPWebdeveloper
Copy link
Owner

@3m1n3nc3
#9 (comment)

@3m1n3nc3
Copy link
Contributor Author

3m1n3nc3 commented Jan 4, 2024

@3m1n3nc3 #9 (comment)

Take a look at my new comment on #9

@HPWebdeveloper
Copy link
Owner

@3m1n3nc3

I assume you have read : #10 (comment)

Prior to initiating a new Pull Request for the feature: Locked/Restricted Wallet, please address the following queries:

  • Who has the authority to designate a wallet as Locked? Is it the Application User or the Application Admin?
  • Does this limitation apply universally to all users, or can it be customized for each user?
  • What entity is responsible for lifting these restrictions, and what is the underlying process?
  • In the existing system, when charging a user (pay()), an exception may occur if the combined total of balances in WL1, WL2, etc., is insufficient. Considering this, do you propose that the sum should exclude balances from restricted wallets?

@HPWebdeveloper HPWebdeveloper changed the title [Feature Request]: Restricted Wallets and Description for logs [Feature Request]: Restricted Wallets Jan 11, 2024
@HPWebdeveloper
Copy link
Owner

HPWebdeveloper commented Jan 16, 2024

@3m1n3nc3
Could you please shortly address these doubts?

#8 (comment)

I still have doubts

@3m1n3nc3
Copy link
Contributor Author

@3m1n3nc3

I assume you have read : #10 (comment)

Prior to initiating a new Pull Request for the feature: Locked/Restricted Wallet, please address the following queries:

  • Who has the authority to designate a wallet as Locked? Is it the Application User or the Application Admin?
  • Does this limitation apply universally to all users, or can it be customized for each user?
  • What entity is responsible for lifting these restrictions, and what is the underlying process?
  • In the existing system, when charging a user (pay()), an exception may occur if the combined total of balances in WL1, WL2, etc., is insufficient. Considering this, do you propose that the sum should exclude balances from restricted wallets?
  • Determining who designates a wallet as locked should be the sole responsibility of the developer, as t is just a parameter so controls can be hardcoded or set in database for flexible management depending on the use case.
  • Also, who this limitation applies to is also the sole responsibility of the developer just as above.
  • See above.
  • With the implemetation of the allowed wallets feature, nothing changes as to how wallet balances are charged, the allowed wallets are analized for chargeability and the others (restricted) are excluded.

@HPWebdeveloper
Copy link
Owner

HPWebdeveloper commented Jan 16, 2024

@3m1n3nc3

Indeed it would be a good feature. I am working/thinking on a feature to make things more dynamics and if this becomes also dynamic it would be a great idea.

Doubt 1:

I expect this:

balance WL1 ($60) + WL2 ($40) = $100

WL1 is locked. hence $60 is not accessible.

I have an order which its price is $50.

Can I pay it? No, It should return an exception.

Doubt 2:

Why it is hardcoded or a parameter set in the database?

I am interested to have the ability to lock a wallet through code, something like FacadeName::Lock('WL1'). Hence even the end user can restrict/lock a wallet.

@3m1n3nc3
Copy link
Contributor Author

Doubt 1:
Like I said, nothing changed, the locked wallets are restricted from being analized to be charged, so in your example, it will throw the HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException exception.

Doubt 2:
When you call pay() you simply pass the allowedWallets parameter like pay(orderValue: 10.5, allowedWallets: ['wallet_1']) (allowedWallets Also accepts the wallet Enum as a value), this way the developer determines wether to lock the wallet through code, or allow admin to manage it from database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants