Netpayclient for ruby
银联商户会员 ruby
安装
gem 'netpayclient'
系统依赖
- mcrypt (用于ruby-mcrypt)
# 安装mcrypt (ubuntu)
sudo apt-get install mcrypt libmcrypt-dev
使用 & API
Netpayclient.build_key(path: nil, hash: {})
netpay = Netpayclient.build_key(path: 'path/to/MerPrK.key')
# or
netpay = Netpayclient.build_key(hash: {
MERID: '8435...4395',
prikeyS: '4234...423',
prikeyE: '472...48324',
})
签名 sign
# netpay = Netpayclient.build_key(...)
netpay.sign('834...645')
订单签名 sign_order
netpay.sign_order(merid, ordno, amount, curyid, transdate, transtype)
应答数据的签名验证 verify
netpay.verify(plain, checkvalue)
应答数据的签名验证包装 verify_trans_response
netpay.verify_trans_response(merid, ordno, amount, curyid, transdate, transtype, ordstatus, check)