nxmad / larapay
此包已被废弃,不再维护。未建议替代包。
强大的多网关支付处理库,旨在让Laravel 5的使用更加便捷
1.0.0-rc.2
2019-06-04 22:24 UTC
Requires
- php: ^7.0
- ext-json: *
- illuminate/config: ^5.0
- illuminate/database: ^5.0
- illuminate/http: ^5.0
- illuminate/support: ^5.0
Requires (Dev)
- mockery/mockery: ^1.2
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2021-03-31 15:39:05 UTC
README
Larapay — 一个强大的Laravel扩展,具有2个核心功能:1)任何支付网关的抽象接口;2)用户会计系统。
安装
此包可以作为 Composer 依赖安装。
$ composer require nxmad/larapay
如果您不使用自动发现(或您的Laravel版本 < 5.5),请将 ServiceProvider 添加到 config/app.php
中的 providers
数组
Nxmad\Larapay\LarapayServiceProvider::class,
发布默认配置文件 larapay.php
$ php artisan vendor:publish
使用示例
// Setup transaction for user // Actually, you can use any Entity (Model) instead of User // Transaction can have positive and negative amount $transaction = $request->user()->setup(- $amount, $description); // Check if the user can afford this order if ($transaction->affordable() || $request->user()->canAfford($transaction)) { // do some logic... // and then save the transaction as sucessfull // this way: $transaction->makeSuccessful(); // or this way: $transaction(Transaction::STATE_SUCCESSFUL); } else { // Otherwise redirect user to the payment gateway (for .e.g) $gateway = payments('paypal'); // There are 3 ways of interact with payment gateway: // Redirect (GET), POST form and any custom behavior you can define by yourself return $gateway->interact($transaction); }
请参阅 Wiki 了解更多示例。
支持的网关
您可以通过创建 问题 将您的网关实现添加到此列表中。
网关 | Composer 包 | 维护者 |
---|---|---|
Unitpay | nxmad/larapay-unitpay | Alex Balatsky |
WebMoney | nxmad/larapay-webmoney | Alex Balatsky |
Qiwi.com P2P | nxmad/larapay-qiwi-p2p | Alex Balatsky |
Yandex.Money P2P | nxmad/larapay-yandex-money-p2p | Alex Balatsky |
测试
自1.0版起
$ composer test
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅 许可证文件。