mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 21:56:27 +00:00
Merge branch 'main' into zainal
This commit is contained in:
@@ -14,7 +14,7 @@ const validate = (method) => {
|
||||
.not()
|
||||
.isEmpty()
|
||||
.withMessage("Card Number is required"),
|
||||
body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
// body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
];
|
||||
case "loadingBalance":
|
||||
return [
|
||||
@@ -30,7 +30,7 @@ const validate = (method) => {
|
||||
.withMessage("Amount is required")
|
||||
.isNumeric()
|
||||
.withMessage("Amount is invalid format"),
|
||||
body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
// body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
body("reservation_number")
|
||||
.not()
|
||||
.isEmpty()
|
||||
@@ -84,13 +84,13 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
|
||||
// get issuer
|
||||
let getIssuer = await model.getIssuer(issuer);
|
||||
if (!getIssuer) {
|
||||
return res.status(400).json({
|
||||
code: "01",
|
||||
message: "issuer doesn't exist",
|
||||
data: [],
|
||||
});
|
||||
}
|
||||
// if (!getIssuer) {
|
||||
// return res.status(400).json({
|
||||
// code: "01",
|
||||
// message: "issuer doesn't exist",
|
||||
// data: [],
|
||||
// });
|
||||
// }
|
||||
|
||||
// get total reservation pending
|
||||
let getReservationPending = await model.getReservationPending(
|
||||
@@ -190,13 +190,13 @@ const loadingBalance = async (req, res) => {
|
||||
|
||||
// get issuer
|
||||
let getIssuer = await model.getIssuer(issuer);
|
||||
if (!getIssuer) {
|
||||
return res.status(400).json({
|
||||
code: "01",
|
||||
message: "issuer doesn't exist",
|
||||
data: [],
|
||||
});
|
||||
}
|
||||
// if (!getIssuer) {
|
||||
// return res.status(400).json({
|
||||
// code: "01",
|
||||
// message: "issuer doesn't exist",
|
||||
// data: [],
|
||||
// });
|
||||
// }
|
||||
|
||||
// get reservation status
|
||||
let getReservationStatus = await model.getReservationStatus(
|
||||
@@ -205,6 +205,14 @@ const loadingBalance = async (req, res) => {
|
||||
now
|
||||
);
|
||||
|
||||
if (getReservationStatus.length < 1) {
|
||||
return res.status(400).json({
|
||||
code: "01",
|
||||
message: "reservation has been expired",
|
||||
data: [],
|
||||
});
|
||||
}
|
||||
|
||||
// get total reservation pending
|
||||
let getReservationPending = await model.getReservationPending(
|
||||
card_number,
|
||||
|
||||
@@ -61,7 +61,7 @@ const getReservationStatus = (cardNumber, issuer, time) => {
|
||||
let result = knex("trx.t_d_reservation_balance")
|
||||
.select("c_status")
|
||||
.where("c_card_number", cardNumber)
|
||||
.where("c_issuer_code", issuer)
|
||||
// .where("c_issuer_code", issuer)
|
||||
.where("d_expired", ">=", time)
|
||||
.whereNotNull("c_payment_ref_no");
|
||||
return result;
|
||||
@@ -74,7 +74,7 @@ const getReservationPending = (cardNumber, issuer, time) => {
|
||||
// .count("* as total_reservation")
|
||||
.select("i_reservation_amount", "c_reservation_no")
|
||||
.where("c_card_number", cardNumber)
|
||||
.where("c_issuer_code", issuer)
|
||||
// .where("c_issuer_code", issuer)
|
||||
.where("c_status", "P")
|
||||
.where("d_expired", ">=", time)
|
||||
.whereNotNull("c_payment_ref_no");
|
||||
|
||||
@@ -20,7 +20,7 @@ const validate = (method) => {
|
||||
.withMessage("Amount is required")
|
||||
.isNumeric()
|
||||
.withMessage("Amount is invalid format"),
|
||||
body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
// body("issuer").not().isEmpty().withMessage("Issuer is required"),
|
||||
];
|
||||
case "updatePayment":
|
||||
return [
|
||||
@@ -84,13 +84,13 @@ const reservation = async (req, res) => {
|
||||
|
||||
// get issuer
|
||||
let getIssuer = await model.getIssuer(issuer);
|
||||
if (!getIssuer) {
|
||||
return res.status(400).json({
|
||||
code: "01",
|
||||
message: "issuer doesn't exist",
|
||||
data: [],
|
||||
});
|
||||
}
|
||||
// if (!getIssuer) {
|
||||
// return res.status(400).json({
|
||||
// code: "01",
|
||||
// message: "issuer doesn't exist",
|
||||
// data: [],
|
||||
// });
|
||||
// }
|
||||
|
||||
// get max reservation
|
||||
let getMaxReservation = await model.getMaxReservation();
|
||||
|
||||
@@ -158,7 +158,7 @@ const getReservationPending = (cardNumber, issuer, time) => {
|
||||
let result = knex("trx.t_d_reservation_balance")
|
||||
.count("* as total_reservation")
|
||||
.where("c_card_number", cardNumber)
|
||||
.where("c_issuer_code", issuer)
|
||||
// .where("c_issuer_code", issuer)
|
||||
.where("c_status", "P")
|
||||
.where("d_expired", ">=", time)
|
||||
.whereNotNull("c_payment_ref_no")
|
||||
|
||||
Reference in New Issue
Block a user