Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayi.xu committed Dec 13, 2017
1 parent 8f3296b commit cd592f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Payment.prototype._signedQuery = function(url, params, options, callback) {
}

var request = (options.https ? this._httpsRequest : this._httpRequest).bind(this);
request(url, this._buildXml(params), function(err, body) {
request(url, this.buildXml(params), function(err, body) {
if (err) {
return callback(err);
}
Expand Down Expand Up @@ -347,7 +347,7 @@ Payment.prototype._parseCsv = function(text) {
};
};

Payment.prototype._buildXml = function(obj) {
Payment.prototype.buildXml = function(obj) {
var builder = new xml2js.Builder({
allowSurrogateChars: true
});
Expand Down Expand Up @@ -469,7 +469,8 @@ Payment.prototype._generateNonceStr = function(length) {
if (global.Promise) {
for (let key in Payment.prototype) {
let func = Payment.prototype[key]
if (typeof func == 'function' && key.indexOf('_') !== 0) {
let syncFuncs = ['buildXml']
if (typeof func == 'function' && key.indexOf('_') !== 0 && syncFuncs.indexOf(key) === -1) {
Payment.prototype[key] = function () {
let args = Array.prototype.slice.call(arguments)
let originCallback = args[args.length - 1]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechat-pay",
"version": "0.3.1",
"version": "0.3.2",
"description": "wechat payment api for document v3.3.5",
"main": "index.js",
"scripts":
Expand Down Expand Up @@ -31,4 +31,4 @@
"underscore": "^1.7.0",
"xml2js": "^0.4.4"
}
}
}

0 comments on commit cd592f4

Please sign in to comment.