mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 16:26:26 +00:00
Merge branch 'nuranggi' of https://github.com/mohamadihsan/topuponline
This commit is contained in:
@@ -16,6 +16,7 @@ const validate = (method) => {
|
||||
case "generateInvoice":
|
||||
return [
|
||||
body('trx_date').notEmpty().withMessage('trx_date is required!').isISO8601().withMessage('invalid trx_date format YYYY-MM-DD !').escape().trim(),
|
||||
body('repost').notEmpty().withMessage('repost is required!').isBoolean().withMessage('repost must boolean!').escape().trim(),
|
||||
];
|
||||
case "postingInvoice":
|
||||
return [
|
||||
@@ -59,7 +60,7 @@ const apiGenerateInvoice = async (req, res) => {
|
||||
// time
|
||||
let invoiceDate = moment(req.body.trx_date).format("YYYY-MM-DD")
|
||||
|
||||
let invoice = await _generateInvoice(invoiceDate, uniqueCode)
|
||||
let invoice = await _generateInvoice(invoiceDate, uniqueCode, req.body.repost)
|
||||
|
||||
result = {
|
||||
code: "200",
|
||||
@@ -145,7 +146,7 @@ const apiPostingInvoice = async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
const _generateInvoice = async (invoiceDate, uniqueCode) => {
|
||||
const _generateInvoice = async (invoiceDate, uniqueCode, repost) => {
|
||||
|
||||
let invoice = []
|
||||
|
||||
@@ -153,9 +154,9 @@ const _generateInvoice = async (invoiceDate, uniqueCode) => {
|
||||
|
||||
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} TRANSACTION 1`);
|
||||
|
||||
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} execute payment.sp_payment_req_topup_online(${invoiceDate})`);
|
||||
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} execute payment.sp_payment_req_topup_online('${invoiceDate}', ${repost})`);
|
||||
|
||||
invoice = await model.generateInvoice(invoiceDate, trx)
|
||||
invoice = await model.generateInvoice(invoiceDate, repost, trx)
|
||||
|
||||
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} result payment.sp_payment_req_topup_online ${JSON.stringify(invoice)}`);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
// GET PARTNER, MERCHANT, TERMINAL FROM TID
|
||||
const generateInvoice = async (invoiceDate, trx) => {
|
||||
const generateInvoice = async (invoiceDate, repost, trx) => {
|
||||
|
||||
let result = await 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}', ${repost})`))
|
||||
|
||||
return result;
|
||||
|
||||
@@ -128,13 +128,13 @@ const setReturnSAP = async (invoice, resSAP, trx) => {
|
||||
const writePaynentHistory = async (data, trx) => {
|
||||
console.log(data)
|
||||
const result = await trx('log.t_log_invoice').insert({
|
||||
i_log_name : 27,
|
||||
i_log_name : 102,
|
||||
d_log : trx.raw('NOW()'),
|
||||
c_invoice_no : data.c_invoice_no,
|
||||
c_partner_name : data.c_partner_name,
|
||||
j_new_data : JSON.stringify(data),
|
||||
d_payment_date: trx.raw('NOW()'),
|
||||
c_note : 'SUKSES POSTING TO INVOICE',
|
||||
c_note : 'SUCCESSFULLY',
|
||||
c_status : 'S',
|
||||
d_created : trx.raw('NOW()'),
|
||||
m_amount : data.amount,
|
||||
|
||||
Reference in New Issue
Block a user