huifu

汇付托管SDK

Usage no npm install needed!

<script type="module">
  import huifu from 'https://cdn.skypack.dev/huifu';
</script>

README

汇付天下P2P系统托管API文档

Build Status via Travis CI Coverage Status NPM version

注意:API约定

  • 所有接口调用遵循CmdId值,首字母小写,参数按照文档.其中参数Version,CmdId,MerCustId,ChkValue这四个参数不用填写
  • 所有接口调用均支持callback 和 promise

usage

var HUIFU = require('huifu');
var huifu = new HUIFU({
    merId: '', //商户号
    npcServerIp: '', //npc服务地址
    npcServerPort: '' , //npc服务端口
    merCustId: '', //汇付商户客户号
    platformUrl: '', //汇付服务器地址
    loadingHtml: '<div>loading</div>', //浏览器跳转时的提示html
    timeout: 60000, //http请求超时时间,默认60秒
    debug: true //打印函数调用的参数,默认是fasle
});

//用户开户接口
// promise
huifu.userRegister({UsrMp: '', UsrName:'', IdNo: '', BgRetUrl: '', RetUrl: '', PageType: '2'})
    .then(function (redirectUrl) {
        console.log('redirectUrl', redirectUrl)
    })
    .catch(function (error) {

    })

// callback
huifu.userRegister({UsrMp: '', UsrName:'', IdNo: '', BgRetUrl: '', RetUrl: '', PageType: '2'}, function (err, redirectUrl) {
    console.log('===========', err, redirectUrl);
});

API

用户管理类接口

交易类接口

查询类接口

其他接口

  • getConfig
  • queryRetQuota 获取终止异步回调的响应内容(参数是汇付接口返回的object)
  • reactResponse 4.2.7 异步回调验证签名的方法
  • isSuccess 判断汇付响应结果是否成功(返回boolean值)
  • log 控制台输入log接口(当且仅当实例化的参数debug:true时有效)

test

  • npm test
  • npm run cov