From 12f3ba78a7760306d180a69c525dba6ad89bb20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=BB=8E=E6=98=8E?= Date: Tue, 22 Nov 2016 11:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B7=E5=8D=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98pai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加刷卡支付pai --- lib/wxpay.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/wxpay.js b/lib/wxpay.js index 969ac13..f2967cb 100644 --- a/lib/wxpay.js +++ b/lib/wxpay.js @@ -76,6 +76,26 @@ WXPay.mix('createUnifiedOrder', function(opts, fn){ }); }); +WXPay.mix('cardPay', function(opts, fn){ + + opts.nonce_str = opts.nonce_str || util.generateNonceString(); + util.mix(opts, this.wxpayID); + opts.sign = this.sign(opts); + + request({ + url: "https://api.mch.weixin.qq.com/pay/micropay", + method: 'POST', + body: util.buildXML(opts), + agentOptions: { + pfx: this.options.pfx, + passphrase: this.options.mch_id + } + }, function(err, response, body){ + console.log(body); + util.parseXML(body, fn); + }); +}); + WXPay.mix('getBrandWCPayRequestParams', function(order, fn){ order.trade_type = "JSAPI";