From e76a9647366d11df74aff860f54d546fff6088a7 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 13:59:33 +0100 Subject: [PATCH 01/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 31 ++++++++++++++++++++----------- composer.json | 15 ++++++--------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 70dc100..6c10468 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,35 +9,44 @@ on: jobs: test: runs-on: ${{ matrix.os }} + + timeout-minutes: 5 + strategy: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.3, 8.2, 8.1, 8.0] - laravel: [11.*,10.*, 9.*, 8.*] + php: [8.4, 8.3, 8.2, 8.1, 8.0] + laravel: [12.*, 11.*,10.*, 9.*, 8.*] stability: [prefer-lowest, prefer-stable] include: - - laravel: 11.* - testbench: ^9.0 - carbon: ^2.63 - - laravel: 10.* - testbench: ^8.0 + - laravel: 8.* + testbench: ^6.23 carbon: ^2.63 - laravel: 9.* testbench: ^7.0 carbon: ^2.63 - - laravel: 8.* - testbench: ^6.23 + - laravel: 10.* + testbench: ^8.0 + carbon: ^2.63 + - laravel: 11.* + testbench: ^9.0 carbon: ^2.63 + - laravel: 12.* + testbench: 10.* exclude: + - laravel: 8.* + php: 8.3 - laravel: 10.* php: 8.0 - laravel: 11.* php: 8.0 - laravel: 11.* php: 8.1 - - laravel: 8.* - php: 8.3 + - laravel: 12.* + php: 8.0 + - laravel: 12.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 0e6e7a8..64a86b5 100644 --- a/composer.json +++ b/composer.json @@ -36,21 +36,18 @@ "require": { "php": "^8.0|^8.1|^8.2|^8.3", "guzzlehttp/guzzle": "^7.5", - "illuminate/contracts": "^8.50|^9.0|^10.0|^11.0", - "illuminate/support": "^8.50|^9.0|^10.0|^11.0", + "illuminate/contracts": "^8.50|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^8.50|^9.0|^10.0|^11.0|^12.0", "spatie/laravel-package-tools": "^1.11" }, "require-dev": { "laravel/pint": "^1.0", "nunomaduro/collision": "^5.3|^6.0|^v7.10|^8.1.1", - "nunomaduro/larastan": "^1.0.4|^2.2", - "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0", - "pestphp/pest": "^1.21|^2.34", - "pestphp/pest-plugin-laravel": "^1.1|^v2.3.0", + "nunomaduro/larastan": "^1.0.4|^2.2|^3.0", + "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", + "pestphp/pest": "^1.21|^2.0|^3.7", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5|^10.4" + "phpstan/phpstan-deprecation-rules": "^1.0" }, "autoload": { "files": [ From 4129b8ebc07b9c09c3bafd841a118209e68b39bb Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:19:29 +0100 Subject: [PATCH 02/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 6 +----- composer.json | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6c10468..7da04eb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,16 +22,12 @@ jobs: include: - laravel: 8.* testbench: ^6.23 - carbon: ^2.63 - laravel: 9.* testbench: ^7.0 - carbon: ^2.63 - laravel: 10.* testbench: ^8.0 - carbon: ^2.63 - laravel: 11.* testbench: ^9.0 - carbon: ^2.63 - laravel: 12.* testbench: 10.* exclude: @@ -68,7 +64,7 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:>=2.72" --dev --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: List Installed Dependencies diff --git a/composer.json b/composer.json index 64a86b5..9274d1d 100644 --- a/composer.json +++ b/composer.json @@ -41,11 +41,12 @@ "spatie/laravel-package-tools": "^1.11" }, "require-dev": { - "laravel/pint": "^1.0", + "laravel/pint": "^1.14", "nunomaduro/collision": "^5.3|^6.0|^v7.10|^8.1.1", "nunomaduro/larastan": "^1.0.4|^2.2|^3.0", "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", "pestphp/pest": "^1.21|^2.0|^3.7", + "pestphp/pest-plugin-laravel": "^1.1|^v2.3.0|^3.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0" }, From c3825dd76e8cbb865a014c986e05b2057289d6fd Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:27:43 +0100 Subject: [PATCH 03/27] refactor: update dependencies for Laravel 12 compatibility --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9274d1d..e129386 100644 --- a/composer.json +++ b/composer.json @@ -47,8 +47,8 @@ "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", "pestphp/pest": "^1.21|^2.0|^3.7", "pestphp/pest-plugin-laravel": "^1.1|^v2.3.0|^3.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0" + "phpstan/extension-installer": "^1.3|^2.0", + "phpstan/phpstan-deprecation-rules": "^1.1|^2.0" }, "autoload": { "files": [ From 3577b0bb02db2b636667b9cccfb6e8e33c432ff6 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:31:49 +0100 Subject: [PATCH 04/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7da04eb..c767625 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -33,6 +33,8 @@ jobs: exclude: - laravel: 8.* php: 8.3 + - laravel: 8.* + php: 8.4 - laravel: 10.* php: 8.0 - laravel: 11.* From 3a88cf6acb418717558c2366a4bccf549954ee08 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:40:57 +0100 Subject: [PATCH 05/27] refactor: update dependencies for Laravel 12 compatibility --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e129386..c124d68 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "require-dev": { "laravel/pint": "^1.14", "nunomaduro/collision": "^5.3|^6.0|^v7.10|^8.1.1", - "nunomaduro/larastan": "^1.0.4|^2.2|^3.0", + "nunomaduro/larastan": "^1.0|^2.0|^3.0", "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", "pestphp/pest": "^1.21|^2.0|^3.7", "pestphp/pest-plugin-laravel": "^1.1|^v2.3.0|^3.0", From 34fb9cae26851e6ed20b4dd2980dd29c74a71928 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:42:52 +0100 Subject: [PATCH 06/27] refactor: update dependencies for Laravel 12 compatibility --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c124d68..c974a04 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "spatie/laravel-package-tools": "^1.11" }, "require-dev": { - "laravel/pint": "^1.14", + "laravel/pint": "^1.0|^1.14", "nunomaduro/collision": "^5.3|^6.0|^v7.10|^8.1.1", "nunomaduro/larastan": "^1.0|^2.0|^3.0", "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", From 0f1d86b40b4422a2804edc8d886c0ff76ff2370e Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:44:40 +0100 Subject: [PATCH 07/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c767625..dbe41e3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -35,6 +35,8 @@ jobs: php: 8.3 - laravel: 8.* php: 8.4 + - laravel: 9.* + php: 8.4 - laravel: 10.* php: 8.0 - laravel: 11.* From 7057f7add2a003c8bd404dfa309b1cfc3690e47f Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:46:55 +0100 Subject: [PATCH 08/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index dbe41e3..3da1328 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -39,6 +39,8 @@ jobs: php: 8.4 - laravel: 10.* php: 8.0 + - laravel: 10.* + php: 8.4 - laravel: 11.* php: 8.0 - laravel: 11.* From e1f7aadf3cada1607f35dcc7ca84de0be57a8c46 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:49:22 +0100 Subject: [PATCH 09/27] refactor: update dependencies for Laravel 12 compatibility --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3da1328..c7f257d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -45,6 +45,8 @@ jobs: php: 8.0 - laravel: 11.* php: 8.1 + - laravel: 11.* + php: 8.4 - laravel: 12.* php: 8.0 - laravel: 12.* From 4e764ea31f996eedae343f0c3be4b4ce8797e7e3 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 15:59:29 +0100 Subject: [PATCH 10/27] refactor: update dependencies for Laravel 12 compatibility --- src/Abstracts/BaseGateWay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Abstracts/BaseGateWay.php b/src/Abstracts/BaseGateWay.php index a783a36..5a4354f 100644 --- a/src/Abstracts/BaseGateWay.php +++ b/src/Abstracts/BaseGateWay.php @@ -85,7 +85,7 @@ public function getResponse(): array */ public function getData(): array { - return $this->getResponse()['data']; + return $this->getResponse(); } /* Instantiate the http client wrapper class to make it available to the gateway classes From 8670f1db43d78513ab032d20f6f11eff48687069 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:01:00 +0100 Subject: [PATCH 11/27] refactor: update dependencies for Laravel 12 compatibility --- src/Abstracts/BaseGateWay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Abstracts/BaseGateWay.php b/src/Abstracts/BaseGateWay.php index 5a4354f..a783a36 100644 --- a/src/Abstracts/BaseGateWay.php +++ b/src/Abstracts/BaseGateWay.php @@ -85,7 +85,7 @@ public function getResponse(): array */ public function getData(): array { - return $this->getResponse(); + return $this->getResponse()['data']; } /* Instantiate the http client wrapper class to make it available to the gateway classes From 3b06b9f34769364df4eac9033ba67340130865f0 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:45:18 +0100 Subject: [PATCH 12/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 2 +- phpstan.neon.dist | 14 -------------- src/Models/PaymentWebhookLog.php | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 phpstan.neon.dist diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3855a08..b2dce6a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -4,7 +4,7 @@ on: push: paths: - '**.php' - - 'phpstan.neon.dist' + - '../../phpstan.neon' jobs: phpstan: diff --git a/phpstan.neon.dist b/phpstan.neon.dist deleted file mode 100644 index a91953b..0000000 --- a/phpstan.neon.dist +++ /dev/null @@ -1,14 +0,0 @@ -includes: - - phpstan-baseline.neon - -parameters: - level: 4 - paths: - - src - - config - - database - tmpDir: build/phpstan - checkOctaneCompatibility: true - checkModelProperties: true - checkMissingIterableValueType: false - diff --git a/src/Models/PaymentWebhookLog.php b/src/Models/PaymentWebhookLog.php index b31bd61..911aeac 100644 --- a/src/Models/PaymentWebhookLog.php +++ b/src/Models/PaymentWebhookLog.php @@ -19,7 +19,6 @@ class PaymentWebhookLog extends Model public static function storePaymentWebhook(PaymentWebhookConfig $config, Request $request, $requestHash): PaymentWebhookLog { - // @phpstan-ignore-next-line return self::create([ 'payment_gateway' => $config->name, 'request_hash' => $requestHash, From 5a71b69834585aa15741d0ba8dbd33bad05ae4bc Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:49:22 +0100 Subject: [PATCH 13/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index b2dce6a..7bb532c 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -23,4 +23,4 @@ jobs: uses: ramsey/composer-install@v3 - name: Run PHPStan - run: ./vendor/bin/phpstan --error-format=github + run: ./vendor/bin/phpstan analyse --error-format=github From 078ed6bbcb2cae97ae81dd93a2939cbc5ef26e60 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:51:56 +0100 Subject: [PATCH 14/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 7bb532c..26c3009 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -3,7 +3,7 @@ name: PHPStan on: push: paths: - - '**.php' +# - '**.php' - '../../phpstan.neon' jobs: From e492c0ec2923273668f201ce89e963a410d00a91 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:53:42 +0100 Subject: [PATCH 15/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 26c3009..d83cd23 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,9 +2,6 @@ name: PHPStan on: push: - paths: -# - '**.php' - - '../../phpstan.neon' jobs: phpstan: From 1d5b01ba372ea41aa97d576c172652710fd5bfeb Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:57:58 +0100 Subject: [PATCH 16/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index d83cd23..f07b18c 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,6 +2,8 @@ name: PHPStan on: push: + paths: + - 'phpstan.neon' jobs: phpstan: From d22801b7f78ff5c4d537b22bd8d563777df1d82d Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:58:47 +0100 Subject: [PATCH 17/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- src/Models/PaymentWebhookLog.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Models/PaymentWebhookLog.php b/src/Models/PaymentWebhookLog.php index 911aeac..f060866 100644 --- a/src/Models/PaymentWebhookLog.php +++ b/src/Models/PaymentWebhookLog.php @@ -15,6 +15,10 @@ class PaymentWebhookLog extends Model 'request_headers' => 'array', 'request_body' => 'array', 'request_exception' => 'array', + + + + 'created_at' => 'datetime', ]; public static function storePaymentWebhook(PaymentWebhookConfig $config, Request $request, $requestHash): PaymentWebhookLog From 0c1d2f3a4c2a4a8ec03d7a8b6cdc1a2f66e4901f Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 16:59:52 +0100 Subject: [PATCH 18/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index f07b18c..8b19423 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -3,6 +3,7 @@ name: PHPStan on: push: paths: + - '**.php' - 'phpstan.neon' jobs: From f5fabf2f1d17a2c1104a8c72955415cf371cf1c9 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:01:22 +0100 Subject: [PATCH 19/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 3 --- .gitignore | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 8b19423..d83cd23 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,9 +2,6 @@ name: PHPStan on: push: - paths: - - '**.php' - - 'phpstan.neon' jobs: phpstan: diff --git a/.gitignore b/.gitignore index 818cfd7..285f062 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ build composer.lock coverage phpunit.xml -phpstan.neon +phpstan.neon.dist testbench.yaml vendor node_modules From d762c5f88b5f223af38ab0fdb82ad230fc11f332 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:02:58 +0100 Subject: [PATCH 20/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index d83cd23..c47c20a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -20,4 +20,4 @@ jobs: uses: ramsey/composer-install@v3 - name: Run PHPStan - run: ./vendor/bin/phpstan analyse --error-format=github + run: ./vendor/bin/phpstan --error-format=github From a1584e15baf3fd5d10b53895b146e1b54ca58a3a Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:04:19 +0100 Subject: [PATCH 21/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .github/workflows/phpstan.yml | 3 +++ src/Models/PaymentWebhookLog.php | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c47c20a..3855a08 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,6 +2,9 @@ name: PHPStan on: push: + paths: + - '**.php' + - 'phpstan.neon.dist' jobs: phpstan: diff --git a/src/Models/PaymentWebhookLog.php b/src/Models/PaymentWebhookLog.php index f060866..911aeac 100644 --- a/src/Models/PaymentWebhookLog.php +++ b/src/Models/PaymentWebhookLog.php @@ -15,10 +15,6 @@ class PaymentWebhookLog extends Model 'request_headers' => 'array', 'request_body' => 'array', 'request_exception' => 'array', - - - - 'created_at' => 'datetime', ]; public static function storePaymentWebhook(PaymentWebhookConfig $config, Request $request, $requestHash): PaymentWebhookLog From 8c052b02591b242d6cd6a144abaa881f9be8d54a Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:07:25 +0100 Subject: [PATCH 22/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 285f062..1964297 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ build composer.lock coverage phpunit.xml -phpstan.neon.dist testbench.yaml vendor node_modules From 95f068e4889bbf14fd5ccb520984d0cba2dd313f Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:07:38 +0100 Subject: [PATCH 23/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- phpstan.neon.dist | 12 ++++++++++++ src/Abstracts/BaseGateWay.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..9f85c1e --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,12 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 4 + paths: + - src + - config + - database + tmpDir: build/phpstan + checkOctaneCompatibility: true + checkModelProperties: true diff --git a/src/Abstracts/BaseGateWay.php b/src/Abstracts/BaseGateWay.php index a783a36..5a4354f 100644 --- a/src/Abstracts/BaseGateWay.php +++ b/src/Abstracts/BaseGateWay.php @@ -85,7 +85,7 @@ public function getResponse(): array */ public function getData(): array { - return $this->getResponse()['data']; + return $this->getResponse(); } /* Instantiate the http client wrapper class to make it available to the gateway classes From c175e9c1739e1b689b72b716402000b14d7f2d77 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:08:49 +0100 Subject: [PATCH 24/27] refactor: remove unnecessary phpstan ignore comment and update phpstan configuration path --- src/Abstracts/BaseGateWay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Abstracts/BaseGateWay.php b/src/Abstracts/BaseGateWay.php index 5a4354f..a783a36 100644 --- a/src/Abstracts/BaseGateWay.php +++ b/src/Abstracts/BaseGateWay.php @@ -85,7 +85,7 @@ public function getResponse(): array */ public function getData(): array { - return $this->getResponse(); + return $this->getResponse()['data']; } /* Instantiate the http client wrapper class to make it available to the gateway classes From eb09233ff2a8897d22d0b3625a0870947e3e8af4 Mon Sep 17 00:00:00 2001 From: MusahMusah <51837314+MusahMusah@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:09:12 +0000 Subject: [PATCH 25/27] Fix styling --- src/Events/PaymentWebhookReceivedEvent.php | 4 +- .../InvalidConfigurationException.php | 4 +- src/Jobs/ProcessPaymentWebhookJob.php | 4 +- ...velMultipaymentGatewaysServiceProvider.php | 2 +- src/Services/HttpClientWrapper.php | 4 +- src/Traits/Paystack/TransactionTrait.php | 2 +- tests/Paystack/PaystackTest.php | 48 +++++++++---------- 7 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/Events/PaymentWebhookReceivedEvent.php b/src/Events/PaymentWebhookReceivedEvent.php index ad00d50..0ad74df 100644 --- a/src/Events/PaymentWebhookReceivedEvent.php +++ b/src/Events/PaymentWebhookReceivedEvent.php @@ -16,9 +16,7 @@ class PaymentWebhookReceivedEvent * * @return void */ - public function __construct(public $webhookPayload) - { - } + public function __construct(public $webhookPayload) {} /** * Get the channels the event should broadcast on. diff --git a/src/Exceptions/InvalidConfigurationException.php b/src/Exceptions/InvalidConfigurationException.php index 77caf71..95e950b 100644 --- a/src/Exceptions/InvalidConfigurationException.php +++ b/src/Exceptions/InvalidConfigurationException.php @@ -4,6 +4,4 @@ use Exception; -class InvalidConfigurationException extends Exception -{ -} +class InvalidConfigurationException extends Exception {} diff --git a/src/Jobs/ProcessPaymentWebhookJob.php b/src/Jobs/ProcessPaymentWebhookJob.php index 60f5661..b29c58b 100644 --- a/src/Jobs/ProcessPaymentWebhookJob.php +++ b/src/Jobs/ProcessPaymentWebhookJob.php @@ -17,7 +17,5 @@ class ProcessPaymentWebhookJob implements ShouldQueue * * @return void */ - public function __construct(public $webhookPayload) - { - } + public function __construct(public $webhookPayload) {} } diff --git a/src/LaravelMultipaymentGatewaysServiceProvider.php b/src/LaravelMultipaymentGatewaysServiceProvider.php index 062470e..62e789e 100644 --- a/src/LaravelMultipaymentGatewaysServiceProvider.php +++ b/src/LaravelMultipaymentGatewaysServiceProvider.php @@ -63,7 +63,7 @@ private function registerWebHookRoute() private function registerWebHookBindings() { $this->app->scoped(PaymentWebhookConfigRepository::class, function () { - $configRepository = new PaymentWebhookConfigRepository(); + $configRepository = new PaymentWebhookConfigRepository; $webhookConfigs = config('multipayment-gateways.webhooks'); collect($webhookConfigs) diff --git a/src/Services/HttpClientWrapper.php b/src/Services/HttpClientWrapper.php index 75afec4..5b194cf 100644 --- a/src/Services/HttpClientWrapper.php +++ b/src/Services/HttpClientWrapper.php @@ -9,9 +9,7 @@ class HttpClientWrapper implements HttpClientWrapperContract { use ConsumesExternalServices; - public function __construct(protected $baseUri, protected $secret) - { - } + public function __construct(protected $baseUri, protected $secret) {} /** * Send a GET request to the payment gateway diff --git a/src/Traits/Paystack/TransactionTrait.php b/src/Traits/Paystack/TransactionTrait.php index 3eb4daf..85c9511 100644 --- a/src/Traits/Paystack/TransactionTrait.php +++ b/src/Traits/Paystack/TransactionTrait.php @@ -90,7 +90,7 @@ private function validateTransaction(): void $this->verifyTransaction(reference: request()->reference ?? request()->trxref); if ($this->getData()['status'] !== 'success') { - throw new PaymentVerificationException(); + throw new PaymentVerificationException; } } diff --git a/tests/Paystack/PaystackTest.php b/tests/Paystack/PaystackTest.php index c20e52d..3da7a0f 100644 --- a/tests/Paystack/PaystackTest.php +++ b/tests/Paystack/PaystackTest.php @@ -86,7 +86,7 @@ ]); }); -//it('can make fake http request to get list of banks', function () { +// it('can make fake http request to get list of banks', function () { // $body = file_get_contents(__DIR__.'/Fixtures/banks.json'); // // Http::fake([ @@ -94,33 +94,33 @@ // ]); // // // assert if there is a bank with name "Abbey Mortgage Bank" in the list of banks -//// $body = +// // $body = // // -//// expect(json_decode($body, true)['data']) -//// ->toBeArray() -////// ->dd() -//// ->toContain(fn ($bank) => $bank['name'] === 'Abbey Mortgage Bank'); +// // expect(json_decode($body, true)['data']) +// // ->toBeArray() +// //// ->dd() +// // ->toContain(fn ($bank) => $bank['name'] === 'Abbey Mortgage Bank'); // -//// expect( -//// collect(json_decode($body, true)['data']) -//// ->where('name', 'Abbey Mortgage Bank') -//// ->isNotEmpty() -//// ) -//// ->toBeTrue(); +// // expect( +// // collect(json_decode($body, true)['data']) +// // ->where('name', 'Abbey Mortgage Bank') +// // ->isNotEmpty() +// // ) +// // ->toBeTrue(); // // // -//// expect($body) -//// ->toBeString() -//// ->toContain('Abbey Mortgage Bank'); +// // expect($body) +// // ->toBeString() +// // ->toContain('Abbey Mortgage Bank'); // -//// expect(json_decode($body, true)) -//// ->toBeArray() -//// ->toHaveKeys([ -//// 'status', -//// 'message', -//// 'data', -//// ]) -//// ->toContain('data'); -//}); +// // expect(json_decode($body, true)) +// // ->toBeArray() +// // ->toHaveKeys([ +// // 'status', +// // 'message', +// // 'data', +// // ]) +// // ->toContain('data'); +// }); From 3e6b4a954b0e14911a016f685fe07960151a9c90 Mon Sep 17 00:00:00 2001 From: MusahMusah Date: Sun, 15 Jun 2025 17:22:04 +0100 Subject: [PATCH 26/27] refactor: simplify PaystackTest by removing commented-out code and improving HTTP fake request --- tests/Paystack/PaystackTest.php | 53 ++++++++++----------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/tests/Paystack/PaystackTest.php b/tests/Paystack/PaystackTest.php index c20e52d..53090c4 100644 --- a/tests/Paystack/PaystackTest.php +++ b/tests/Paystack/PaystackTest.php @@ -86,41 +86,18 @@ ]); }); -//it('can make fake http request to get list of banks', function () { -// $body = file_get_contents(__DIR__.'/Fixtures/banks.json'); -// -// Http::fake([ -// 'https://api.paystack.co/bank' => Http::response($body, 200), -// ]); -// -// // assert if there is a bank with name "Abbey Mortgage Bank" in the list of banks -//// $body = -// -// -//// expect(json_decode($body, true)['data']) -//// ->toBeArray() -////// ->dd() -//// ->toContain(fn ($bank) => $bank['name'] === 'Abbey Mortgage Bank'); -// -//// expect( -//// collect(json_decode($body, true)['data']) -//// ->where('name', 'Abbey Mortgage Bank') -//// ->isNotEmpty() -//// ) -//// ->toBeTrue(); -// -// -// -//// expect($body) -//// ->toBeString() -//// ->toContain('Abbey Mortgage Bank'); -// -//// expect(json_decode($body, true)) -//// ->toBeArray() -//// ->toHaveKeys([ -//// 'status', -//// 'message', -//// 'data', -//// ]) -//// ->toContain('data'); -//}); +it('can make fake http request to get list of banks', function () { + $body = file_get_contents(__DIR__ . '/../Fixtures/banks.json'); + + Http::fake([ + 'https://api.paystack.co/bank' => Http::response($body), + ]); + + expect(json_decode($body, true)) + ->toBeArray() + ->toHaveKeys([ + 'status', + 'message', + 'data', + ]); +}); From a77a8da12de941a49d3eed4a19061989caf72ae8 Mon Sep 17 00:00:00 2001 From: MusahMusah <51837314+MusahMusah@users.noreply.github.com> Date: Sun, 15 Jun 2025 16:23:03 +0000 Subject: [PATCH 27/27] Fix styling --- tests/Paystack/PaystackTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Paystack/PaystackTest.php b/tests/Paystack/PaystackTest.php index 53090c4..92a1625 100644 --- a/tests/Paystack/PaystackTest.php +++ b/tests/Paystack/PaystackTest.php @@ -87,7 +87,7 @@ }); it('can make fake http request to get list of banks', function () { - $body = file_get_contents(__DIR__ . '/../Fixtures/banks.json'); + $body = file_get_contents(__DIR__.'/../Fixtures/banks.json'); Http::fake([ 'https://api.paystack.co/bank' => Http::response($body),