mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 10:56:27 +00:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fe3ecc89f | |||
| b6b043b0a2 | |||
| bbdb4c2963 | |||
| 33f3b64d17 | |||
| 5ff0cae4d6 | |||
| e3673f738c | |||
| f7d7d0efce | |||
| 30c32ca293 | |||
| 3fefaed395 | |||
| 536d1a5c94 | |||
| 0baf1332b6 | |||
| 21a45058f0 | |||
| 4bb2facddb | |||
| ed11c6ccc4 | |||
| e4cf444b83 | |||
| 293602bed2 | |||
| c7f816a449 | |||
| 9052668cbc | |||
| 1ba983e745 | |||
| e7c4388956 | |||
| 1b3991c82f | |||
| fff4915078 | |||
| 1bd85ba888 | |||
| 7b52cebeb7 | |||
| 529d6d7ffc | |||
| d3729ab906 | |||
| 9e98533ffb | |||
| ef274a483c | |||
| 1f127807d3 | |||
| 1014e4374a | |||
| 88c3b9bc4a | |||
| ffa6830734 | |||
| 5a63ca6ea1 | |||
| b942d114ad | |||
| 7c66ebe702 | |||
| 6b0d67ee60 | |||
| 7805bc902b | |||
| 95f4a03e81 | |||
| 4c7230ba6b | |||
| 1b2eff69b4 | |||
| e3ab361b24 | |||
| 14026e8bf0 | |||
| 3c1fc92d59 | |||
| a333ddb58f | |||
| f2c5d65ec0 | |||
| bcb9225466 | |||
| 90dfdc8857 | |||
| 476235440c | |||
| 04885f22d6 | |||
| 3b68ab9ab3 | |||
| a3a4772f77 | |||
| 6ef43923e1 | |||
| 47af9992be | |||
| ede3aacef3 | |||
| a6b17139bf | |||
| 7a7f18701d | |||
| e34434f96c | |||
| 9cbc467904 | |||
| 0a5e82dbbb | |||
| 6c7131c944 |
@@ -136,6 +136,58 @@ const paymentRecon = async (req, res) => {
|
|||||||
return res.status(200).json(result);
|
return res.status(200).json(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(getPartner);
|
||||||
|
|
||||||
|
// check payment recon status is enable
|
||||||
|
if (getPartner.b_payment_recon != true) {
|
||||||
|
result = {
|
||||||
|
code: '444',
|
||||||
|
message: 'Partner unable to receive payment reconciliations',
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// log warn
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE PAYMENT-RECON ]: ${JSON.stringify(result)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.status(200).json(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check partner reservation number yang di request sama dengan partner yang di token
|
||||||
|
let checkReservation = await model.checkReservation(reservation_number);
|
||||||
|
|
||||||
|
if (!checkReservation) {
|
||||||
|
result = {
|
||||||
|
code: '400',
|
||||||
|
message: 'Reservation number does not exist.',
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// log warn
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE PAYMENT-RECON ]: ${JSON.stringify(result)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.status(200).json(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkReservation.i_partner != partner_id) {
|
||||||
|
result = {
|
||||||
|
code: '443',
|
||||||
|
message:
|
||||||
|
'Partner for payment reconciliation and transaction does not match',
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// log warn
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE PAYMENT-RECON ]: ${JSON.stringify(result)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.status(200).json(result);
|
||||||
|
}
|
||||||
|
|
||||||
// check reservation number yang di request sudah berhasil di recon atau belum sebelumnnya
|
// check reservation number yang di request sudah berhasil di recon atau belum sebelumnnya
|
||||||
let checkReservationNumberAndAmountAlreadyRecon =
|
let checkReservationNumberAndAmountAlreadyRecon =
|
||||||
await model.checkReservationNumberAndAmountAlreadyRecon(
|
await model.checkReservationNumberAndAmountAlreadyRecon(
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
const knex = require("../../../infrastructure/database/knex");
|
const knex = require('../../../infrastructure/database/knex');
|
||||||
|
|
||||||
// GET PARTNER, MERCHANT, TERMINAL FROM TID
|
// GET PARTNER, MERCHANT, TERMINAL FROM TID
|
||||||
const getPartner = (mid, tid) => {
|
const getPartner = (mid, tid) => {
|
||||||
let result = knex
|
let result = knex
|
||||||
.select(
|
.select(
|
||||||
"t_m_partner.i_partner",
|
't_m_partner.i_partner',
|
||||||
"t_m_partner.c_code as partner_code",
|
't_m_partner.c_code as partner_code',
|
||||||
"t_m_partner.c_name as partner_name",
|
't_m_partner.c_name as partner_name',
|
||||||
"t_m_merchant.i_merchant",
|
't_m_partner.b_payment_recon',
|
||||||
"t_m_merchant.c_code as merchant_code",
|
't_m_merchant.i_merchant',
|
||||||
"t_m_merchant.c_name as merchant_name",
|
't_m_merchant.c_code as merchant_code',
|
||||||
"t_m_merchant.e_mid as mid",
|
't_m_merchant.c_name as merchant_name',
|
||||||
"t_m_terminal.i_terminal",
|
't_m_merchant.e_mid as mid',
|
||||||
"t_m_terminal.c_code as terminal_code",
|
't_m_terminal.i_terminal',
|
||||||
"t_m_terminal.c_name as terminal_name",
|
't_m_terminal.c_code as terminal_code',
|
||||||
"t_m_terminal.e_tid as tid"
|
't_m_terminal.c_name as terminal_name',
|
||||||
|
't_m_terminal.e_tid as tid'
|
||||||
)
|
)
|
||||||
.from("t_m_terminal")
|
.from('t_m_terminal')
|
||||||
.leftJoin(
|
.leftJoin(
|
||||||
"t_m_merchant",
|
't_m_merchant',
|
||||||
"t_m_terminal.i_merchant",
|
't_m_terminal.i_merchant',
|
||||||
"t_m_merchant.i_merchant"
|
't_m_merchant.i_merchant'
|
||||||
)
|
)
|
||||||
.leftJoin("t_m_partner", "t_m_merchant.i_partner", "t_m_partner.i_partner")
|
.leftJoin('t_m_partner', 't_m_merchant.i_partner', 't_m_partner.i_partner')
|
||||||
.where("t_m_merchant.e_mid", mid)
|
.where('t_m_merchant.e_mid', mid)
|
||||||
.where("t_m_terminal.e_tid", tid)
|
.where('t_m_terminal.e_tid', tid)
|
||||||
.where("t_m_terminal.c_status", "A")
|
.where('t_m_terminal.c_status', 'A')
|
||||||
.where("t_m_merchant.c_status", "A")
|
.where('t_m_merchant.c_status', 'A')
|
||||||
.where("t_m_partner.c_status", "A")
|
.where('t_m_partner.c_status', 'A')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -35,57 +36,66 @@ const getPartner = (mid, tid) => {
|
|||||||
const getPartnerByID = (partner_id) => {
|
const getPartnerByID = (partner_id) => {
|
||||||
let result = knex
|
let result = knex
|
||||||
.select(
|
.select(
|
||||||
"t_m_partner.i_partner",
|
't_m_partner.i_partner',
|
||||||
"t_m_partner.c_code as partner_code",
|
't_m_partner.c_code as partner_code',
|
||||||
"t_m_partner.c_name as partner_name"
|
't_m_partner.c_name as partner_name',
|
||||||
|
't_m_partner.b_payment_recon'
|
||||||
)
|
)
|
||||||
.from("t_m_partner")
|
.from('t_m_partner')
|
||||||
.where("t_m_partner.i_partner", partner_id)
|
.where('t_m_partner.i_partner', partner_id)
|
||||||
.where("t_m_partner.c_status", "A")
|
.where('t_m_partner.c_status', 'A')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkReservationNumberAndAmount = (reservationNumber) => {
|
const checkReservationNumberAndAmount = (reservationNumber) => {
|
||||||
let result = knex("trx.t_d_reservation_balance")
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
.count("* as total_transaction")
|
.count('* as total_transaction')
|
||||||
.sum("i_reservation_amount as total_amount")
|
.sum('i_reservation_amount as total_amount')
|
||||||
.groupBy("c_ref_no")
|
.groupBy('c_ref_no')
|
||||||
.where("c_reservation_no", reservationNumber)
|
.where('c_reservation_no', reservationNumber)
|
||||||
// .where("c_status", "A")
|
// .where("c_status", "A")
|
||||||
.whereNull("c_payment_recon_no")
|
.whereNull('c_payment_recon_no')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkReservationCanceledStatus = (reservationNumber) => {
|
const checkReservationCanceledStatus = (reservationNumber) => {
|
||||||
let result = knex("trx.t_d_reservation_balance")
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
.where("c_reservation_no", reservationNumber)
|
.where('c_reservation_no', reservationNumber)
|
||||||
.where("c_status", "X")
|
.where('c_status', 'X')
|
||||||
|
.first();
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkReservation = (reservationNumber) => {
|
||||||
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
|
.where('c_reservation_no', reservationNumber)
|
||||||
|
.where('c_status', '!=', 'X')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkReservationNumberAndAmountAlreadyRecon = (reservationNumber) => {
|
const checkReservationNumberAndAmountAlreadyRecon = (reservationNumber) => {
|
||||||
let result = knex("trx.t_d_reservation_balance")
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
.select("c_payment_recon_no", "d_payment_recon")
|
.select('c_payment_recon_no', 'd_payment_recon')
|
||||||
.where("c_reservation_no", reservationNumber)
|
.where('c_reservation_no', reservationNumber)
|
||||||
// .where("c_status", "A")
|
// .where("c_status", "A")
|
||||||
.whereNotNull("c_payment_recon_no")
|
.whereNotNull('c_payment_recon_no')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// UPDATE PAYMENT RECON
|
// UPDATE PAYMENT RECON
|
||||||
const updatePaymentReconNo = (data) => {
|
const updatePaymentReconNo = (data) => {
|
||||||
let result = knex("trx.t_d_reservation_balance")
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
.update({
|
.update({
|
||||||
c_payment_recon_no: data.payment_recon_no,
|
c_payment_recon_no: data.payment_recon_no,
|
||||||
d_payment: data.date,
|
d_payment: data.date,
|
||||||
d_payment_recon: data.time,
|
d_payment_recon: data.time,
|
||||||
})
|
})
|
||||||
.whereNull("c_payment_recon_no")
|
.whereNull('c_payment_recon_no')
|
||||||
.where("c_reservation_no", data.reservation_number);
|
.where('c_reservation_no', data.reservation_number);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,7 +114,7 @@ const insertPaymentReconTransaction = (
|
|||||||
responseMessage,
|
responseMessage,
|
||||||
responseData
|
responseData
|
||||||
) => {
|
) => {
|
||||||
let result = knex("payment.t_d_payment_recon").insert({
|
let result = knex('payment.t_d_payment_recon').insert({
|
||||||
d_payment: date,
|
d_payment: date,
|
||||||
d_payment_recon: now,
|
d_payment_recon: now,
|
||||||
c_partner_code: partnerCode,
|
c_partner_code: partnerCode,
|
||||||
@@ -123,34 +133,34 @@ const insertPaymentReconTransaction = (
|
|||||||
|
|
||||||
// INSERT TEMP PAYMENT RECON NUMBER
|
// INSERT TEMP PAYMENT RECON NUMBER
|
||||||
const insertPaymentReconNumber = (paymentReconNumber) => {
|
const insertPaymentReconNumber = (paymentReconNumber) => {
|
||||||
let result = knex("payment.t_d_payment_recon_no_validate")
|
let result = knex('payment.t_d_payment_recon_no_validate')
|
||||||
.insert({
|
.insert({
|
||||||
c_payment_recon_no: paymentReconNumber,
|
c_payment_recon_no: paymentReconNumber,
|
||||||
})
|
})
|
||||||
.onConflict("c_payment_recon_no")
|
.onConflict('c_payment_recon_no')
|
||||||
.ignore();
|
.ignore();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// GET LAST COUNTER PAYMENT RECON NO
|
// GET LAST COUNTER PAYMENT RECON NO
|
||||||
const getLastCounterPaymentReconNo = (partnerCode, reconDate) => {
|
const getLastCounterPaymentReconNo = (partnerCode, reconDate) => {
|
||||||
let result = knex("payment.t_d_payment_recon")
|
let result = knex('payment.t_d_payment_recon')
|
||||||
.select("c_payment_recon_no", "d_payment_recon")
|
.select('c_payment_recon_no', 'd_payment_recon')
|
||||||
.whereRaw("??::date = ?", ["d_payment_recon", reconDate])
|
.whereRaw('??::date = ?', ['d_payment_recon', reconDate])
|
||||||
.where("c_partner_code", partnerCode)
|
.where('c_partner_code', partnerCode)
|
||||||
// .orderBy("d_payment_recon", "desc")
|
// .orderBy("d_payment_recon", "desc")
|
||||||
.orderBy("c_payment_recon_no", "desc")
|
.orderBy('c_payment_recon_no', 'desc')
|
||||||
.first();
|
.first();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getReservationToRecon = (date) => {
|
const getReservationToRecon = (date) => {
|
||||||
let result = knex("trx.t_d_reservation_balance")
|
let result = knex('trx.t_d_reservation_balance')
|
||||||
.select("c_reservation_no", "i_reservation_amount")
|
.select('c_reservation_no', 'i_reservation_amount')
|
||||||
.whereNull("d_cancel")
|
.whereNull('d_cancel')
|
||||||
.whereNull("c_payment_recon_no")
|
.whereNull('c_payment_recon_no')
|
||||||
.whereRaw("??::date = ?", ["d_reservation", date])
|
.whereRaw('??::date = ?', ['d_reservation', date])
|
||||||
.orderBy("c_reservation_no", "asc");
|
.orderBy('c_reservation_no', 'asc');
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -159,6 +169,7 @@ module.exports = {
|
|||||||
getPartnerByID,
|
getPartnerByID,
|
||||||
checkReservationNumberAndAmount,
|
checkReservationNumberAndAmount,
|
||||||
checkReservationCanceledStatus,
|
checkReservationCanceledStatus,
|
||||||
|
checkReservation,
|
||||||
checkReservationNumberAndAmountAlreadyRecon,
|
checkReservationNumberAndAmountAlreadyRecon,
|
||||||
updatePaymentReconNo,
|
updatePaymentReconNo,
|
||||||
insertPaymentReconTransaction,
|
insertPaymentReconTransaction,
|
||||||
|
|||||||
@@ -216,9 +216,21 @@ const checkReservation = async (req, res) => {
|
|||||||
result = {
|
result = {
|
||||||
code: '412',
|
code: '412',
|
||||||
message: 'partner is not match',
|
message: 'partner is not match',
|
||||||
data: {},
|
data: {
|
||||||
|
body: req.body,
|
||||||
|
partner_id_token: req.partner_id_token,
|
||||||
|
partner_user_id_token: req.partner_user_id_token,
|
||||||
|
headers: req.headers,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// log warn
|
||||||
|
winston.logger.warn(
|
||||||
|
`${uniqueCode} [ RESPONSE RESERVATION-CHECK ]: ${JSON.stringify(
|
||||||
|
result
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
|
||||||
return res.status(200).json(result);
|
return res.status(200).json(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ DB_PORT_POOLING=5432
|
|||||||
DB_USER_POOLING=postgres
|
DB_USER_POOLING=postgres
|
||||||
DB_PASSWORD_POOLING=inhc0mmute_cms
|
DB_PASSWORD_POOLING=inhc0mmute_cms
|
||||||
|
|
||||||
|
# ==================================== LOKI =====================================
|
||||||
|
LOKI_URL=http://10.20.14.30:3100
|
||||||
|
|
||||||
# ==================================== LOKI =====================================
|
# ==================================== LOKI =====================================
|
||||||
LOKI_URL=http://localhost:3100
|
LOKI_URL=http://localhost:3100
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
@@ -51,6 +51,9 @@ var corsOptions = {
|
|||||||
// app.use(cors(corsOptions));
|
// app.use(cors(corsOptions));
|
||||||
app.use(cors(corsOptions));
|
app.use(cors(corsOptions));
|
||||||
|
|
||||||
|
// add static file
|
||||||
|
app.use(express.static('public'));
|
||||||
|
|
||||||
// parse requests of content-type - application/json
|
// parse requests of content-type - application/json
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user