定制 gamevault/lunar-pensopay 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gamevault/lunar-pensopay

Composer 安装命令:

composer require gamevault/lunar-pensopay

包简介

A Lunar community payment driver for Pensopay

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-20