Skip to content

Laravel 12 #29

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e76a964
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
4129b8e
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
c3825dd
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
3577b0b
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
3a88cf6
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
34fb9ca
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
0f1d86b
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
7057f7a
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
e1f7aad
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
4e764ea
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
8670f1d
refactor: update dependencies for Laravel 12 compatibility
MusahMusah Jun 15, 2025
3b06b9f
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
5a71b69
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
078ed6b
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
e492c0e
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
1d5b01b
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
d22801b
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
0c1d2f3
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
f5fabf2
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
d762c5f
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
a1584e1
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
8c052b0
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
95f068e
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
c175e9c
refactor: remove unnecessary phpstan ignore comment and update phpsta…
MusahMusah Jun 15, 2025
eb09233
Fix styling
MusahMusah Jun 15, 2025
3e6b4a9
refactor: simplify PaystackTest by removing commented-out code and im…
MusahMusah Jun 15, 2025
2aecd08
Merge remote-tracking branch 'origin/bump/laravel-12' into bump/larav…
MusahMusah Jun 15, 2025
a77a8da
Fix styling
MusahMusah Jun 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,48 @@ 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
carbon: ^2.63
- laravel: 9.*
testbench: ^7.0
carbon: ^2.63
- laravel: 8.*
testbench: ^6.23
carbon: ^2.63
- laravel: 9.*
testbench: ^7.0
- laravel: 10.*
testbench: ^8.0
- laravel: 11.*
testbench: ^9.0
- laravel: 12.*
testbench: 10.*
exclude:
- laravel: 8.*
php: 8.3
- laravel: 8.*
php: 8.4
- laravel: 9.*
php: 8.4
- laravel: 10.*
php: 8.0
- laravel: 10.*
php: 8.4
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 8.*
php: 8.3
- laravel: 11.*
php: 8.4
- laravel: 12.*
php: 8.0
- laravel: 12.*
php: 8.1

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

Expand All @@ -59,7 +72,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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build
composer.lock
coverage
phpunit.xml
phpstan.neon
testbench.yaml
vendor
node_modules
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@
"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",
"laravel/pint": "^1.0|^1.14",
"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",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5|^10.4"
"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",
"phpstan/extension-installer": "^1.3|^2.0",
"phpstan/phpstan-deprecation-rules": "^1.1|^2.0"
},
"autoload": {
"files": [
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ parameters:
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false

4 changes: 1 addition & 3 deletions src/Events/PaymentWebhookReceivedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/Exceptions/InvalidConfigurationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class InvalidConfigurationException extends Exception
{
}
class InvalidConfigurationException extends Exception {}
4 changes: 1 addition & 3 deletions src/Jobs/ProcessPaymentWebhookJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ class ProcessPaymentWebhookJob implements ShouldQueue
*
* @return void
*/
public function __construct(public $webhookPayload)
{
}
public function __construct(public $webhookPayload) {}
}
2 changes: 1 addition & 1 deletion src/LaravelMultipaymentGatewaysServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/Models/PaymentWebhookLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/Services/HttpClientWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Paystack/TransactionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
53 changes: 15 additions & 38 deletions tests/Paystack/PaystackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
});