tecsin/yii2-voguepay
Composer 安装命令:
composer require tecsin/yii2-voguepay
包简介
A VoguePay Extension for Yii2 Framework
README 文档
README
Pay2
VoguePay Payment Processor Extension for Yii2 Framework (Command API is in beta). Pay2 is a Yii2 wrapper for VoguePay Payment Processor Mobile/Server-to-Server and Command Api. Mobile/Server-to-Server API let you get a link token for payment by sending your merchant ID and other necessary parameters.
Command API allows you to directly perfom several actions (fetch transactions details, pay a user, withdraw money to bank accounts, create a new user) on VoguePay from your application.
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist tecsin/yii2-voguepay "~2.0.0"
or add
"tecsin/yii2-voguepay": "~2.0.0"
to the require section of your composer.json file.
Usage
First set up the database by running the migration code :
php yii migrate --migrationPath="@vendor/tecsin/yii2-voguepay/migrations"
After which you should add pay2 to the modules section of your application component like
'components' => [ //... 'modules' => [ //... 'pay2' => [ 'class' => 'tecsin\pay2\Module', 'userModelClass' => 'app\models\User', 'controllerMap' => [ 'manage' => [ 'class' => 'yii2mod\comments\controllers\ManageController', 'layout' => '@app/modules/admin/views/layouts/main', 'accessControlConfig' => [ 'class' => 'yii\filters\AccessControl', 'rules' => [ [ 'allow' => true, 'roles' => ['admin', 'manager'], ], ], ], ], ], ], ], ],
and setup your VoguePay details via project.com/pay2.
Notification and Pay Now Button
Get notifications from VoguePay and save data to db before sending user to voguepay.
<?php namespace app\controllers; class SiteController extends \yii\web\Controller { //... public function actions() { return [ //... 'voguepay-notification' => [ 'class' => 'tecsin\pay2\actions\Pay2NotificationAction', // see this class if you will change anything for better explanations 'modelClass' => 'tecsin\pay2\models\NotificationExample'//this is the default model to run for every notification 'method' => 'voguepay'//the method to be called in modelClass, and must have a parameter which should be an array of transaction from voguepay ], 'set-data' => [ 'class' => 'tecsin\pay2\actions\InitSaleAction', //redirects user to voguepay payment page after saving the pay now form data to db //this is mandatory if you use the PayButton widget ], ]; } }
Display pay now button
<?= tecsin\pay2\widgets\PayButton::widget() ?>
Mobile/Server-to-Server
You can either send user to VoguePay payment page directly (this is the default):
$MsModel = new \tecsin\pay2\models\VoguepayMs(['aaaMerchantId' => '11111', 'mmmMemo' => 'one sparklyn yellow wedding dress', 'tttTotalCost' => '200310', 'rrrMerchantRef' => time().mt_rand(0,999999999)]); if($MsModel->validate()){ return $MsModel->setRequest()->sendRequest()->sendResponse(); }
Or show the user a pay button (set showPayButton property to true):
$MsModel = new \tecsin\pay2\models\VoguepayMs(['aaaMerchantId' => '11111', 'mmmMemo' => 'one sparklyn yellow wedding dress', 'tttTotalCost' => '200310', 'rrrMerchantRef' => time().mt_rand(0,999999999), 'showPayButton' => true]); if($MsModel->validate()){ $response = $MsModel->setRequest()->sendRequest()->sendResponse(); return $response;//response is json {status: "success|error", success|error : { message: "https://www.voguepay.com/payment-url|errorMesssge"}} }
Command API
With the Command API you can Fetch records of transactions, Pay (send money) to VoguePay merchants, Withdraw money to various bank accounts, and create a new user on VoguePay.
See tecsin\pay2\models\Money for withdrawal example
Read More.
See VoguePay Developer Page
Contributions
Contributions re highly welcome in any form deemed fit
tecsin/yii2-voguepay 适用场景与选型建议
tecsin/yii2-voguepay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「extension」 「processor」 「yii2」 「voguepay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tecsin/yii2-voguepay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tecsin/yii2-voguepay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tecsin/yii2-voguepay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A GeoIP decorator/processor for monolog
A Monolog processor for adding arbitrary logging data
A custom URL rule class for Yii 2 which allows to create translated URL rules
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-01-19