gamevault / lunar-pensopay
A Lunar community payment driver for Pensopay
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- lunarphp/lunar: 0.2-rc2
- spatie/laravel-package-tools: ^1.14.0
- spatie/laravel-webhook-client: ^3.1
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- dev-main
- dev-renovate/orchestra-testbench-10.x
- dev-renovate/major-illuminate
- dev-renovate/major-phpstan-packages
- dev-renovate/lunarphp-lunar-0.x
- dev-renovate/pestphp-pest-3.x
- dev-renovate/pestphp-pest-plugin-laravel-3.x
- dev-renovate/orchestra-testbench-9.x
- dev-renovate/aglipanci-laravel-pint-action-2.x
- dev-renovate/nunomaduro-collision-8.x
- dev-renovate/actions-checkout-4.x
- dev-renovate/stefanzweifel-git-auto-commit-action-5.x
This package is auto-updated.
Last update: 2025-02-24 18:42:29 UTC
README
Easily integrate Pensopay into Lunar with the community payment driver for Pensopay. This integration are based on PensoPay API docs
ToDo
There is still some minor stuff to take into consideration
- Defining success_url, cancel_url and callback_url urls with id params in the urls.
- Dynamic selection of facilitator (payment types: creditcard, viabill, expressbank, paypal and anyday).
- Tests.
Installation
You can install the package via composer:
composer require gamevault/lunar-pensopay
This package uses the spatie laravel-webhook-client package to handle the callbacks sent from Pensopay.
You can publish the configs and run the migrations with:
php artisan vendor:publish --tag="lunar-pensopay-config" php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config" php artisan migrate
This is the contents of the published pensopay config file:
return [ 'policy' => env('AUTO_CAPTURE', false), 'url' => env('PENSOPAY_URL', 'https://api.pensopay.com/v1'), 'token' => env('PENSOPAY_TOKEN'), 'testmode' => env('PENSOPAY_TESTMODE', false), ];
The webhook-client.php should look like the following:
<?php return [ 'configs' => [ [ 'name' => 'pensopay-webhook', 'signing_secret' => config('PENSOPAY_SIGNING_SECRET'), 'signature_header_name' => 'pensopay-signature', 'signature_validator' => \Spatie\WebhookClient\SignatureValidator\DefaultSignatureValidator::class, 'webhook_profile' => \Spatie\WebhookClient\WebhookProfile\ProcessEverythingWebhookProfile::class, 'webhook_response' => \Spatie\WebhookClient\WebhookResponse\DefaultRespondsTo::class, 'webhook_model' => \Spatie\WebhookClient\Models\WebhookCall::class, 'process_webhook_job' => \Gamevault\Pensopay\Jobs\ProcessPensopayCallbackJob::class, ], ], /* * The integer amount of days after which models should be deleted. * * 7 deletes all records after 1 week. Set to null if no models should be deleted. */ 'delete_after_days' => 30, ];
The webhook endpoint can be defined anywhere in the route files with the following:
Route::webhooks('pensopay-webhook', 'pensopay-webhook');
Usage
To get started, the payment driver must be registered at the AppServiceProvider:
public function register() { Payments::extend('pensopay', function ($app) { return $app->make(\Gamevault\Pensopay\PensopayPaymentType::class); }); }
The payment methods can be invoked like the following:
/** @var Pensopay $paymentDriver */ $paymentDriver = Payments::driver('pensopay'); $paymentDriver->cart($cart); $paymentAuthorize = $paymentDriver->authorize();
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.