mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 23:36:28 +00:00
Refactor backend services and preserve transaction contracts
This commit is contained in:
@@ -1,51 +1,11 @@
|
||||
const { param, body, validationResult } = require('express-validator');
|
||||
const { validationResult } = require('express-validator');
|
||||
const validate = require('./loadbalance.validation');
|
||||
const helper = require('../../helpers/helper');
|
||||
const winston = require('../../helpers/winston.logger');
|
||||
const model = require('./loadbalance.model');
|
||||
const moment = require('moment');
|
||||
moment.locale('id');
|
||||
|
||||
// VALIDATION
|
||||
const validate = (method) => {
|
||||
switch (method) {
|
||||
case 'loadingBalanceRequest':
|
||||
return [
|
||||
body('mid').not().isEmpty().withMessage('MID is required'),
|
||||
body('tid').not().isEmpty().withMessage('TID is required'),
|
||||
body('uid').not().isEmpty().withMessage('UID is required'),
|
||||
body('flag').not().isEmpty().withMessage('Flag is required'),
|
||||
body('card_number')
|
||||
.not()
|
||||
.isEmpty()
|
||||
.withMessage('Card Number is required'),
|
||||
];
|
||||
case 'loadingBalance':
|
||||
return [
|
||||
body('mid').not().isEmpty().withMessage('MID is required'),
|
||||
body('tid').not().isEmpty().withMessage('TID is required'),
|
||||
body('uid').not().isEmpty().withMessage('UID is required'),
|
||||
body('flag').not().isEmpty().withMessage('Flag is required'),
|
||||
body('card_number')
|
||||
.not()
|
||||
.isEmpty()
|
||||
.withMessage('Card Number is required'),
|
||||
body('amount')
|
||||
.not()
|
||||
.isEmpty()
|
||||
.withMessage('Amount is required')
|
||||
.isNumeric()
|
||||
.withMessage('Amount is invalid format'),
|
||||
body('reservation_number')
|
||||
.not()
|
||||
.isEmpty()
|
||||
.withMessage('Reservation Number is required')
|
||||
.isArray()
|
||||
.withMessage('Reservation Number is invalid request format'),
|
||||
];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// ==================================================== FUNCTION UPDATE ALL TRANSACTION ======================================================
|
||||
// *Created By: Mohamad Ihsan*
|
||||
|
||||
Reference in New Issue
Block a user