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`.
This command will automatically publish the `WalletEnums.php` file into your application's `app/Enums` directory.
58
57
58
+
## Updating
59
+
60
+
If updating from version `<= 1.0.3`, new migration and config files have been added to support the new [Transaction Info Feature](#transaction-info)
61
+
62
+
Follow the [Installation](#installation) Steps 2 and 3 to update your migrations.
63
+
59
64
## Preparation
60
65
61
66
### Prepare User Model
62
67
63
-
To use this package you need to implement the `WalletOperations` into `User` model and utilize the `ManagesWallet` trait.
68
+
To use this package you need to implement the `WalletOperations` into `User` model and utilize the `ManagesWallet` trait.
64
69
65
70
```php
66
71
@@ -75,9 +80,10 @@ class User extends Authenticatable implements WalletOperations
75
80
76
81
### Prepare Wallets
77
82
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.
83
+
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
84
80
85
For example, consider the following wallet types defined in the Enum class (published in step 3 of installation):
86
+
81
87
```php
82
88
namespace App\Enums;
83
89
@@ -88,48 +94,84 @@ enum WalletEnums: string
88
94
}
89
95
90
96
```
91
-
**You have complete freedom to name your wallets as per your requirements and even add more wallet types to the Enum list.**
92
97
98
+
**You have complete freedom to name your wallets as per your requirements and even add more wallet types to the Enum list.**
93
99
94
100
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
101
96
102
### Example:
103
+
97
104
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."
Note: `wallet_1` and `wallet_2` must already be defined in the `WalletEnums`.
117
139
140
+
#### Transaction Info ([#8][i8])
141
+
142
+
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,
195
+
196
+
Upon examining the `src/Exceptions` directory within the source code,
153
197
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