alegra / omnipay-mobilexpress
适用于 Omnipay 支付处理库的 Mobilexpress 网关
v0.0.3
2021-05-29 03:06 UTC
Requires
- php: ^7.3
- ext-dom: *
- ext-json: *
- ext-simplexml: *
- ext-soap: *
- omnipay/common: ^3
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-29 05:30:41 UTC
README
适用于 Omnipay 支付处理库的 Mobilexpress 网关(Akbank, Alternatif Bank, Anadolu Bank, Deniz Bank, Finans Bank, Garanti, ING, Iyzico, İş Bankası, OdeaBank, Paratika, PayU, Şekerbank, Halkbank, ZiraatBank, TEB, VakıfBank, Türkiye Finans, YKB 虚拟 POS)
Omnipay 是一个与框架无关的、多网关的 PHP 7.3+ 支付处理库。本包实现了 Omnipay 对 Gvp 在线支付网关的支持。
- 您需要联系 Mobilexpress 获取文档。
- 您可以从 https://test.mobilexpress.com.tr/checkout/v7/FastCheckoutService.asmx 检查 mobilexpress 服务。
- 您可以从 https://test.mobilexpress.com.tr/icerik/id/1247/Test-Kartlar?v=1 检查测试卡。
要求
- PHP >= 7.3.x,
- Omnipay V.3 仓库,
- PHPUnit 运行测试
自动加载
您必须安装 Omnipay V.3
composer require league/omnipay:^3
然后您必须安装 omnipay-mobilexpress 包
composer require alegra/omnipay-mobilexpress
payment-mobilexpress
遵循 PSR-4 规范的类名,这意味着您可以将payment-mobilexpress
类的加载轻松集成到您自己的自动加载器中。
基本用法
- 您可以使用 /examples 文件夹来执行示例。该文件夹仅用于展示示例,不适合生产使用。
- 在 /examples 文件夹中首先
composer install
授权示例
- 您可以在 /examples 文件夹中查看 authorize.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getAuthorizeParams(); $response = $gateway->authorize($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'bankTransId' => $response->getTransactionReference(), 'mobileExpressTransId' => $response->getMobilExpressTransId(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
捕获示例
- 您可以在 /examples 文件夹中查看 capture.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getCaptureParams(); $response = $gateway->capture($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'bankTransId' => $response->getTransactionReference(), 'mobileExpressTransId' => $response->getMobilExpressTransId(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
购买示例
- 您可以在 /examples 文件夹中查看 purchase.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPurchaseParams(); $response = $gateway->purchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'bankTransId' => $response->getTransactionReference(), 'mobileExpressTransId' => $response->getMobilExpressTransId(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
3D 购买示例
- 您可以在 /examples 文件夹中查看 purchase3d.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPurchase3DParams(); $response3d = $gateway->purchase($params)->send(); $result = [ 'status' => $response3d->isSuccessful() ?: 0, 'redirect' => $response3d->isRedirect() ?: 0, 'redirectUrl' => $response3d->getRedirectUrl(), 'redirectData' => $response3d->getRedirectData(), 'redirectMethod' => $response3d->getRedirectMethod(), 'mobileExpressTransId' => $response3d->getMobilExpressTransId(), 'message' => $response3d->getMessage(), 'requestParams' => $response3d->getServiceRequestParams(), 'response' => $response3d->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
完成购买示例
- 您可以在 /examples 文件夹中查看 completePurchase.php 文件。
- 请求参数是从 3D 付款请求的结果中接收到的数据创建的。
- 您可以在 3dVerification.php 中查看。它是一个 3D 表单。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getCompletePurchaseParams(); $response = $gateway->completePurchase($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'bankTransId' => $response->getTransactionReference(), 'mobileExpressTransId' => $response->getMobilExpressTransId(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
退款示例
- 您可以在 /examples 文件夹中查看 refund.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getRefundParams(); $response = $gateway->refund($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
取消示例
- 您可以在 /examples 文件夹中查看 refund.php 文件。
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\MobilExpress\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getVoidParams(); $response = $gateway->void($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'redirect' => $response->isRedirect() ?: 0, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
请求参数
系统向 mobilexpress API 发送请求。它显示请求信息。
许可
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.