Files
Online-Topup-V1/application/modules/invoice/invoice.model.js
T
Nuranggi Hermawan 495da9dfa2 Add invoice service
2022-07-11 11:03:27 +07:00

26 lines
712 B
JavaScript

// GET PARTNER, MERCHANT, TERMINAL FROM TID
const generateInvoice = (invoiceDate, trx) => {
let invoice = trx.select(trx.raw(`payment.sp_payment_req_topup_online('${invoiceDate}')`)).get()
invoice.forEach(function (item) {
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 response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'text/xml'
},
body: xmlRequest
});
console.log(item);
});
return result;
};
module.exports = {
generateInvoice,
};