irpayments
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "irpayments", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "IR Payments, a package for all payment gateways of IRAN", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"build-docs": "node_modules/.bin/jsdoc --configure jsdoc.json --verbose" | ||
"build-docs": "node_modules/.bin/jsdoc --configure jsdoc.json --verbose", | ||
"test-idpay": "node test/idpay.js" | ||
}, | ||
@@ -9,0 +10,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
const { default: axios } = require("axios"); | ||
const { default: axios, Axios } = require("axios"); | ||
@@ -28,3 +28,3 @@ /** | ||
{ | ||
this.BaseURL = ServerURL; | ||
this.#BaseURL = ServerURL; | ||
@@ -42,11 +42,20 @@ /** | ||
method = method.toLowerCase(); | ||
return axios[method] | ||
( | ||
uri, | ||
{ | ||
baseURL: this.BaseURL, | ||
data: ('data' in params && params['data']) ? params.data : null, | ||
Headers: ('Headers' in params && params['Headers']) ? params.Headers : null, | ||
} | ||
); | ||
let headerObject = { | ||
'content-type': 'application/json' | ||
} | ||
if(method == 'get') | ||
return axios['get'](uri, { | ||
baseURL: this.#BaseURL, | ||
data: ('data' in params && params['data']) ? params.data : null, | ||
Headers: ('Headers' in params && params['Headers']) ? {...params.Headers, ...headerObject} : headerObject, | ||
}) | ||
else if(method == 'post') | ||
{ | ||
return axios['post'](uri, ('data' in params && params['data']) ? params.data : null, { | ||
baseURL: this.#BaseURL, | ||
headers: ('Headers' in params && params['Headers']) ? {...params.Headers, ...headerObject} : headerObject, | ||
}) | ||
} | ||
} | ||
@@ -53,0 +62,0 @@ } |
25710
15
520