mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 10:56:27 +00:00
57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
// Teks tetap yang boleh dicari persis seperti pesan yang dilaporkan klien.
|
|
// Pesan dari database, exception, dan layanan lain tidak otomatis masuk daftar ini.
|
|
const searchableMessages = new Set([
|
|
'Login Success.',
|
|
'Email is required',
|
|
'Email format wrong',
|
|
'Password is required',
|
|
'Password must be least 5 characters',
|
|
'MID is required',
|
|
'TID is required',
|
|
"Partner User doesn't exists.",
|
|
'Password is wrong.',
|
|
'MID or TID is not registered.',
|
|
"Terminal Login doesn't exists.",
|
|
'Terminal Login already exists.',
|
|
'Data login saved successfully.',
|
|
"TID MID doesn't exists.",
|
|
'New Token has been generated.',
|
|
'Refresh Token is invalid. Please login!!',
|
|
'Refresh Token is invalid. Please try login',
|
|
'Token is required',
|
|
'Invalid Token.',
|
|
'Header not found',
|
|
'Success',
|
|
'Card is Blacklisted',
|
|
'terminal id is not valid',
|
|
'partner is not match',
|
|
'card number is not registered',
|
|
"reservation doesn't exist",
|
|
'bad request. reservation data is invalid.',
|
|
'bad request. reservation data is empty.',
|
|
'reservation exists',
|
|
'amount must be greater than 0',
|
|
'your card number has reached the maximum balance',
|
|
'your card number has been limit top up for this month',
|
|
'update/insert failed',
|
|
'Wrong Respone from Card',
|
|
'Respone Card Wrong',
|
|
'Timeout',
|
|
'Empty Data from HSM',
|
|
'failed from HSM',
|
|
'500 internal server error - backend server.',
|
|
]);
|
|
|
|
function getSearchableResponseMessage(message) {
|
|
return searchableMessages.has(message) ? message : undefined;
|
|
}
|
|
|
|
function getResponseSummary({ level, http_status: httpStatus }) {
|
|
if (httpStatus === 404) return 'API route not found';
|
|
if (level === 'error') return 'API request failed';
|
|
if (level === 'warn') return 'API request rejected';
|
|
return 'API request completed';
|
|
}
|
|
|
|
module.exports = { getSearchableResponseMessage, getResponseSummary };
|