diff --git a/application/helpers/helper.js b/application/helpers/helper.js
index f3aa03a..14d0f31 100644
--- a/application/helpers/helper.js
+++ b/application/helpers/helper.js
@@ -27,8 +27,245 @@ function getUniqueCode() {
return timestamp;
}
+// GENERATE XML REQUEST
+function generateXMLRequest(urn, headers, items) {
+ let xmlRequest = ''
+
+ switch (urn.toUpperCase()) {
+ case 'ZFMCMS_FI_001':
+
+ let xmlItem = ''
+
+ items.map((item, index) => {
+ xmlItem += `-
+
+ ${String(index+1).padStart(10, '0')}
+
+ ${item.c_account_code_topup ? item.c_account_code_topup : ""}
+
+ ${item.c_account_topup ? item.c_account_topup : ""}
+
+ ${item.ba ? item.ba : ""}
+
+ ${item.amount ? item.amount : ""}
+
+ ${item.posting_date ? item.posting_date : ""}
+
+
+
+
+
+ ${item.c_invoice_no ? item.c_invoice_no : ""}
+
+ ${item.item_text ? item.item_text : ""}
+
+ ${item.de_cre}
+
`
+ })
+
+ xmlRequest = `
+
+
+
+
+
+
+
+
+ ${headers.doc_header_text}
+
+ ${headers.ba}
+
+ ${headers.doc_date}
+
+ ${headers.posting_date}
+
+ ${headers.fisc_year}
+
+ ${headers.fisc_period}
+
+
+ ${headers.doc_type}
+
+ ${headers.c_invoice_no}
+
+ IDR
+
+
+
+ ${xmlItem}
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `
+ break;
+ default:
+ console.log('Sorry, we are out of ' + urn + '.');
+ }
+
+ return xmlRequest
+
+}
+
+// POSTING SAP
+async function postingSAP(url, body){
+ try {
+
+ const axios = require("axios");
+
+ const credential = {
+ username: "basisxiqas",
+ password: "12345678"
+ }
+
+ const config = {
+ headers : {
+ 'Content-Type': 'text/xml',
+ 'responseType': 'text',
+ },
+ auth: {
+ username: credential.username,
+ password: credential.password
+ }
+ }
+
+ const resp = await axios.post(url, body, config)
+
+ return {
+ status : resp.status,
+ message: "Success",
+ data : resp.data
+ }
+
+ } catch (error) {
+ // Error 😨
+
+ if (error.response) {
+ /*
+ * The request was made and the server responded with a
+ * status code that falls out of the range of 2xx
+ */
+ return {
+ status : error.response.status,
+ message: error.message,
+ data : []
+ }
+ } else if (error.request) {
+ /*
+ * The request was made but no response was received, `error.request`
+ * is an instance of XMLHttpRequest in the browser and an instance
+ * of http.ClientRequest in Node.js
+ */
+ return {
+ status : 500,
+ message: "SAP : no response",
+ data : []
+ }
+ } else {
+ // Something happened in setting up the request and triggered an Error
+ return {
+ status : 500,
+ message: error.message,
+ data : []
+ }
+ }
+ }
+}
+
+// GET SOAP RESPONSE DATA
+function getXMLData(response) {
+ const xml2js = require('xml2js');
+// console.log(xmlString)
+ let resSAP = {
+ type: '',
+ message : '',
+ data : {
+ E_DOCUMENTYEAR: '',
+ E_DOCUMENTNUMBER: '',
+ // ITEM: [],
+ }
+ }
+
+ if(response.status == 200){
+
+ const options = {
+ explicitArray: false,
+ tagNameProcessors: [xml2js.processors.stripPrefix]
+ }
+
+ xml2js.parseString(response.data, options, (err, result) => {
+
+ if (err) throw err
+
+ let soapBody = result.Envelope.Body;
+
+ if (soapBody.$) delete soapBody.$
+
+ resSAP.data.E_DOCUMENTYEAR = soapBody['ZFMCMS_FI_001.Response']['E_DOCUMENTYEAR'] ? soapBody['ZFMCMS_FI_001.Response']['E_DOCUMENTYEAR'] : "0000"
+ resSAP.data.E_DOCUMENTNUMBER = soapBody['ZFMCMS_FI_001.Response']['E_DOCUMENTNUMBER'] ? soapBody['ZFMCMS_FI_001.Response']['E_DOCUMENTNUMBER'] : ""
+
+ if(soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item']){
+ if (!Array.isArray(soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'])) {
+ // resSAP.data.ITEM.push(soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'])
+ resSAP.type = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item']['TYPE']
+ resSAP.message = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item']['MESSAGE_1']
+ } else {
+ // resSAP.data.ITEM = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item']
+ resSAP.type = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'][0]['TYPE']
+ resSAP.message = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'][0]['MESSAGE_1']
+ }
+ }
+
+ });
+
+ }else {
+
+ resSAP.type = 'E'
+ resSAP.message = response.message ? response.message : "aa"
+
+ }
+
+
+ return resSAP
+
+}
+
module.exports = {
encryptText,
decryptText,
getUniqueCode,
+ generateXMLRequest,
+ postingSAP,
+ getXMLData
};
diff --git a/application/modules/invoice/invoice.controller.js b/application/modules/invoice/invoice.controller.js
index 8dcbdab..ea93346 100644
--- a/application/modules/invoice/invoice.controller.js
+++ b/application/modules/invoice/invoice.controller.js
@@ -11,138 +11,126 @@ var result = {};
var uniqueCode;
// POSTING INVOICE
-const postingInvoice = async (req, res) => {
+const postingInvoice = async () => {
try {
// generate unique code
- uniqueCode = await helper.getUniqueCode();
-
+ uniqueCode = helper.getUniqueCode();
+ // return uniqueCode
// time
- let invoiceDate = moment('2022-06-25').subtract(1, "days").format("YYYY-MM-DD");
+ let invoiceDate = moment('2020-01-25').format("YYYY-MM-DD")
- let invoice = [];
+ let invoice = []
+
+ let xmlRequest = ''
await knex.transaction(async trx => {
- winston.logger.info(`${uniqueCode} execute payment.sp_payment_req_topup_online`);
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} TRANSACTION 1`);
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} execute payment.sp_payment_req_topup_online(${invoiceDate})`);
invoice = await model.generateInvoice(invoiceDate, trx)
- winston.logger.info(`${uniqueCode} result payment.sp_payment_req_topup_online ${JSON.stringify(invoice)}`);
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} result payment.sp_payment_req_topup_online ${JSON.stringify(invoice)}`);
- if(invoice){
- for (const key in invoice) {
+ if(invoice.length > 0) for (const key in invoice) {
- winston.logger.info(`${uniqueCode} insert posting et ${JSON.stringify(invoice[key])}`)
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} insert posting et ${JSON.stringify(invoice[key])}`)
let postingEt = await model.insertPostingEt(invoice[key], trx)
-
- winston.logger.info(`${uniqueCode} success insert posting : ${postingEt}`)
-
- }
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} success insert posting et : ${JSON.stringify(postingEt)}`)
}
+ // })
-
- if(invoice){
-
- winston.logger.info(`${uniqueCode} preparing posting FB70 to SAP`);
+ if(invoice.length > 0){
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} preparing posting FB70 to SAP`);
const url = 'http://piqas.kereta-api.co.id:51500/XISOAPAdapter/MessageServlet?senderParty=&senderService=KCI_ETICKETING_2&receiverParty=&receiverService=&interface=SI_KCI_CMS_FI01&interfaceNamespace=urn:Posting_ETicketing_2'
- const credential = {
- username: "basisxiqas",
- password: "12345678"
- }
-
for (const key in invoice) {
-
- winston.logger.info(`${uniqueCode} REQUEST posting ${invoice[key].c_invoice_no} to SAP`);
-
- // const response = await fetch(url, {
- // method: 'POST',
- // headers: {
- // 'Content-Type': 'text/xml',
- // 'Authorization': 'Basic' + base64.encode(credential.username + ":" + credential.password)
- // },
- // body: xmlRequest
- // });
-
- // const soap = await response.text();
- const soap = `
-
-
-
- 2021
- 4905741245
-
-
-
- `
-
- winston.logger.info(`${uniqueCode} RESPONSE posting ${invoice[key].c_invoice_no} to SAP : ${soap}`);
-
- let resSAP = {
- E_MATDOCUMENTYEAR: '',
- E_MATERIALDOCUMENT: '',
- ITEM: [],
+
+ let xmlHeader = {
+ doc_header_text : invoice[key].doc_header_text ? invoice[key].doc_header_text : "",
+ ba: invoice[key].ba ? invoice[key].ba : "",
+ doc_date : invoice[key].doc_date ? invoice[key].doc_date : "",
+ posting_date : invoice[key].posting_date ? invoice[key].posting_date : "",
+ fisc_year : invoice[key].fisc_year ? invoice[key].fisc_year : "",
+ fisc_period : invoice[key].fisc_period ? invoice[key].fisc_period: "",
+ doc_type: invoice[key].doc_type ? invoice[key].doc_type : "",
+ c_invoice_no : invoice[key].c_invoice_no ? invoice[key].c_invoice_no : ""
}
- xml2js.parseString(soap, {
- explicitArray: false,
- tagNameProcessors: [xml2js.processors.stripPrefix]
- }, (err, result) => {
- if (err) {
- winston.logger.error(`${uniqueCode} ERROR parsing XML : ${err}`);
- return;
+ let xmlItem = ['S', 'H'].map((item, index) => {
+ return {
+ c_account_code_topup : item == 'S' ? invoice[key].c_account_code_topup : "",
+ c_account_topup : item == 'H' ? invoice[key].c_account_topup : "",
+ ba : invoice[key].ba,
+ amount : invoice[key].amount,
+ posting_date : invoice[key].posting_date,
+ c_invoice_no : invoice[key].c_invoice_no,
+ item_text : `${item == 'S' ? "DEBIT" : "KREDIT"} INVOICE CMS ${invoice[key].doc_header_text}`,
+ de_cre : item
}
-
- let soapBody = result.Envelope.Body;
-
- if (soapBody.$) delete soapBody.$
-
- resSAP.E_MATDOCUMENTYEAR = soapBody['ZFMCMS_FI_001.Response']['E_MATDOCUMENTYEAR']
- resSAP.E_MATERIALDOCUMENT = soapBody['ZFMCMS_FI_001.Response']['E_MATERIALDOCUMENT']
-
- if (!Array.isArray(soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'])) {
- resSAP.ITEM.push(soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item'])
- } else {
- resSAP.ITEM = soapBody['ZFMCMS_FI_001.Response']['C_T_RETURN']['item']
- }
-
});
- // UPDATE CMS
- winston.logger.info(`${uniqueCode} UPDATE resposn FB70 to CMS ${JSON.stringify(resSAP)}`);
- const cms = await model.setReturnSAP(invoice[key], resSAP, trx)
- winston.logger.info(`${uniqueCode} SUKSES UPDATE resposn FB70 to CMS ${JSON.stringify(resSAP)}`);
- };
+ let xmlRequest = helper.generateXMLRequest('ZFMCMS_FI_001', xmlHeader, xmlItem)
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} REQUEST posting ${invoice[key].c_invoice_no} to SAP : ${xmlRequest}`);
+
+ const response = await helper.postingSAP(url, xmlRequest)
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} RESPONSE posting ${invoice[key].c_invoice_no} to SAP : ${JSON.stringify(response)}`);
+
+ // new transaction
+ // await knex.transaction(async trx => {
+
+ const resSAP = helper.getXMLData(response)
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} TRANSACTION 2`);
+ // UPDATE CMS
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} SET resposn FB70 to CMS : ${JSON.stringify(resSAP)}`)
+
+ const cms = await model.setReturnSAP(invoice[key], resSAP, trx)
+
+ winston.logger.info(`SCHEDULER-FB70-${uniqueCode} RESULT CMS : ${JSON.stringify(cms)}`)
+
+ // })
+
+ }
+
}
})
+
result = {
code: "200",
message: "Succes posting",
data: invoice,
};
- return res.status(200).json(result);
+ return JSON.stringify(result)
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
);
- return res.status(200).json({
+ result = {
code: "500",
message:
process.env.NODE_ENV != "production"
? error.message
: "500 internal server error - backend server.",
data: {},
- });
+ }
+
+ return JSON.stringify(result)
+
}
+
};
module.exports = {
diff --git a/application/modules/invoice/invoice.model.js b/application/modules/invoice/invoice.model.js
index fbce3c8..d5aea6c 100644
--- a/application/modules/invoice/invoice.model.js
+++ b/application/modules/invoice/invoice.model.js
@@ -1,13 +1,13 @@
// GET PARTNER, MERCHANT, TERMINAL FROM TID
-const generateInvoice = (invoiceDate, trx) => {
+const generateInvoice = async (invoiceDate, trx) => {
- let result = trx.select(trx.raw(`* FROM payment.sp_payment_req_topup_online('${invoiceDate}')`))
+ let result = await trx.select(trx.raw(`* FROM payment.sp_payment_req_topup_online('${invoiceDate}')`))
return result;
}
-const insertPostingEt = (invoice, trx) => {
+const insertPostingEt = async (invoice, trx) => {
console.log("invoice : ", invoice)
let type = ['S', 'H']
let et = []
@@ -27,19 +27,22 @@ const insertPostingEt = (invoice, trx) => {
ba: invoice.ba,
indeks: (index+1),
totalidx: type.length,
- doc_header_text: `POSTING INVOICE CMS ${invoice.c_invoice_no} - ${invoice.doc_header_text}`,
+ doc_header_text: `POSTING INVOICE CMS ${invoice.c_invoice_no}`,
+ pos_status : null
}
if(item == 'H'){
data = {...data, ...{
- text: `DEBIT INVOICE CMS ${invoice.c_invoice_no} - ${invoice.doc_header_text}`,
+ text: `DEBIT INVOICE CMS ${invoice.doc_header_text}`,
debit_kredit: item,
account: invoice.c_account_topup,
+ customer: null
}}
}else{
data = {...data, ...{
- text: `KREDIT INVOICE CMS ${invoice.c_invoice_no} - ${invoice.doc_header_text}`,
+ text: `KREDIT INVOICE CMS ${invoice.doc_header_text}`,
debit_kredit: item,
+ account: null,
customer: invoice.c_account_code_topup
}}
}
@@ -48,26 +51,68 @@ const insertPostingEt = (invoice, trx) => {
});
- posting_et = trx('public.posting_et').insert(et, ['no_dok'])
+ posting_et = await trx('public.posting_et').insert(et, ['indeks', 'customer', 'account', 'ba', 'fiscal_year', 'amount', 'no_dok', 'text', 'debit_kredit'])
- return posting_et
+ return posting_et[0]
}
-const setReturnSAP = (invoice, resSAP, trx) => {
-
- // update invoice
- trx('trx.t_d_load_balance').update({
- c_return_sap: resSAP.E_MATERIALDOCUMENT
- }, ['c_load_balance'])
- .whereRaw(`c_load_balance_no IN (SELECT c_load_balance_no FROM payment.t_d_payment_request_topup_online WHERE c_payment = ${invoice.c_invoice_no})`)
-
- // update load balance
- trx('trx.t_d_load_balance').update({
- c_return_sap: resSAP.E_MATERIALDOCUMENT
- })
- .whereRaw(`c_load_balance_no IN (SELECT c_load_balance_no FROM payment.t_d_payment_request_topup_online WHERE c_payment = ${invoice.c_invoice_no})`)
+// const getPostingEt = async(invoiceDate, trx) => {
+// const result = await trx('public.posting_et').select([
+// trx.raw(`LPAD(indeks::text, 10, '0') `),
+// 'file_name',
+// 't_code',
+// 'doc_type',
+// 'posting_date',
+// 'doc_date',
+// 'debit_kredit',
+// 'account',
+// 'amount',
+// 'ba',
+// 'customer',
+// 'fiscal_year',
+// 'text',
+// 'doc_header_text'
+// ])
+// }
+const setReturnSAP = async (invoice, resSAP, trx) => {
+ let t_invoice = {}
+ let t_load_balance = {}
+
+ if(resSAP.type == 'S'){
+ // update invoice
+ t_invoice = await trx('payment.t_d_invoice').update({
+ c_return_sap: resSAP.data.E_DOCUMENTNUMBER
+ }, ['c_invoice_no','c_return_sap'])
+ .where({
+ c_invoice_no: invoice.c_invoice_no
+ });
+
+ // update load balance
+ t_load_balance = await trx('trx.t_d_load_balance').update({
+ c_return_sap: resSAP.data.E_DOCUMENTNUMBER
+ }, ['c_load_balance_no', 'c_return_sap'])
+ .whereRaw(`c_load_balance_no IN (SELECT c_load_balance_no FROM payment.t_d_payment_request_topup_online WHERE c_payment = '${invoice.c_invoice_no}')`)
+
+ }
+
+ // update posting et
+ const posting_et = await trx('public.posting_et').update({
+ pos_status : resSAP.type == 'S' ? 0 : 3,
+ status0 : resSAP.type,
+ no_doksap : resSAP.data.E_DOCUMENTNUMBER ? resSAP.data.E_DOCUMENTNUMBER : null,
+ status1 : resSAP.message ? resSAP.message : null
+ }, ['file_name','status0']).where({
+ file_name: invoice.c_invoice_no
+ })
+
+ return {
+ invoice : t_invoice,
+ load_balance : t_load_balance,
+ posting_et : posting_et
+ }
+
}
module.exports = {
diff --git a/index.js b/index.js
index adfc105..d8b8188 100644
--- a/index.js
+++ b/index.js
@@ -11,7 +11,8 @@ const hsmRoute = require("./application/routes/hsm.routes");
const historyRoute = require("./application/routes/history.routes");
const paymentReconRoute = require("./application/routes/paymentrecon.routes");
const invoiceRoute = require("./application/routes/invoice.routes");
-
+const cron = require('node-cron');
+const moment = require('moment')
require("dotenv").config();
const app = express();
@@ -53,4 +54,24 @@ app.use("/api/", invoiceRoute);
const PORT = process.env.PORT || 8000;
app.listen(PORT, () => {
winston.logger.info(`Server is running on environment: ${process.env.NODE_ENV.toUpperCase()}`);
-});
\ No newline at end of file
+});
+
+// winston.logger.info(`Response : ${response()}`);
+
+// SCHEDULER FOR POSTING INVOICE
+const invoiceSch = require("./application/modules/invoice/invoice.controller");
+cron.schedule('*/10 * * * * *', async () => { // Every minute offset 30 seconds
+// // console.log()
+ try {
+ winston.logger.info(`[${moment().format('YYYY-MM-DD hh:mm:ss')}] : `, await invoiceSch.postingInvoice());
+ } catch (error) {
+ winston.logger.info(`[${moment().format('YYYY-MM-DD hh:mm:ss')}] : `, error.message);
+ }
+
+});
+
+// const soap = `0000- E$Error in document: BKPFF $ KAQCLNT100
- E$Period 01 is not allowed
- E$Period 01 is not valid
`
+// `
+// let resSAP = helper.getXMLData({status: 200}, soap)
+
+// winston.logger.info(`SCHEDULER-FB70 RESPONSE posting to SAP ${JSON.stringify(resSAP)}`);
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index ade5799..cc17b26 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
+ "axios": "^0.27.2",
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"check-internet-connected": "^2.0.6",
@@ -327,6 +328,14 @@
"lodash": "^4.17.14"
}
},
+ "node_modules/@pm2/js-api/node_modules/axios": {
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
+ "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "dependencies": {
+ "follow-redirects": "^1.14.0"
+ }
+ },
"node_modules/@pm2/js-api/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -601,12 +610,18 @@
"node": "<=0.11.8 || >0.11.10"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
"node_modules/axios": {
- "version": "0.21.4",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
- "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "version": "0.27.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
+ "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"dependencies": {
- "follow-redirects": "^1.14.0"
+ "follow-redirects": "^1.14.9",
+ "form-data": "^4.0.0"
}
},
"node_modules/balanced-match": {
@@ -898,6 +913,17 @@
"text-hex": "1.0.x"
}
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
@@ -1029,6 +1055,14 @@
"node": ">= 6"
}
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -1352,6 +1386,19 @@
}
}
},
+ "node_modules/form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -4103,6 +4150,14 @@
"lodash": "^4.17.14"
}
},
+ "axios": {
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
+ "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "requires": {
+ "follow-redirects": "^1.14.0"
+ }
+ },
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -4307,12 +4362,18 @@
"shimmer": "^1.1.0"
}
},
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
"axios": {
- "version": "0.21.4",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
- "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "version": "0.27.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
+ "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"requires": {
- "follow-redirects": "^1.14.0"
+ "follow-redirects": "^1.14.9",
+ "form-data": "^4.0.0"
}
},
"balanced-match": {
@@ -4544,6 +4605,14 @@
"text-hex": "1.0.x"
}
},
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
"commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
@@ -4654,6 +4723,11 @@
"vm2": "^3.9.8"
}
},
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
+ },
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -4892,6 +4966,16 @@
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA=="
},
+ "form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ }
+ },
"forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
diff --git a/package.json b/package.json
index a29ddf7..d667ae6 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
},
"homepage": "https://github.com/mohamadihsan/topuponline#readme",
"dependencies": {
+ "axios": "^0.27.2",
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"check-internet-connected": "^2.0.6",