You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Laravel Pay Pocket** is a package designed for Laravel applications, offering the flexibility to manage multiple wallet types within two dedicated database tables, `wallets` and `wallets_logs`.
@@ -60,7 +58,7 @@ This command will automatically publish the `WalletEnums.php` file into your app
60
58
61
59
### Prepare User Model
62
60
63
-
To use this package you need to implement the `WalletOperations` into `User` model and utilize the `ManagesWallet` trait.
61
+
To use this package you need to implement the `WalletOperations` into `User` model and utilize the `ManagesWallet` trait.
64
62
65
63
```php
66
64
@@ -75,9 +73,10 @@ class User extends Authenticatable implements WalletOperations
75
73
76
74
### Prepare Wallets
77
75
78
-
In Laravel Pay Pocket, you have the flexibility to define the order in which wallets are prioritized for payments through the use of Enums. The order of wallets in the Enum file determines their priority level. The first wallet listed has the highest priority and will be used first for deducting order values.
76
+
In Laravel Pay Pocket, you have the flexibility to define the order in which wallets are prioritized for payments through the use of Enums. The order of wallets in the Enum file determines their priority level. The first wallet listed has the highest priority and will be used first for deducting order values.
79
77
80
78
For example, consider the following wallet types defined in the Enum class (published in step 3 of installation):
79
+
81
80
```php
82
81
namespace App\Enums;
83
82
@@ -88,15 +87,17 @@ enum WalletEnums: string
88
87
}
89
88
90
89
```
91
-
**You have complete freedom to name your wallets as per your requirements and even add more wallet types to the Enum list.**
92
90
91
+
**You have complete freedom to name your wallets as per your requirements and even add more wallet types to the Enum list.**
93
92
94
93
In this particular setup, `wallet_1` (`WALLET1`) is given the **highest priority**. When an order payment is processed, the system will first attempt to use `wallet_1` to cover the cost. If `wallet_1` does not have sufficient funds, `wallet_2` (`WALLET2`) will be used next.
95
94
96
95
### Example:
96
+
97
97
If the balance in `wallet_1` is 10 and the balance in `wallet_2` is 20, and you need to pay an order value of 15, the payment process will first utilize the entire balance of `wallet_1`. Since `wallet_1`'s balance is insufficient to cover the full amount, the remaining 5 will be deducted from `wallet_2`. After the payment, `wallet_2` will have a remaining balance of 15."
98
98
99
99
## Usage, APIs and Operations:
100
+
100
101
### Deposit
101
102
102
103
```php
@@ -113,13 +114,24 @@ use HPWebdeveloper\LaravelPayPocket\Facades\LaravelPayPocket;
Note: `wallet_1` and `wallet_2` must already be defined in the `WalletEnums`.
117
119
120
+
#### Transaction Info ([#8][i8])
121
+
122
+
In a case where you want to enter descriptions for a particular transaction, the `$notes` param allows you to provide information about why a transaction happened.
Upon examining the `src/Exceptions` directory within the source code,
166
+
167
+
Upon examining the `src/Exceptions` directory within the source code,
153
168
you will discover a variety of exceptions tailored to address each scenario of invalid entry. Review the [demo](https://github.com/HPWebdeveloper/demo-pay-pocket) that accounts for some of the exceptions.
0 commit comments