Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Mar 1, 2024
1 parent 4067b0e commit 6dbb3b4
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 578 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

Expand All @@ -22,6 +22,6 @@ jobs:
run: pint

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
18 changes: 8 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
tests:
Expand All @@ -13,21 +13,19 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['8.0', '8.1', '8.2', '8.3']
laravel: ['9.0', '10.0', '11.0']
php: ["8.1", "8.2", "8.3"]
laravel: ["10.0", "11.0"]
exclude:
- laravel: '10.0'
php: '8.0'
- laravel: '11.0'
php: '8.0'
- laravel: '11.0'
php: '8.1'
- laravel: "11.0"
php: "8.0"
- laravel: "11.0"
php: "8.1"

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

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ For your convencience we've added the global `mollie()` helper function. It's an
```php
// Using facade accessor
$payment = \Mollie\Laravel\Facades\Mollie::api()->payments->get($payment_id);

// Using global helper function
$payment = mollie()->payments->get($payment_id);
```

## Other examples
Expand Down
169 changes: 83 additions & 86 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,85 @@
{
"name": "mollie/laravel-mollie",
"description": "Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite",
"homepage": "https://github.com/mollie/laravel-mollie",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Mollie B.V.",
"email": "[email protected]"
}
],
"keywords": [
"mollie",
"payment",
"service",
"ideal",
"creditcard",
"apple pay",
"mistercash",
"bancontact",
"sofort",
"sofortbanking",
"sepa",
"paypal",
"paysafecard",
"podiumcadeaukaart",
"banktransfer",
"direct debit",
"belfius",
"belfius direct net",
"przelewy24",
"refunds",
"api",
"payments",
"gateway",
"subscriptions",
"recurring",
"charges",
"laravel",
"lumen",
"socialite"
],
"require": {
"php": "^8.0",
"mollie/mollie-api-php": "^2.60",
"illuminate/support": "^9.0|^10.0|^11.0",
"ext-json": "*"
},
"require-dev": {
"mockery/mockery": "^1.4",
"orchestra/testbench": "^7.18|^8.0|^9.0",
"phpunit/phpunit": "^9.0|^10.0",
"laravel/socialite": "^5.5",
"laravel/pint": "^1.1"
},
"suggest": {
"laravel/socialite": "Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints."
},
"autoload": {
"psr-4": {
"Mollie\\Laravel\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Mollie\\Laravel\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Mollie\\Laravel\\MollieServiceProvider"
],
"aliases": {
"Mollie": "Mollie\\Laravel\\Facades\\Mollie"
}
}
},
"scripts": {
"test": "./vendor/bin/phpunit tests",
"format": "./vendor/bin/pint"
},
"minimum-stability": "dev",
"prefer-stable": true
"name": "mollie/laravel-mollie",
"description": "Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite",
"homepage": "https://github.com/mollie/laravel-mollie",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Mollie B.V.",
"email": "[email protected]"
}
],
"keywords": [
"mollie",
"payment",
"service",
"ideal",
"creditcard",
"apple pay",
"mistercash",
"bancontact",
"sofort",
"sofortbanking",
"sepa",
"paypal",
"paysafecard",
"podiumcadeaukaart",
"banktransfer",
"direct debit",
"belfius",
"belfius direct net",
"przelewy24",
"refunds",
"api",
"payments",
"gateway",
"subscriptions",
"recurring",
"charges",
"laravel",
"lumen",
"socialite"
],
"require": {
"php": "^8.1|^8.2",
"mollie/mollie-api-php": "^2.60",
"illuminate/support": "^10.0|^11.0",
"ext-json": "*"
},
"require-dev": {
"mockery/mockery": "^1.4",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.0",
"laravel/socialite": "^5.5",
"laravel/pint": "^1.1"
},
"suggest": {
"laravel/socialite": "Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints."
},
"autoload": {
"psr-4": {
"Mollie\\Laravel\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Mollie\\Laravel\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Mollie\\Laravel\\MollieServiceProvider"
],
"aliases": {
"Mollie": "Mollie\\Laravel\\Facades\\Mollie"
}
}
},
"scripts": {
"test": "./vendor/bin/phpunit tests",
"format": "./vendor/bin/pint"
},
"minimum-stability": "dev",
"prefer-stable": true
}
4 changes: 3 additions & 1 deletion src/Facades/Mollie.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2016, Mollie B.V.
* All rights reserved.
Expand Down Expand Up @@ -34,6 +35,7 @@
namespace Mollie\Laravel\Facades;

