Skip to content

Commit 55df323

Browse files
committed
Merge branch 'main' of github.com:SSEsmaeeli/laravel-pay-pocket into fix/transactional-statements
2 parents 170d4f4 + 8846355 commit 55df323

10 files changed

+108
-28
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- name: Dependabot metadata
1515
id: metadata
16-
uses: dependabot/fetch-metadata@v1.6.0
16+
uses: dependabot/fetch-metadata@v2.1.0
1717
with:
1818
github-token: "${{ secrets.GITHUB_TOKEN }}"
1919

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ref: ${{ github.head_ref }}
2020

2121
- name: Fix PHP code style issues
22-
uses: aglipanci/laravel-pint-action@2.3.1
22+
uses: aglipanci/laravel-pint-action@2.4
2323

2424
- name: Commit changes
2525
uses: stefanzweifel/git-auto-commit-action@v5

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
coverage: none
2121

2222
- name: Install composer dependencies
23-
uses: ramsey/composer-install@v2
23+
uses: ramsey/composer-install@v3
2424

2525
- name: Run PHPStan
2626
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/run-tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.1, 8.2, 8.3]
17-
laravel: [10.*]
16+
php: [8.2, 8.3]
17+
laravel: [10.*, 11.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
2020
- laravel: 10.*
2121
testbench: 8.*
2222
carbon: ^2.63
23+
php: 8.1
24+
- laravel: 11.*
25+
testbench: 9.*
26+
carbon: ^3.0
27+
php: 8.2
2328

2429
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2530

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,62 @@
22

33
All notable changes to `laravel-pay-pocket` will be documented in this file.
44

5+
## 2.2.0 - 2024-06-27
6+
7+
### What's Changed
8+
9+
* Update: Change log_reference_length to log_reference_params by @3m1n3nc3 in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/34
10+
* Modify comments by @HPWebdeveloper in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/36
11+
12+
**Full Changelog**: https://github.com/HPWebdeveloper/laravel-pay-pocket/compare/2.1.0...2.2.0
13+
14+
## 2.1.0 - 2024-06-27
15+
16+
### What's Changed
17+
18+
* Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/26
19+
* Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 by @dependabot in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/27
20+
* Add check Laravel 11 compatibility by @HPWebdeveloper in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/28
21+
* Test over the correct php version by @HPWebdeveloper in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/29
22+
* Support Laravel 11 by @samehdoush in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/25
23+
24+
### New Contributors
25+
26+
* @samehdoush made their first contribution in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/25
27+
28+
**Full Changelog**: https://github.com/HPWebdeveloper/laravel-pay-pocket/compare/2.0.3...2.1.0
29+
30+
## 2.0.3 - 2024-04-12
31+
32+
### What's Changed
33+
34+
* Update create_wallets_logs_table.php.stub by @josecarpio99 in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/21
35+
36+
### New Contributors
37+
38+
* @josecarpio99 made their first contribution in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/21
39+
40+
**Full Changelog**: https://github.com/HPWebdeveloper/laravel-pay-pocket/compare/2.0.2...2.0.3
41+
42+
## 2.0.2 - 2024-04-12
43+
44+
### What's Changed
45+
46+
* Bump ramsey/composer-install from 2 to 3 by @dependabot in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/20
47+
* Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 by @dependabot in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/23
48+
49+
**Full Changelog**: https://github.com/HPWebdeveloper/laravel-pay-pocket/compare/2.0.1...2.0.2
50+
51+
## 2.0.1 - 2024-04-12
52+
53+
### What's Changed
54+
55+
* Update README.md by @3m1n3nc3 in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/15
56+
* Fix/style fix by @SSEsmaeeli in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/17
57+
* Types by @HPWebdeveloper in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/16
58+
59+
**Full Changelog**: https://github.com/HPWebdeveloper/laravel-pay-pocket/compare/2.0.0...2.0.1
60+
561
## v2.0.0 - 2024-01-12
662

763
- [2.x] Add Transaction note by @3m1n3nc3 in https://github.com/HPWebdeveloper/laravel-pay-pocket/pull/10

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,35 @@
99

1010
**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`.
1111

12-
**Demo** https://github.com/HPWebdeveloper/demo-pay-pocket
12+
**Demo:** https://github.com/HPWebdeveloper/demo-pay-pocket
13+
14+
**Videos:**
15+
16+
- [Laravel Pay Pocket Package: Virtual Wallets in Your Project](https://www.youtube.com/watch?v=KoQyURiwsA4)
17+
18+
- [Laravel Exceptions: Why and How to Use? Practical Example.](https://www.youtube.com/watch?v=-Sr18w91v8Q)
19+
20+
- [PHP Enums in Laravel: Practical Example from Package](https://www.youtube.com/watch?v=iUOb-3HQtK8)
21+
1322

1423
**Note:** This package does not handle payments from payment platforms, but instead offers the concept of virtual money, deposit, and withdrawal.
1524

1625
- **Author**: Hamed Panjeh
1726
- **Vendor**: hpwebdeveloper
1827
- **Package**: laravel-pay-pocket
1928
- **Alias name**: Laravel PPP (Laravel Pay Pocket Package)
20-
- **Version**: `1.x`
29+
- **Version**: `2.x`
2130
- **PHP Version**: 8.1+
22-
- **Laravel Version**: `10.x`
31+
- **Laravel Version**: `10.x`, `11.x`
2332
- **[Composer](https://getcomposer.org/):** `composer require hpwebdeveloper/laravel-pay-pocket`
2433

2534
### Support Policy
2635

27-
| Version | Laravel | PHP | Release date | End of improvements | End of support |
28-
| ------- | ------- | ------------- | ------------ | ------------------- | -------------- |
29-
| 1.x | ^10.0 | 8.1, 8.2, 8.3 | Nov 30, 2023 | Mar 1, 2024 | |
30-
| x.x | | | | | |
36+
| Version | Laravel | PHP | Release date | End of improvements | End of support |
37+
|-------------------------------------------------|--------------|-------------|---------------|---------------------| -------------- |
38+
| 1.x | ^10.0 | 8.1, 8.2, 8.3 | Nov 30, 2023 | Mar 1, 2024 | |
39+
| 2.x | ^10.0, ^11.0 |8.2, 8.3| June 27, 2024 | January 30, 2025 | |
40+
| 3.x (atomic operations and restricted wallets) | ^11.0 |8.2, 8.3| comming soon | | |
3141

3242
## Installation:
3343

@@ -199,7 +209,7 @@ you will discover a variety of exceptions tailored to address each scenario of i
199209
### Log
200210

201211
A typical `wallets_logs` table.
202-
![Laravel Pay Pocket Log](https://github.com/HPWebdeveloper/laravel-pay-pocket/assets/16323354/a242d335-8bd2-4af1-aa38-4e95b8870941)
212+
![Laravel Pay Pocket Log](https://github.com/HPWebdeveloper/laravel-pay-pocket/assets/16323354/0d7f2237-88e1-4ac0-a4f2-ac200bad9273)
203213

204214
## Testing
205215

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^8.1",
2020
"spatie/laravel-package-tools": "^1.14.0",
21-
"illuminate/contracts": "^10.0"
21+
"illuminate/contracts": "^10.0 || ^11.0"
2222
},
2323
"require-dev": {
2424
"laravel/pint": "^1.0",

config/pay-pocket.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22

33
// config for HPWebdeveloper/LaravelPayPocket
44

5-
/**
6-
* The 'log_reference_generator' should be a numeric array with three elements:
7-
* - The first element should be the fully qualified name of a class that contains static methods.
8-
* This includes the namespace of the class.
9-
* - The second element should be the name of a static method available in the specified class.
10-
* - The third element should be an array of optional parameters to pass to the static method.
11-
* For example, the default generator is configured as follows:
12-
* [\Illuminate\Support\Str::class, 'random', [12]], which uses the 'random' static method
13-
* from the \Illuminate\Support\Str class with 12 as a parameter.
14-
*/
155
return [
16-
'log_reference_length' => 12,
6+
7+
/*
8+
|--------------------------------------------------------------------------
9+
| Reference Generator Configuration
10+
|--------------------------------------------------------------------------
11+
|
12+
| This configuration allows you to customize the generation of log reference strings
13+
| within the LaravelPayPocket package.
14+
|
15+
| - [array] log_reference_params: An array of parameters to pass to the log_reference_generator_method.
16+
| - [string] log_reference_prefix: Prefix for the generated reference string.
17+
| - [class-string] log_reference_generator_class: Fully qualified name of the class containing static methods for generation.
18+
| - [string] log_reference_generator_method: Name of the static method available in the generator class.
19+
|
20+
| By default, the following generator is set up:
21+
| Illuminate\Support\Str::random(12)
22+
|
23+
*/
24+
25+
'log_reference_params' => [12],
1726
'log_reference_prefix' => '',
1827
'log_reference_generator_class' => Illuminate\Support\Str::class,
1928
'log_reference_generator_method' => 'random',

database/migrations/create_wallets_logs_table.php.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ return new class () extends Migration {
2929
*/
3030
public function down(): void
3131
{
32-
Schema::dropIfExists('balance_logs');
32+
Schema::dropIfExists('wallets_logs');
3333
}
3434
};

src/Traits/BalanceOperation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ protected function generateReference(): string
7272
{
7373
$className = config('pay-pocket.log_reference_generator_class');
7474
$methodName = config('pay-pocket.log_reference_generator_method');
75-
$length = config('pay-pocket.log_reference_length');
75+
$params = (array) config('pay-pocket.log_reference_params', [12]);
7676
$prefix = config('pay-pocket.log_reference_prefix');
7777

7878
if (! is_callable([$className, $methodName])) {
7979
throw new InvalidArgumentException('Invalid configuration: The combination of log_reference_generator_class and log_reference_generator_method is not callable.');
8080
}
8181

82-
$reference = call_user_func([$className, $methodName], $length);
82+
$reference = call_user_func([$className, $methodName], ...$params);
8383

8484
return $prefix.$reference;
8585
}

0 commit comments

Comments
 (0)