UNPKG

lbmclients

Version:

API LBM

988 lines (931 loc) 17.2 kB
/* LBM CLIENTS */ /* const https = require('node:https'); function httpsRequest(method, script) { const options = { hostname: 'encrypted.google.com', port: 443, path: '/', method: 'GET', }; return new Promise((resolve, reject) => { const req = https.request(options, (res) => { console.log('statusCode:', res.statusCode); console.log('headers:', res.headers); res.on('data', (d) => { console.log(d); process.stdout.write(d); resolve(d); }); }); req.on('error', (e) => { console.error(e); reject(e); }); req.end(); }); } */ import * as axios from 'axios'; var API = 'https://www.fmwenemwazi.xyz/alingapis/lbm/clients/'; var API_LOCAL = 'http://localhost/alingapis/lbm/clients/'; const version = '1007/'; const optionHTTP = {"Access-Control-Allow-Origin":"www.fmwenemwazi.xyz"}; function getData(script){ return new Promise((resolve, reject) => { axios.get(API + version + script + '.php', optionHTTP) .then((response)=>{ let rep = response.request.response; //console.log(rep); if (rep != undefined) { resolve(JSON.parse(rep)); } }) .catch((error)=>{ // handle error reject(error); }); }); } function getDataParam(script, key, param){ return new Promise((resolve, reject) => { // Make a request for a user with a given ID axios.get(API + version + script + '.php?' + key + '=' + param, optionHTTP) .then(function (response) { let rep = response.request.response; //console.log(rep); if (rep != undefined) { resolve(JSON.parse(rep)); } }) .catch(function (error) { // handle error reject(error); }); }); } function postData(script, data) { /* { method: "post", url : API + version + script +'.php', data: data, headers: optionHTTP } */ data = JSON.stringify(data); return new Promise((resolve, reject) => { axios.post(API + version + script +'.php', data, optionHTTP ).then(response =>{ let rep = response.request.response; //console.log(rep); if (rep != undefined) { resolve(JSON.parse(rep)); } }) .catch(error=>{ reject(error); }); }); } /* Init function*/ function initLBM(mode){ /* Attributs: mode : mode de travail. Production ou test */ if (mode != "prod") { API = API_LOCAL; } } /** Card management */ /** Attributs: */ function activateDebAcc(data) { return postData('activateDebAcc', data); } /** Attributs: */ function activateCrtAcc(data) { return postData('activateCrtAcc', data); } /** Attributs: idCpt: id compte, typeManda: type de mandataire, noms: noms mandataire, email: email mandataire, tel: tel mandataire, idCard: idCard client, pin: pin client */ function addUserOnAcc(data){ return postData('addUserOnAcc', data); } function askCard(data){ return postData('askCard', data); } function getCltCardReqs(idclt){ return getDataParam('getCltCardReqs', 'idclt', idclt); } function lostCard(data){ return postData('lostCard', data); } function uptCardReqStatus(data){ return postData('uptCardReqStatus', data); } /** Attributs: card: numero de la carte tpin: pin temporaire */ function resetPin(data){ return postData('resetPin', data); } /** Attributs: card : numero de la carte npin : nouveau pin opin : ancien pin */ function uptPin(data) { return postData('uptPin', data); } /** Attributs: card : numero de la carte pin : pin tmpAuth : numero d'auth temporaire */ function uptTmpAuth(data){ return postData('uptTmpAuth', data); } /** Attributs: card : numero de la carte */ function getMyTmpAuth(idCard){ return getDataParam('getMyTmpAuth', 'card', idCard); } /** Attributs: idMandat : id du mandataire */ function removeUserOnAcc(idMandat){ return getDataParam('removeUserOnAcc', 'idMandat', idMandat); } /** Attributs: */ function getAccsPartner(){ return getData('getAccsPartner'); } /** Attributs: */ function getAccsOwingBalance(){ return getData('getAccsOwingBalance'); } /** Attributs: prof : id profession */ function getAccsPartnerByProfession(prof){ return getDataParam('getAccsPartnerByProfession', 'prof', prof); } /** Attributs: */ function getAccsTrans(data){ return postData('getAccsTrans', data); } /** Attributs: name : */ function getOnlineAccByName(name){ return getDataParam('getOnlineAccByName', 'name', name); } /** Recupere les donnees d'un client Attributs: id : id du client */ function getClientDataById(id){ return getDataParam('getClientDataById', 'id', id); } /** Attributs: tel : telhone du client */ function getClientDataByTel(tel){ return getDataParam('getClientDataByTel', 'tel', tel); } /** Attributs: tel : telhone du client */ function getClientDataByName(name){ return getDataParam('getClientDataByName', 'name', name); } /** Attributs: None */ function geTransAllTrans(){ return getData('qwerty'); } /** Attributs: idtrans: id de la transaction */ function geTransByIdTrans(idtrans){ return getDataParam('geTrans', 'idtrans', idtrans); } /** Attributs: idtrans: id de la transaction */ function geTransByTransType(type){ return getDataParam('geTransByTransType', 'type', type); } /** * Attributs: * None */ function geTransType() { return getData('geTransType'); } /**Permet de lier les comptes associés a deux profils clients. * Attributs: * idsclt : tableau des ids clients a lier */ function linkAccs(data){ return postData('linkAccs', data); } /** Attributs: tel : telhone du client */ function updateCltData(data){ return postData('updateCltData', data); } /** Authentification compte en ligne. Attributs: pseudo: pseudo client mdp: mot de passe */ function auth(data){ return postData('auth', data); } /** Authentification compte en ligne pour gerant utilisateur du processor de paiement. Attributs: pseudo: pseudo client mdp: mot de passe */ function authPayMerchantAppManager(data){ return postData('authPayMerchantAppManager', data); } /** Attributs: */ function getCrdCardDetail(data) { return postData('getCardDetail', data); } /** Attributs: */ function getDebCardDetail(data) { return postData('getDebCardDetailByCrdIdAndPin', data); } function getDepViaMM(idCard){ return getDataParam('getDepViaMM', 'card', idCard); } function getMomoNumbers() { return getData('getMomoNumbers'); } /** Attributs: */ function getDevises() { return getData('getDevises'); } /** Attributs: status: acces: */ function getAccType(data) { return postData('geTypeCptNew', data); } /** * * */ function getOnlineAccType(){ return getData('getOnlineAccType'); } /** Attributs: pseudo: mdp: idclt: id du client */ function setOnlineAcc(data){ return postData('setOnlineAcc', data); } /** Attributs: acces: usager: manager: id du client */ function uptAccType(data){ return postData('uptAccType', data); } /***CREDIT CARD LIMIT MANAGEMENT*/ /** Attributs: */ function addCrtLim(data) { return postData('addCrtLim', data); } /** Retrait du cash via une carte credit Attributs: idCard: mtn: */ function cashAdvance(data){ return postData('cashAdvance', data); } /** Attributs: */ function payCrtBal(data){ return postData('payCrtBal', data); } /** Permet aux clients de payer le solde de leur carte de credit par un compte debit Attributs: idClt: idCardDest: idCardSrc: mtn: */ function payCrtBalWithDebitAcc(data){ return postData('payCrtBalWithDebitAcc', data); } /** Attributs: */ function updateCrtLimit(data) { return postData('uptCrtLim', data); } /***DEBIT CARD MANAGEMENT*/ /** Attributs: */ function addDebSold(data) { var script = 'addDebSold'; return postData(script, data); } /** * Attributs: * */ function buyPhoneCredit(data){ var script = 'buyPhoneCredit'; return postData(script, data); } /** Attributs: */ function depViaMobMoney(data) { var script = 'depViaMobMoney'; return postData(script, data); } /** Attributs: */ function getAccountsByType(data) { var script = 'getAccountsByType'; return postData(script, data); } /** Attributs: */ function debiTransfert(data) { var script = 'debiTransfert'; return postData(script, data); } /** Attributs: */ function depotReserve(data){ var script = 'depotReserve'; return postData(script, data); } /** Attributs: */ function debitSendByIdCard(data){ var script = 'debitSendByIdCard'; return postData(script, data); } /* */ function getAirtimeTarif() { return getData('getAirtimeTarif'); } /* Partner card managenent */ /** Attributs: store : id du magasin */ function getAccsPartnerByStore(store){ var script = 'getAccsPartnerByStore'; return getDataParam(script, 'store', store); } /* Payment */ /** Attributs: pin carte totFac typeTrans: dest: numero compte destinataire */ function payWithCrdCard(data) { var script = 'payWithCrdCard'; return postData(script, data); } /** Attributs: tmpAuth carte totFac typeTrans: dest: numero compte destinataire */ function payWithCrtCardTmpAuth(data) { var script = 'payWithCrtCardTmpAuth'; return postData(script, data); } /** Attributs: carte totFac typeTrans: dest: numero compte destinataire */ function payMerchandByCrtWithoutPin(data) { var script = 'payMerchandByCrtWithoutPin'; return postData(script, data); } /** Payer un service ou produit en magasin avec carte de credit Attributs: cardId : string = ""; pin: string = ""; merchandAccId: string = ""; amount: number = 0; */ function payMerchandServicesByCrt(data){ var script = 'payMerchandServicesByCrt'; return postData(script, data); } /** Attributs: idClt: , carte: , pin: , totFac: , dev: , typeTrans: , dest: , detail: */ function payPhoneAirtime(data){ return postData('payPhoneAirtime', data); } /** Attributs: carte: , pin: , totFac: , dev: , typeTrans: , dest: , detail: */ function payPassTrans(data) { return postData('payPassTrans', data); } /** Attributs: pin carte totFac typeTrans: dest: numero compte destinataire */ function payWithDebCard(data) { var script = 'payWithDebCard'; return postData(script, data); } /** Attributs: tmpAuth carte totFac typeTrans: dest: numero compte destinataire */ function payWithDebCardTmpAuth(data) { var script = 'payWithDebCardTmpAuth'; return postData(script, data); } /** Attributs: carte totFac typeTrans: dest: numero compte destinataire */ function payMerchandByDebWithoutPin(data) { var script = 'payMerchandByDebWithoutPin'; return postData(script, data); } /** Payer un service ou produit en magasin avec carte debit Attributs: cardId : string = ""; pin: string = ""; merchandAccId: string = ""; amount: number = 0; */ function payMerchandServicesByDeb(data){ var script = 'payMerchandServicesByDeb'; return postData(script, data); } /** Retrait d argent Attributs: idClt mtnR : amount to withdraw idCard modeRetrait reseau numero desc: commentaire */ function withdrawCltToMob(data){ var script = 'withdrawCltToMob'; return postData(script, data); } /** * Attributs: * */ function cashOutByClt(data){ var script = 'cashOutByClt'; return postData(script, data); } /***CREDIT CARD FUNCTION*/ /** Attributs: accNumber: numero de compte excBonus: bonus a echanger */ function exchangeBonus (data){ return postData('exchangeBonus', data); } /** Attributs: idClt: id du client */ function getCltAccs(idClt){ return getDataParam('getCltAccs', 'clt', idClt); } /** Attributs: cltName: id du client */ function getCltAccsByCltName(cltName){ return getDataParam('getCltAccsByCltName', 'cltName', cltName); } function uptCltCardId(data){ return postData('uptCltCardId', data); } function uptContacts (data){ return postData('uptContacts', data); } /** * Attributs : * * */ function uploadId(data){ var script = 'uploadId'; return postData(script, data); } /** * Attributs : * * */ function uptProfil(data) { var script = 'uploadId'; return postData(script, data); } /** * Attributs : * idbus: * succ: */ function getBusSuccDataId(data){ return postData('getBusSuccDataId', data); } /** Attributs: idacc : id du compte credit */ function getCrtAccByIdAcc(idacc) { var script = 'getCrtAccByIdAcc'; return getDataParam(script, 'idacc', idacc) } /** Attributs: id : id du client */ function getCrtAccByCltId (idClt){ var script = 'getCrtAccByCltId'; return getDataParam(script, 'id', idClt); } /** Attributs: name : nom du client */ function getCrtAccByCltName (name){ var script = 'getCrtAccByCltName'; return getDataParam(script, 'name', name); } /** Attributs: idClt: id client, idCard: id de la carte */ function getCrtCardByCltId(data){ var script = 'getCrtCardByCltId'; return postData(script, data); } /***DEBIT CARD FUNCTION*/ /** Retourne les comptes debits Attributs: Aucun */ function getDebAccs(){ var script = 'getDebAccs'; return getData(script); } /** Retourne les comptes debits Attributs: Aucun */ function getDebAccsMan(){ var script = 'getDebAccsMan'; return getData(script); } /** Attributs: name : nom du client */ function getDebAccByCltName (name){ var script = 'getDebAccByCltName'; return getDataParam(script, 'name', name); } /** Attributs: idacc : id du compte credit */ function getDebAccByIdAcc(idacc) { var script = 'getDebAccByIdAcc'; return getDataParam(script, 'idacc', idacc) } /** Attributs: id : id du client */ function getDebAccByCltId (idClt){ var script = 'getDebAccByCltId'; return getDataParam(script, 'id', idClt); } /** Attributs: idClt: id client idCard: id de la carte */ function getDebCardByCltId(data){ var script = 'getDebCardByCltId'; return postData(script, data); } /** Attributs: idEmpl: */ function getManCptdetail(data){ var script = 'getManCptdetail'; return postData(script, data); } /* OTD */ /** Client entreprise * cltCpt * mtn * busCpt:acc bus */ function billOTD(data){ var script = 'billOTD'; return postData(script, data); } /** Client entreprise * busCpt * idOTD */ function delOTD(data){ var script = 'delOTD'; return postData(script, data); } /** Client particulier * myCpt * mtn * busCpt:acc bus * cycle * duree */ function setOTD(data){ var script = 'setOTD'; return postData(script, data); } /* PRETS */ function askPret(data){ return postData('askPret', data); } function payPret(data){ return postData('payPret', data); } function getMyPayment(idacc){ return getDataParam('getMyPayment', 'idacc', idacc); } function getMyPretByIdAndIdAcc(data){ return postData('getMyPretByIdAndIdAcc', data); } function getMyPrets(idacc){ return getDataParam('getMyPrets', 'idacc', idacc); } /* AVANCE SUR SALAIRE */ function askAvSS(data){ return postData('askAvSS', data); } function getMesAvSS(idacc){ return getDataParam('getMesAvSS', 'idacc', idacc); } /* TRANSPASS */ function getAvailTransPass() { return getData('getAvailTransPass'); } function getBusPass(idbus) { return getDataParam('getBusPass', 'idbus', idbus); } function getMyTransPass(idClt) { return getDataParam('getMyTransPass', 'idClt', idClt); } function getTransPassBus() { return getData('getTransPassBus'); } function passAdd(data) { return postData('passAdd', data); } function passBuy(data) { return postData('passBuy', data); } function passPay(data) { return postData('passPay', data); } export { /***API MANAGEMENT*/ initLBM, /***ONLINE ACC MANAGEMENT*/ getOnlineAccType, setOnlineAcc, uptAccType, /***ACC MANAGEMENT*/ auth, authPayMerchantAppManager, activateDebAcc, activateCrtAcc, getAccountsByType, getAccsPartner, getAccsOwingBalance, getAccsPartnerByProfession, getAccsTrans, getOnlineAccByName, geTransAllTrans, geTransByIdTrans, geTransByTransType, geTransType, linkAccs, /***CLIENT DATA*/ exchangeBonus, getClientDataById, getClientDataByTel, getClientDataByName, getCltAccs, getCltAccsByCltName, uptCltCardId, uptContacts, updateCltData, uploadId, uptProfil, getBusSuccDataId, /***TABLE CARD MANAGEMENT*/ addUserOnAcc, askCard, getAccType, getCltCardReqs, getDevises, getMyTmpAuth, lostCard, uptCardReqStatus, uptPin, uptTmpAuth, removeUserOnAcc, resetPin, /***CREDIT*/ addCrtLim, cashAdvance, getCrtAccByIdAcc, getCrtAccByCltId, getCrtAccByCltName, getCrtCardByCltId, getCrdCardDetail, payCrtBal, payCrtBalWithDebitAcc, updateCrtLimit, payWithCrdCard, payWithCrtCardTmpAuth, payMerchandByCrtWithoutPin, payMerchandServicesByCrt, /***DEBIT*/ addDebSold, buyPhoneCredit, depViaMobMoney, debiTransfert, depotReserve, debitSendByIdCard, getAirtimeTarif, getDebAccs, getDebAccsMan, getDebAccByIdAcc, getDebAccByCltId, getDebAccByCltName, getDebCardByCltId, getDebCardDetail, getDepViaMM, getMomoNumbers, payPhoneAirtime, payPassTrans, payWithDebCard, payWithDebCardTmpAuth, payMerchandByDebWithoutPin, payMerchandServicesByDeb, withdrawCltToMob, cashOutByClt, getManCptdetail, setOTD, delOTD, billOTD, //Prets askPret, payPret, getMyPayment, getMyPretByIdAndIdAcc, getMyPrets, //Avance askAvSS, getMesAvSS, //Transpass getAvailTransPass, getBusPass, getMyTransPass, getTransPassBus, passAdd, passBuy, passPay }; getAvailTransPass();