use Illuminate\Support\Facades\Facade;
use Mollie\Laravel\MollieManager;
use Mollie\Laravel\Wrappers\MollieApiWrapper;

/**
Expand All @@ -50,6 +52,6 @@ class Mollie extends Facade
*/
protected static function getFacadeAccessor()
{
return 'mollie';
return MollieManager::class;
}
}
4 changes: 3 additions & 1 deletion src/MollieManager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2016, Mollie B.V.
* All rights reserved.
Expand Down Expand Up @@ -34,6 +35,7 @@
namespace Mollie\Laravel;

use Illuminate\Contracts\Container\Container;
use Mollie\Laravel\Wrappers\MollieApiWrapper;

/**
* Class MollieManager.
Expand All @@ -60,6 +62,6 @@ public function __construct(Container $app)
*/
public function api()
{
return $this->app['mollie.api'];
return $this->app->make(MollieApiWrapper::class);
}
}
80 changes: 14 additions & 66 deletions src/MollieServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2016, Mollie B.V.
* All rights reserved.
Expand Down Expand Up @@ -45,7 +46,7 @@
*/
class MollieServiceProvider extends ServiceProvider
{
const PACKAGE_VERSION = '2.25.0';
const PACKAGE_VERSION = '3.0.0';

/**
* Boot the service provider.
Expand All @@ -65,7 +66,7 @@ public function boot()
*/
protected function setupConfig()
{
$source = realpath(__DIR__.'/../config/mollie.php');
$source = realpath(__DIR__ . '/../config/mollie.php');

// Check if the application is a Laravel OR Lumen instance to properly merge the configuration file.
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
Expand All @@ -84,8 +85,8 @@ protected function setupConfig()
*/
protected function extendSocialite()
{
if (interface_exists('Laravel\Socialite\Contracts\Factory')) {
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
if (interface_exists($socialiteFactoryClass = \Laravel\Socialite\Contracts\Factory::class)) {
$socialite = $this->app->make($socialiteFactoryClass);

$socialite->extend('mollie', function (Container $app) use ($socialite) {
$config = $app['config']['services.mollie'];
Expand All @@ -102,67 +103,14 @@ protected function extendSocialite()
*/
public function register()
{
$this->registerApiClient();
$this->registerApiAdapter();
$this->registerManager();
}

/**
* Register the Mollie API adapter class.
*
* @return void
*/
protected function registerApiAdapter()
{
$this->app->singleton('mollie.api', function (Container $app) {
$config = $app['config'];

return new MollieApiWrapper($config, $app['mollie.api.client']);
});

$this->app->alias('mollie.api', MollieApiWrapper::class);
}

/**
* Register the Mollie API Client.
*
* @return void
*/
protected function registerApiClient()
{
$this->app->singleton('mollie.api.client', function () {
return (new MollieApiClient(new MollieLaravelHttpClientAdapter))
->addVersionString('MollieLaravel/'.self::PACKAGE_VERSION);
});

$this->app->alias('mollie.api.client', MollieApiClient::class);
}

/**
* Register the manager class.
*
* @return void
*/
public function registerManager()
{
$this->app->singleton('mollie', function (Container $app) {
return new MollieManager($app);
});

$this->app->alias('mollie', MollieManager::class);
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [
'mollie',
'mollie.api',
'mollie.api.client',
];
$this->app->singleton(MollieManager::class);
$this->app->singleton(MollieApiWrapper::class);
$this->app->singleton(
MollieApiClient::class,
function () {
return (new MollieApiClient(new MollieLaravelHttpClientAdapter))
->addVersionString('MollieLaravel/' . self::PACKAGE_VERSION);
}
);
}
}
Loading

0 comments on commit 6dbb3b4

Please sign in to comment.