mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 23:36:28 +00:00
Merge branch 'main' of https://github.com/mohamadihsan/topuponline into nuranggi
This commit is contained in:
@@ -377,7 +377,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
const getMaxTopupPerMonth = await model.getMaxTopupPerMonth();
|
||||
if (getMaxTopupPerMonth.c_value) {
|
||||
if (
|
||||
parseInt(accumulatedBalance) > parseInt(getMaxTopupPerMonth.c_value)
|
||||
parseInt(accumulatedBalance) + parseInt(amountTopup) > parseInt(getMaxTopupPerMonth.c_value)
|
||||
) {
|
||||
result = {
|
||||
code: "417",
|
||||
|
||||
@@ -941,6 +941,50 @@ const inquiryReservation = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
const inquiryReservationByReservation = async (req, res) => {
|
||||
try {
|
||||
// param
|
||||
let { reservation_number } = req.body;
|
||||
|
||||
// validation parameter inquiry
|
||||
if (!reservation_number) {
|
||||
return res.status(200).json({
|
||||
code: "400",
|
||||
message: "bad request. please add the reservation number!",
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
|
||||
// check reservation
|
||||
let byReservationNumber = await model.inquiryByReservationNumber(
|
||||
reservation_number
|
||||
);
|
||||
|
||||
if (!byReservationNumber) {
|
||||
return res.status(200).json({
|
||||
code: "414",
|
||||
message: "reservation doesn't exist",
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
|
||||
return res.json({
|
||||
code: "00",
|
||||
message: "reservation has been found.",
|
||||
data: byReservationNumber,
|
||||
});
|
||||
} catch (error) {
|
||||
return res.status(200).json({
|
||||
code: "500",
|
||||
message:
|
||||
process.env.NODE_ENV != "production"
|
||||
? error.message
|
||||
: "500 internal server error - backend server.",
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// GENERATE RESERVATION NUMBER
|
||||
const generateReservationNumber = async (data, date, counter) => {
|
||||
let code = data.partner_code ? data.partner_code : "XXX";
|
||||
@@ -1050,8 +1094,8 @@ const cancelReservationValidate = async (req, res) => {
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE cancel reservation validate: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
@@ -1065,8 +1109,8 @@ const cancelReservationValidate = async (req, res) => {
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE cancel reservation validate: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
@@ -1206,8 +1250,8 @@ const cancelReservation = async (req, res) => {
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE cancel reservation: ${JSON.stringify(result)}`
|
||||
);
|
||||
|
||||
@@ -1219,8 +1263,8 @@ const cancelReservation = async (req, res) => {
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE cancel reservation validate: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
@@ -1235,8 +1279,8 @@ const cancelReservation = async (req, res) => {
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE cancel reservation: ${JSON.stringify(result)}`
|
||||
);
|
||||
|
||||
@@ -1335,6 +1379,7 @@ module.exports = {
|
||||
reservationValidate,
|
||||
reservation,
|
||||
inquiryReservation,
|
||||
inquiryReservationByReservation,
|
||||
cancelReservationValidate,
|
||||
cancelReservation,
|
||||
};
|
||||
|
||||
@@ -140,6 +140,8 @@ let inquiryByReservationNumber = (reservationNumber) => {
|
||||
"i_reservation_amount as reservation_amount",
|
||||
"i_issuer_fee as issuer_fee",
|
||||
"i_channel_fee as channel_fee",
|
||||
"c_payment_recon_no as payment_recon_no",
|
||||
"d_payment_recon as recon_date",
|
||||
"c_status as status_code",
|
||||
"c_status_name as description"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user