Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/checking/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const axios = require('axios');
///balance check start
module.exports = {
notifyVendor:async function (keyWord_data,service,transid,header) {
var keywordData = keyWord_data.split("/");
var keyWord=keywordData[0];
var client_id=keywordData[1];
var msisdn=keywordData[2];
var trans_id=keywordData[3];
const assign_data = await strapi.query('user', 'users-permissions').findOne( {token: header});
// console.log(assign_data.requestMethod);
var re_apiUrl=assign_data.apiUrl;
var re_apiMethod=assign_data.requestMethod;
var credentials=assign_data.credentials;
var authentication=assign_data.authentication;
var shortcode=service.shortCode;
var serviceId=service.serviceId;
var operator=service.operator;
var vendor_id=service.vendor.username;
// client_id=mars&shortcode=16466&msisdn=576834696530881298&key_word=EPL M FX1ALS019470010454745788
// &transid=3040110076279793657041877&operator=grameenphone&serviceid=PPU00027603112
async function notification() {
if (re_apiMethod==="GET") {
if(authentication=== 'JwtToken'){
try {
var get_response= await axios
.get(re_apiUrl+"?client_id="+client_id+"&shortcode="+shortcode+"&msisdn="+msisdn+"&key_word="+keyWord+"&operator="+operator+"&serviceid="+serviceId, {
headers: {
Authorization: `Bearer ${credentials}`,
},
})
return get_response.status;
} catch (error) {
return error.response.status;
}
}else if(authentication=== 'BasicAuth'){
console.log('basicAuth');
try {
var get_response= await axios.get('http://157.245.155.94:3000/bl', {
auth: {
username: 'wintel',
password: '12345678'
}
});
return get_response.status;
} catch (error) {
return error.response.status;
}
}else{
console.log('noAuth');
}
} else if(re_apiMethod==="POST") {
if(authentication=== 'JwtToken'){
try {
var post_response = await axios.post(
re_apiUrl,
{
client_id : String(client_id),
shortcode : String(shortcode),
msisdn : String(msisdn),
key_word : String(keyWord),
operator : String(operator),
serviceid : String(serviceId),
transid : String(transid),
},
{
headers: {
Authorization:
`Bearer ${credentials}`,
},
}
);
return post_response.status;
} catch (error) {
return error.response.status;
}
}else if(authentication=== 'BasicAuth'){
console.log('basicAuth Post');
}else{
console.log('noAuth Post');
}
}
}
var status_code = await notification();
const data={
vendor: String(vendor_id),
api: re_apiUrl,
method: re_apiMethod,
status: String(status_code),
tx_id : String(trans_id)
};
var res = await strapi.services.notification.create(data);
}
// end rate limit
} |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0056 ]-- |