mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 10:46:28 +00:00
update
This commit is contained in:
@@ -50,7 +50,7 @@ const login = async (req, res, next) => {
|
||||
// validate
|
||||
const err = validationResult(req);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -60,7 +60,7 @@ const login = async (req, res, next) => {
|
||||
// check mid dan tid
|
||||
let checkMidTid = await model.checkMidTid(mid, tid);
|
||||
if (!checkMidTid) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "MID or TID is not registered.",
|
||||
data: [],
|
||||
@@ -70,7 +70,7 @@ const login = async (req, res, next) => {
|
||||
// check data login
|
||||
let checkDataLogin = await model.checkDataLogin(mid, tid);
|
||||
if (!checkDataLogin) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "Terminal Login already exists.",
|
||||
data: [],
|
||||
@@ -80,7 +80,7 @@ const login = async (req, res, next) => {
|
||||
// check password
|
||||
let checkPassword = await bcrypt.compare(password, checkDataLogin.c_password_hash);
|
||||
if (!checkPassword) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "Password is wrong.",
|
||||
data: [],
|
||||
@@ -127,7 +127,7 @@ const register = async (req, res) => {
|
||||
// validate
|
||||
const err = validationResult(req);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -137,7 +137,7 @@ const register = async (req, res) => {
|
||||
// check mid dan tid
|
||||
let checkMidTid = await model.checkMidTid(mid, tid);
|
||||
if (!checkMidTid) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "MID or TID is not registered.",
|
||||
data: [],
|
||||
@@ -147,7 +147,7 @@ const register = async (req, res) => {
|
||||
// check data login
|
||||
let checkDataLogin = await model.checkDataLogin(mid, tid);
|
||||
if (checkDataLogin) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "Terminal Login already exists.",
|
||||
data: [],
|
||||
@@ -199,7 +199,7 @@ const refreshToken = async (req, res) => {
|
||||
// validate
|
||||
const err = validationResult(req);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -215,7 +215,7 @@ const refreshToken = async (req, res) => {
|
||||
refresh_token
|
||||
);
|
||||
if (!checkRefreshToken) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "Refresh Token is invalid. Please try login",
|
||||
data: [],
|
||||
|
||||
@@ -47,7 +47,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
// check validator
|
||||
const err = validationResult(req, res);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -63,7 +63,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
// get partner, merchant, terminal from tid
|
||||
let getPartner = await model.getPartner(mid, tid);
|
||||
if (!getPartner) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "terminal id is not valid",
|
||||
data: [],
|
||||
@@ -73,7 +73,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
// check card number
|
||||
let checkCardNumber = await model.checkCardNumber(card_number);
|
||||
if (!checkCardNumber) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "card number is not registered",
|
||||
data: [],
|
||||
@@ -87,7 +87,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
);
|
||||
|
||||
if (getReservationPending.length < 1) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "reservation doesn't exist",
|
||||
data: [],
|
||||
@@ -115,7 +115,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
parseInt(accumulatedBalance) + parseInt(amountTopup) >
|
||||
parseInt(getMaxTopupPerMonth.c_value)
|
||||
) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "your card number has been limit top up for this month",
|
||||
data: [],
|
||||
@@ -150,7 +150,7 @@ const loadingBalance = async (req, res) => {
|
||||
// check validator
|
||||
const err = validationResult(req, res);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -168,7 +168,7 @@ const loadingBalance = async (req, res) => {
|
||||
// get partner, merchant, terminal from tid
|
||||
let getPartner = await model.getPartner(mid, tid);
|
||||
if (!getPartner) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "terminal id is not valid",
|
||||
data: [],
|
||||
@@ -178,7 +178,7 @@ const loadingBalance = async (req, res) => {
|
||||
// get issuer
|
||||
let getIssuer = await model.getIssuer('test');
|
||||
// if (!getIssuer) {
|
||||
// return res.status(400).json({
|
||||
// return res.status(200).json({
|
||||
// code: "01",
|
||||
// message: "issuer doesn't exist",
|
||||
// data: [],
|
||||
@@ -192,7 +192,7 @@ const loadingBalance = async (req, res) => {
|
||||
);
|
||||
|
||||
if (getReservationPending.length < 1) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "reservation doesn't exist",
|
||||
data: [],
|
||||
@@ -258,7 +258,7 @@ const loadingBalance = async (req, res) => {
|
||||
var reservation = await model.findReservation(reservation_number[index]);
|
||||
|
||||
if (!reservation) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "reservation number doesn't exist",
|
||||
data: [],
|
||||
|
||||
@@ -47,7 +47,7 @@ const reservation = async (req, res) => {
|
||||
// check validator
|
||||
const err = validationResult(req, res);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -64,7 +64,7 @@ const reservation = async (req, res) => {
|
||||
// get partner, merchant, terminal from tid
|
||||
let getPartner = await model.getPartner(mid, tid);
|
||||
if (!getPartner) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "terminal id is not valid",
|
||||
data: [],
|
||||
@@ -74,7 +74,7 @@ const reservation = async (req, res) => {
|
||||
// check card number
|
||||
let checkCardNumber = await model.checkCardNumber(card_number);
|
||||
if (!checkCardNumber) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "card number is not registered",
|
||||
data: [],
|
||||
@@ -84,7 +84,7 @@ const reservation = async (req, res) => {
|
||||
// get issuer
|
||||
let getIssuer = await model.getIssuer("test");
|
||||
// if (!getIssuer) {
|
||||
// return res.status(400).json({
|
||||
// return res.status(200).json({
|
||||
// code: "01",
|
||||
// message: "issuer doesn't exist",
|
||||
// data: [],
|
||||
@@ -108,7 +108,7 @@ const reservation = async (req, res) => {
|
||||
: 0;
|
||||
|
||||
if (totalReservationPending >= maxReservation) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message:
|
||||
"your card number has some pending transaction. Please finished it!",
|
||||
@@ -129,7 +129,7 @@ const reservation = async (req, res) => {
|
||||
parseInt(accumulatedBalance) + parseInt(amount) >
|
||||
parseInt(getMaxTopupPerMonth.c_value)
|
||||
) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "your card number has been limit top up for this month",
|
||||
data: [],
|
||||
@@ -234,7 +234,7 @@ const updatePayment = async (req, res) => {
|
||||
// check validator
|
||||
const err = validationResult(req, res);
|
||||
if (!err.isEmpty()) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: err.errors[0].msg,
|
||||
data: [],
|
||||
@@ -250,7 +250,7 @@ const updatePayment = async (req, res) => {
|
||||
// check reservation
|
||||
const findReservation = await model.findReservation(reservation_number);
|
||||
if (!findReservation) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "reservation doesn't exist",
|
||||
data: [],
|
||||
@@ -268,7 +268,7 @@ const updatePayment = async (req, res) => {
|
||||
// get channel
|
||||
let getChannel = await model.getChannel(channel);
|
||||
if (!getChannel) {
|
||||
return res.status(400).json({
|
||||
return res.status(200).json({
|
||||
code: "01",
|
||||
message: "channel doesn't exist",
|
||||
data: [],
|
||||
|
||||
Reference in New Issue
Block a user