aries / gateway
用于连接所有伊朗支付网关的Laravel包
v0.1.3
2017-11-13 04:59 UTC
Requires
- aries/laravelsetting: *
- nesbot/carbon: ~1.20
This package is auto-updated.
Last update: 2024-09-29 05:01:34 UTC
README
通过此包,我们能够通过一个独特的API连接到所有伊朗银行。
可用银行
- MELLAT
- SADAD (MELLI)
- SAMAN
- PARSIAN
- PASARGAD
- ZARINPAL
JAHANPAY(已禁用)PAYLINE(已禁用)
安装:
在您的终端运行以下语句
步骤1
composer require aries/gateway
步骤2:在config/app.php中添加provider和facade
'providers' => [
...
Aries\Gateway\GatewayServiceProvider::class, // <-- add this line at the end of provider array
],
'aliases' => [
...
'Gateway' => Aries\Gateway\Gateway::class, // <-- add this line at the end of aliases array
]
步骤3
php artisan vendor:publish --provider=Aries\Gateway\GatewayServiceProvider
步骤4
php artisan migrate
重要
您需要在config/app.php文件中添加Aries/LaravelSetting的ServiceProvider和Facade
使用方法
您可以通过多种方式连接到银行(外观、服务容器)
try {
$gateway = \Gateway::make(new \Mellat());
// $gateway->setCallback(url('/path/to/calback/route')); You can also change the callback
$gateway->price(1000)->ready();
$refId = $gateway->refId();
$transID = $gateway->transactionId();
// Your code here
return $gateway->redirect();
} catch (Exception $e) {
echo $e->getMessage();
}
您可以通过以下方式调用网关
- Gateway::make(new Mellat());
- Gateway::mellat();
- app('gateway')>make(new Mellat());
- app('gateway')>mellat();
除了MELLAT,您还可以输入我们上面介绍的其他银行的名称。
在price方法中,您应该以IRR(里亚尔)为单位输入价格
并在您的回调中
try {
$gateway = \Gateway::verify();
$trackingCode = $gateway->trackingCode();
$refId = $gateway->refId();
$cardNumber = $gateway->cardNumber();
// Your code here
} catch (Exception $e) {
echo $e->getMessage();
}
如果您有兴趣开发此包,您可以通过以下方式帮助我们
- 改进文档。
- 报告问题或bug。
- 在编写代码和其他银行模块方面进行合作。
此包基于PoolPort扩展,但我们已更改了一些功能并进行了改进。
来自larabook/gateway的分支