UNPKG

node-mnb

Version:

Node package that retrieves information from the Hungarian National Bank's (MNB) SOAP API.

30 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wsdlRequestHandler = exports.soapServiceUrl = void 0; const soap_1 = require("soap"); exports.soapServiceUrl = 'https://www.mnb.hu/arfolyamok.asmx?wsdl'; const wsdlRequestHandler = (wsdlUrl, method, request) => { return new Promise((resolve, reject) => { let result = {}; try { (0, soap_1.createClient)(wsdlUrl, {}, function (err, client) { client.on('response', (responseXml) => { result.responseXml = responseXml; }); const clientMethod = client[method]; clientMethod(request, function (err, response) { if (err) { return reject(err); } result.response = response; return resolve(result); }); }); } catch (e) { console.log(`Bruh: ${e}`); } }); }; exports.wsdlRequestHandler = wsdlRequestHandler; //# sourceMappingURL=index.js.map