alegra/omnipay-masterpass
Composer 安装命令:
composer require alegra/omnipay-masterpass
包简介
Masterpass gateway for Omnipay payment processing library
README 文档
README
MasterPass Domestic Integration ( Türkiye ) gateway for Omnipay V3 payment processing libraryOmnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.3+. This package implements MasterPass Online Payment Gateway support for Omnipay.
- You have to contact the MasterPass for the document.
- You need to macKey,encKey,merchantId. You can take them from MasterPass.
Requirement
- PHP >= 7.3.x,
- Omnipay V.3 repository,
- PHPUnit to run tests
Autoload
You have to install omnipay V.3
composer require league/omnipay:^3
Then you have to install omnipay-payu package:
composer require alegra/omnipay-masterpass
payment-masterpassfollows the PSR-4 convention names for its classes, which means you can easily integratepayment-masterpassclasses loading in your own autoloader.
Basic Usage
- You can use /examples folder to execute examples. This folder is exists here only to show you examples, it is not for production usage.
- First in /examples folder:
composer install
Authorize Example
- You can check authorize.php file in /examples folder.
- This method get token. You have to use token in all requests
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getAuthorizeParams(); $response = $gateway->authorize($params)->send(); $result = [ 'status' => $response->isSuccessful() ?: 0, 'token' => $response->getToken(), 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
Purchase Example
- You can check purchase.php file in /examples folder.
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\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, 'message' => $response->getMessage(), 'requestParams' => $response->getServiceRequestParams(), 'response' => $response->getData() ]; print("<pre>" . print_r($result, true) . "</pre>"); } catch (Exception $e) { throw new \RuntimeException($e->getMessage()); }
Purchase 3d Example
- You can check purchase3d.php file in /examples folder.
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPurchase3dParams(); $response = $gateway->purchase($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()); }
payU Purchase Example
- You can check payUPurchase.php file in /examples folder.
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPayUPurchaseParams(); $response = $gateway->purchase($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()); }
payU Purchase 3d Example
- You can check payUPurchase3d.php file in /examples folder.
- This method does hash check.
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Examples\\', __DIR__); use Omnipay\Masterpass\Gateway; use Examples\Helper; $gateway = new Gateway(); $helper = new Helper(); try { $params = $helper->getPayUPurchase3dParams(); $response = $gateway->purchase($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()); }
requestParams:
System send request to payU api. It shows request information.
Licensing
GNU General Public Licence v3.0
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
alegra/omnipay-masterpass 适用场景与选型建议
alegra/omnipay-masterpass 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 248 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alegra/omnipay-masterpass 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alegra/omnipay-masterpass 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 248
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-01