定制 dilab/ipay 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dilab/ipay

Composer 安装命令:

composer require dilab/ipay

包简介

iPay88 Plugin for CakePHP

README 文档

README

iPay88 is a leading regional Payment Gateway Provider in South East Asia.

Requirements

  • CakePHP version: 2.5.x

Installation

Using Git

git clone git@github.com:dilab/ipay.git Ipay

Using Composer

composer require dilab/ipay

Usage

Create Plugin Database

cake schema create --plugin ipay

Supply iPay88 Merchant Info

  • Copy ipay_config.php to App/Config folder cp app/Plugin/Ipay/Config/ipay_config_sample.php app/Config/ipay_config.php

  • Open app/Config/ipay_config.php and supply correct information for both merchantKey and merchantCode. Leave rest of info intact.

Create Event Listener

Ipay.IpayResponse model fires two events below, which you can use to add your business logic.

  • Model.IpayResponse.afterValidResponse: This event is fired when a valid response is sent from iPay88. It checks status and signature fields.

  • Model.IpayResponse.afterSuccessResponse: This event fires only if event above also happens. It re-query iPay88 server to check if it is valid payment.

Model.IpayResponse.afterSuccessResponse should be used to identify a successful payment.

Ipay Plugin comes with backend post by default, it will use this event listener to process

Sample

In file app/Controller/AppController.php:

public function beforeFilter()
{
  $this->loadModel('Ipay.IpayResponse');
  $callback = array($this, 'ipaySuccessResponseCallBack');
  $this->IpayResponse->getEventManager()->attach(
          $callback,
          'Model.IpayResponse.afterSuccessResponse',
          array('passParams' => true)
  );
}

public function ipaySuccessResponseCallBack($id)
{
  // Process your order with your business logic
  // Use $id to get the order information from ipay_repsonses table
}

Create iPay88 Form using Helper

You can use iPay88 to create the a iPay88 payment form, you should always the helper, because it takes care of signature creation.

Sample

$data = array(
    'RefNo' => 123,
    'Amount' => 100.00,
    'Currency' => 'USD',
    'ProdDesc' => 'Product',
    'UserName' => 'test user',
    'UserEmail' => 'test@gmail.com',
    'UserContact' => '123',
    'ResponseURL' => 'http://domain/controller/response_handler',
);

echo $this->Ipay->button($data);
             

Process Response using Component

In your response action, simply call Ipay.processPaymentResponse();, it will take care of all the backend process.

Sample

public response_handler() 
{
    // Your other code
    
    
    $this->Ipay->processPaymentResponse();

}

Testing

Unit Test

cake test Ipay all

Integration Test

cake test Ipay Integration/IpayRequeryIntegration

(Do not run this test as part of your Unit Test as it will send HTTP request to iPay88 server.)

Support

Please use Github Issues to report bugs/issues.

License

Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Author

Xu Ding

https://github.com/dilab

dilab/ipay 适用场景与选型建议

dilab/ipay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 10 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 dilab/ipay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dilab/ipay 我们能提供哪些服务?
定制开发 / 二次开发

基于 dilab/ipay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-09