mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
Merge branch 'feature_cancel_reservation_v2' into develop
This commit is contained in:
@@ -3122,6 +3122,21 @@ const cancelReservationValidateV2 = async (req, res) => {
|
||||
|
||||
// get partner, merchant, terminal from tid
|
||||
let getPartner = await model.getPartner(mid, tid);
|
||||
if (!getPartner) {
|
||||
result = {
|
||||
code: '412',
|
||||
message: 'terminal id is not valid',
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} [ RESPONSE CANCEL-RESERVATION-VALIDATE ]: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
);
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
|
||||
// log debug
|
||||
// proses pengecekkan status reservation number yang di request
|
||||
@@ -3134,8 +3149,40 @@ const cancelReservationValidateV2 = async (req, res) => {
|
||||
reservation_number
|
||||
);
|
||||
|
||||
if (!getReservationCanBeCanceled) {
|
||||
result = {
|
||||
code: '414',
|
||||
message: "Reservation doesn't exist.",
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} [ RESPONSE CANCEL-RESERVATION-VALIDATE ]: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
);
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
|
||||
// get value global parameter
|
||||
let getGlobalParameter = await model.getGlobalParameter();
|
||||
// check value global parameter
|
||||
if (!getGlobalParameter) {
|
||||
result = {
|
||||
code: '493',
|
||||
message: 'HSM_CANCEL_RESERVATION_LEVEL in global parameter not found',
|
||||
data: {},
|
||||
};
|
||||
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} [ RESPONSE CANCEL-RESERVATION-VALIDATE ]: ${JSON.stringify(
|
||||
result
|
||||
)}`
|
||||
);
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
// validasi sesuai value global parameter
|
||||
if (getGlobalParameter.c_value == 'PARTNER') {
|
||||
if (getPartner.i_partner != getReservationCanBeCanceled.i_partner) {
|
||||
@@ -3585,7 +3632,10 @@ const cancelReservationV2 = async (req, res) => {
|
||||
result = {
|
||||
code: '00',
|
||||
message: 'reservation successfully canceled.',
|
||||
data: {},
|
||||
data: {
|
||||
reservation_number: getReservationCanBeCanceled.c_reservation_no,
|
||||
reservation_amount: getReservationCanBeCanceled.i_reservation_amount,
|
||||
},
|
||||
};
|
||||
|
||||
// log info
|
||||
|
||||
Reference in New Issue
Block a user