leesiongchan/omnipay-molpay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

leesiongchan/omnipay-molpay

Composer 安装命令:

composer require leesiongchan/omnipay-molpay

包简介

MOLPay gateway for Omnipay payment processing library

README 文档

README

MOLPay driver for the Omnipay PHP payment processing library

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements MOLPay support for Omnipay.

MOLPay is a payment gateway offering from MOLPay Sdn Bhd. This package follows the MOLPay API Specification (Version 13.7: Updated on 10 Oct 2017).

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "leesiongchan/omnipay-molpay": "~2.0"
    }
}

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Basic Usage

The following gateways are provided by this package:

  • MOLPay (MOLPay Payment)

For general usage instructions, please see the main Omnipay repository.

Example

Create a purchase request

The example below explains how you can create a purchase request then send it.

$gateway = Omnipay::create('MOLPay');

$gateway->setCurrency('MYR');
$gateway->setEnableIPN(true); // Optional
$gateway->setLocale('en'); // Optional
$gateway->setMerchantId('test1234');
$gateway->setVerifyKey('abcdefg');

$options = [
    'amount' => '10.00',
    'card' => new CreditCard(array(
        'country' => 'MY',
        'email' => 'abc@example.com',
        'name' => 'Lee Siong Chan',
        'phone' => '0123456789',
    )),
    'description' => 'Test Payment',
    'transactionId' => '20160331082207680000',
    'paymentMethod' => 'credit', // Optional
];

$response = $gateway->purchase($options)->send();

// Get the MOLPay payment URL (https://www.onlinepayment.com.my/MOLPay/pay/...)
$redirectUrl = $response->getRedirectUrl();

Complete a purchase request

When the user submit the payment form, the gateway will redirect you to the return URL that you have specified in MOLPay. The code below gives an example how to handle the server feedback answer.

$response = $gateway->completePurchase($options)->send();

if ($response->isSuccessful()) {
    // Do something
    echo $response->getTransactionReference();
} elseif ($response->isPending()) {
    // Do something
} else {
    // Error
}

Void or Reverse a 'captured' transaction

Only available for limited merchants and channels

The following is the example to void a captured transaction, your can refer to MOLPay Reversal Request api spec.

$gateway = Omnipay::create('MOLPay');

$gateway->setMerchantId('your_merchant_id');
$gateway->setVerifyKey('your_verify_key');
$gateway->setSecretKey('your_secret_key');

$request = $gateway->void([
    'transactionReference' => '25248208'
]);
        
$response = $request->send();

if ($response->isSuccessful()) {
    // Update your data model
} else {
    echo $response->getMessage();
}

Request Partial Refund for a 'captured' or 'settled' transaction

Only available for limited merchants and channels

To perform a partial refund, you need to specify more parameters as below

$gateway = Omnipay::create('MOLPay');

$gateway->setMerchantId('your_merchant_id');
$gateway->setVerifyKey('your_verify_key');
$gateway->setSecretKey('your_secret_key');

$request = $gateway->refund([
    'transactionReference'  => '25248208',
    'refId'                 => 'merchant_refund_red_id',
    'amount'                => '10.00',
    'channel'               => $transaction_channel, // data saved from $gateway->purchase() response, e.g FPX_MB2U
    'bankCode'              => $bank_code, // from user who request to refund
    'beneficiaryName'       => $beneficiary_name, // from user who request to refund
    'beneficiaryAccountNo'  => $beneficiary_account_no, // from user who request to refund
]);
        
$response = $request->send();

// The refund process will take about 7-14 days after the request sent
if ($response->isSuccessful() || $response->isPending() ) {
    // Update your data model
} else {
    echo $response->getMessage();
}

Out Of Scope

Omnipay does not cover recurring payments or billing agreements, and so those features are not included in this package. Extensions to this gateway are always welcome.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

leesiongchan/omnipay-molpay 适用场景与选型建议

leesiongchan/omnipay-molpay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.35k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 03 月 31 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「merchant」 「purchase」 「omnipay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 leesiongchan/omnipay-molpay 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-31