Payeer e AdvCash
This commit is contained in:
@@ -65,8 +65,11 @@ UserCost = {
|
||||
'profile.teleg_id',
|
||||
'profile.saw_zoom_presentation',
|
||||
'profile.saw_and_accepted',
|
||||
'profile.revolut',
|
||||
'profile.payeer_id',
|
||||
'profile.advcash_id',
|
||||
'profile.link_payment',
|
||||
'profile.email_paypal',
|
||||
'profile.my_dream',
|
||||
'profile.paymenttypes']
|
||||
};
|
||||
|
||||
@@ -289,70 +292,6 @@ router.post('/gettable', authenticate, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
async function checkIfSbloccatiRequisiti(idapp, allData, id) {
|
||||
|
||||
if (!allData.myuser)
|
||||
return false;
|
||||
|
||||
if (await Nave.checkIfNaveExist(idapp, allData.myuser.username)) {
|
||||
// Se già sei dentro la Nave, allora sei OK
|
||||
return true;
|
||||
}
|
||||
|
||||
// Controlla se Sblocca i 7 requisiti
|
||||
const is7req = await User.isUserQualified7(idapp, allData.myuser.username);
|
||||
const is9req = await User.isUserQualified9(idapp, allData.myuser.username);
|
||||
|
||||
const userlista = await ListaIngresso.getListaTessByUsername(idapp, allData.myuser.username);
|
||||
if (userlista.length === 0) {
|
||||
// Se non sono ancora dentro alla lista, allora controllo
|
||||
|
||||
if (!!allData.precDataUser) {
|
||||
if ((!allData.precDataUser.is7req && is7req) && !await User.isUserAlreadyQualified(idapp, allData.myuser.username)) {
|
||||
await User.setUserQualified(idapp, allData.myuser.username);
|
||||
// ORA HAI I 7 REQUISITI !
|
||||
// const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_7_REQUISITI', allData.myuser.lang);
|
||||
// telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, true); // Anche a STAFF
|
||||
|
||||
// Aggiungilo alla ListaIngresso
|
||||
risingr = await ListaIngresso.addUserInListaIngresso(idapp, allData.myuser.username, allData.myuser.aportador_iniziale, allData.myuser.lang, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!!allData.precDataUser) {
|
||||
if ((!allData.precDataUser.is9req && is9req) && !await User.isUserAlreadyQualified_2Invitati(idapp, allData.myuser.username)) {
|
||||
await User.setUserQualified_2Invitati(idapp, allData.myuser.username);
|
||||
// ORA HAI I 9 REQUISITI !
|
||||
const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.myuser.lang);
|
||||
telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, false); // Anche a STAFF
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CHECK APORTADOR SOLIDARIO:
|
||||
if (!!allData.useraportador) {
|
||||
/*
|
||||
const is9reqAportador = await User.isUserQualified9(idapp, allData.myuser.aportador_solidario);
|
||||
|
||||
if (!allData.precDataAportador.is9req && is9reqAportador) {
|
||||
// ORA HAI I 9 REQUISITI !
|
||||
const msgtext = telegrambot.getCiao(idapp, allData.myuser.aportador_solidario, allData.useraportador.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.useraportador.lang);
|
||||
telegrambot.sendMsgTelegram(idapp, allData.myuser.aportador_solidario, msgtext, true); // Anche a STAFF
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function getInfoUser(idapp, username) {
|
||||
return {
|
||||
username,
|
||||
is7req: await User.isUserQualified7(idapp, username),
|
||||
is9req: await User.isUserQualified9(idapp, username),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
router.patch('/setlang', authenticate, async (req, res) => {
|
||||
const username = req.body.data.username;
|
||||
@@ -407,7 +346,7 @@ router.patch('/chval', authenticate, async (req, res) => {
|
||||
allData = {};
|
||||
allData.myuser = await User.getUserById(idapp, id);
|
||||
if (!!allData.myuser)
|
||||
allData.precDataUser = await getInfoUser(idapp, allData.myuser.username);
|
||||
allData.precDataUser = await User.getInfoUser(idapp, allData.myuser.username);
|
||||
else
|
||||
allData.precDataUser = null;
|
||||
// allData.useraportador = await ListaIngresso.getUserByInvitante_Username(idapp, allData.myuser.aportador_solidario);
|
||||
@@ -513,7 +452,7 @@ router.patch('/chval', authenticate, async (req, res) => {
|
||||
|
||||
if (mydata.table === 'users') {
|
||||
if (camporequisiti) {
|
||||
await checkIfSbloccatiRequisiti(idapp, allData, id);
|
||||
await User.checkIfSbloccatiRequisiti(idapp, allData, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +463,14 @@ router.patch('/chval', authenticate, async (req, res) => {
|
||||
}
|
||||
|
||||
if (mydata.table === 'users') {
|
||||
if ('saw_zoom_presentation' in fieldsvalue) {
|
||||
if (fieldsvalue['saw_zoom_presentation']) {
|
||||
const messaggio = tools.get__('ZOOM_CONFERMATO');
|
||||
await telegrambot.sendMsgTelegram(idapp, myuser.username, messaggio);
|
||||
await telegrambot.sendMsgTelegramToTheManagersAndZoomeri(idapp, `L\'utente ${rec.name} ${rec.surname} (${rec.username}) è stato confermato per aver visto lo Zoom di Benvenuto`);
|
||||
}
|
||||
}
|
||||
|
||||
if ('aportador_solidario' in fieldsvalue) {
|
||||
ind_order_ingr = mydata.ind_order_ingr;
|
||||
// SERVE SE CI METTO LE MINUSCOLE/MAIUSCOLE SBAGLIATE in invitante_username!
|
||||
@@ -760,8 +707,11 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
// ELIMINO LA LISTAINGRESSO CHE STO SOSTITUENDO (SOLO SE NON VIENE USATA DA ALTRA NAVE!)
|
||||
let eliminatoingr = await ListaIngresso.eliminaListaIngresso(idapp, mianavedasost.ind_order, req, mianavedasost.num_tess);
|
||||
|
||||
if (!eliminatoingr){
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, msg: 'La Sostituzione non può avvenire ! Contattare Paolo. (ind_order=' + mianavedasost.ind_order + ')' });
|
||||
if (!eliminatoingr) {
|
||||
return res.send({
|
||||
code: server_constants.RIS_CODE_ERR,
|
||||
msg: 'La Sostituzione non può avvenire ! Contattare Paolo. (ind_order=' + mianavedasost.ind_order + ')'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -937,6 +887,17 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
} else if (mydata.myfunc === shared_consts.CallFunz.ZOOM_GIA_PARTECIPATO) {
|
||||
|
||||
if (!!myuser.username) {
|
||||
FormDaMostrare = telegrambot.getFormDaMostrare(idapp, mydata.myfunc, myuser);
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, `L\'utente ${myuser.name} ${myuser.surname} (${myuser.username}) ha detto di aver già visto lo Zoom di Benvenuto`, false, FormDaMostrare);
|
||||
|
||||
const ris = await User.findByIdAndUpdate(myuser.id, { $set: { 'profile.ask_zoom_partecipato': true } });
|
||||
if (ris)
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||
}
|
||||
}
|
||||
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR });
|
||||
@@ -1036,7 +997,10 @@ router.delete('/delrec/:table/:id', authenticate, async (req, res) => {
|
||||
|
||||
if (cancellato) {
|
||||
// Do extra things after deleted
|
||||
return actions.doOtherThingsAfterDeleted(tablename, myrec, notifBot, req);
|
||||
ris = await actions.doOtherThingsAfterDeleted(tablename, myrec, notifBot, req);
|
||||
if (!!ris) {
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||
}
|
||||
}
|
||||
|
||||
res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
||||
|
||||
Reference in New Issue
Block a user