module.exports = HttpConnection;

var request = require('requestretry');
var HttpConfig = require("./HttpConfig");
var PaymayaApiError = require("./PaymayaApiError");

function HttpConnection(httpConfig) {
	this._httpConfig = httpConfig;
}

HttpConnection.prototype = {

	/* PUBLIC FUNCTIONS */
	execute: function(data, callback) {
		var httpOptions = {
		  url: this._httpConfig.getUrl(),
		  method: this._httpConfig.getMethod(),
		  headers: this._httpConfig.getHeaders(),
		  maxAttempts: this._httpConfig.getMaximumRequestAttempt()
		};

		if(data) {
		  httpOptions['body'] = JSON.stringify(data);
		}

		request(httpOptions, function(err, response, body) {
		  if(err) {
		    return callback(err);
		  }

		  if(!body && response.statusCode >= 400) {
		    var err = new PaymayaApiError(response.statusCode);
		    return callback(err);
		  }

		  if(typeof body !== 'object') {
		    body = JSON.parse(body);
		  }

		  if(body.error) {
		    var paymayaApiError = new PaymayaApiError(response.statusCode, body.error);
		    return callback(paymayaApiError.message);
		  }

		  if(body.message && response.statusCode !== 200) {
		  	return callback(body.message);
		  }

		  callback(null, body);
		});
	}
};
@@ -762,18 +762,30 @@
     var 
-er
+paymayaApiErro
 r = new 
@@ -836,35 +836,55 @@
 return callback(
-err
+paymayaApiError.message
 );%0A%09%09  %7D%0A%0A%09%09  if

Change duplicate variable in httpconnection