diff --git a/lib/middleware.js b/lib/middleware.js index 112d4fd..855bc3f 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -48,6 +48,9 @@ Basic.prototype.done = function (handler) { var self = this; var payment = self.payment; return function (req, res, next) { + if(req.wxpayconfig){ + payment = new Payment(req.wxpayconfig); + } if (req.method !== 'POST') { var error = new Error(); error.name = 'NotImplemented'; @@ -131,6 +134,10 @@ Refund.prototype.done = function (handler) { var key = self.key; return function (req, res, next) { + if(req.wxpayconfig){ + payment = new Payment(req.wxpayconfig); + key = md5(req.wxpayconfig.partnerKey).toLowerCase(); + } if (req.method !== 'POST') { var error = new Error(); error.name = 'NotImplemented';