nekoding/gmo-payment-gateway

用于laravel项目的简单包,用于交互GMOPG API

v1.2.0 2022-04-08 06:17 UTC

This package is auto-updated.

Last update: 2024-09-05 02:09:47 UTC


README

Latest Version on Packagist Total Downloads

用于laravel项目的简单包,用于交互GMOPG API

安装

您可以通过composer安装此包

composer require nekoding/gmo-payment-gateway

使用以下命令发布配置文件

php artisan vendor:publish --provider="Nekoding\GmoPaymentGateway\GmoPaymentGatewayServiceProvider"

用法

// Usage description here
// via GmoPaymentGateway Class

$gmo = new \Nekoding\GmoPaymentGateway\GmoPaymentGateway();

// if you want interact with GMO Site API use this
$siteApi = $gmo->useSiteApi();

// if you want interact with GMO Shop API use this
$shopApi = $gmo->useShopApi();

// Or you can use facade like this too
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::useShopApi();
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::useSiteApi();
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::creditCard();

// If you want execution CreditCard EntryTran and CreditCard ExecTran at once 
// You can use CreditCard entryTransaction callback like this
use Nekoding\GmoPaymentGateway\Contracts\Shop\CreditCard\Basic;
use \Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade;

$data = ['OrderID' => uniqid(), 'JobCd' => 'AUTH', 'Amount' => 1000, 'Method' => '', 'Token' => ''];
$response = GmoPaymentGatewayFacade::creditCard()
            ->entryTransaction($data, function (Basic $gmo) use (&$data) {
                return $gmo->execTransaction($data);
            });

$response->getResult(); // it will return response from entry transaction and exec transaction process

// example response :
[
  "ACS" => "0"
  "OrderID" => "xxxx"
  "Forward" => "xxx"
  "Method" => "1"
  "PayTimes" => ""
  "Approve" => "xxx"
  "TranID" => "xxxx"
  "TranDate" => "xxxxx"
  "CheckString" => "xxxxx",
  "AccessID" => "xxxxx",
  "AccessPass" => "xxxx"
]

配置

您可以通过.env文件或config/config.php文件更改API凭证

支持的API

  • SiteAPI
  • ShopAPI - 信用卡支付

测试

composer test

变更日志

请参阅CHANGELOG以获取更多最近更改的信息。

贡献

请参阅CONTRIBUTING以获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过enggartivandi@outlook.com发送电子邮件,而不是使用问题跟踪器。

鸣谢

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。

Laravel Package Boilerplate

此包是使用Laravel Package Boilerplate生成的。