Payeer e AdvCash
This commit is contained in:
@@ -15,6 +15,10 @@ const telegrambot = require('../../telegram/telegrambot');
|
||||
module.exports = {
|
||||
doOtherThingsAfterDeleted: async function (tablename, rec, notifBot, req) {
|
||||
try {
|
||||
|
||||
const { User } = require('../../models/user');
|
||||
const telegrambot = require('../../telegram/telegrambot');
|
||||
|
||||
let ris = null;
|
||||
|
||||
const { ListaIngresso } = require('../../models/listaingresso');
|
||||
@@ -73,7 +77,7 @@ module.exports = {
|
||||
|
||||
addtext = 'Eliminato il Record "' + nomerecord + '" dalla tabella ' + tablename + '\n' +
|
||||
'Eseguito da ' + req.user.name + ' ' + req.user.surname + ' \n';
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, addtext);
|
||||
await telegrambot.sendMsgTelegramToTheManagers(rec.idapp, addtext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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: '' });
|
||||
|
||||
@@ -33,7 +33,7 @@ router.post('/load', async (req, res) => {
|
||||
num_teleg_pending: await User.getUsersTelegramPending(idapp),
|
||||
// num_qualificati: await User.getNumUsersQualified(idapp, 2),
|
||||
// num_requisiti: await User.getNumUsersQualified(idapp, 0),
|
||||
num_modalita_pagamento: await User.getnumPaymentOk(idapp),
|
||||
// num_modalita_pagamento: await User.getnumPaymentOk(idapp),
|
||||
num_part_zoom: await User.getUsersZoom(idapp),
|
||||
num_part_accepted: await User.getSaw_and_Accepted(idapp),
|
||||
arr_nations: await User.findAllDistinctNationality(idapp),
|
||||
|
||||
@@ -68,11 +68,10 @@ router.post('/', async (req, res) => {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (tools.blockwords(body.username)) {
|
||||
tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname);
|
||||
await tools.snooze(100000);
|
||||
res.status(400).send({ code: server_constants.RIS_CODE_USERNAME_NOT_VALID, msg: '' });
|
||||
return 1;
|
||||
if (tools.blockwords(body.username) || tools.blockwords(body.name) || tools.blockwords(body.surname)) {
|
||||
// tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname);
|
||||
await tools.snooze(5000);
|
||||
return res.status(404).send();
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +167,8 @@ router.post('/', async (req, res) => {
|
||||
user.profile.saw_and_accepted = recorig.profile.saw_and_accepted;
|
||||
user.profile.my_dream = recorig.profile.my_dream;
|
||||
user.profile.email_paypal = recorig.profile.email_paypal;
|
||||
user.profile.payeer_id = recorig.profile.payeer_id;
|
||||
user.profile.advcash_id = recorig.profile.advcash_id;
|
||||
user.profile.revolut = recorig.profile.revolut;
|
||||
user.profile.link_payment = recorig.profile.link_payment;
|
||||
user.profile.note_payment = recorig.profile.note_payment;
|
||||
@@ -507,6 +508,10 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
||||
ris = await User.flagUtentiNaviNonPresenti(idapp);
|
||||
} else if (mydata.dbop === 'generaFlotte') {
|
||||
ris = await NavePersistente.generaFlotte(idapp);
|
||||
} else if (mydata.dbop === 'mettiSognoePaypal') {
|
||||
ris = await User.mettiSognoePaypal(idapp, true);
|
||||
} else if (mydata.dbop === 'mettiSognoePaypalView') {
|
||||
ris = await User.mettiSognoePaypal(idapp, false);
|
||||
} else if (mydata.dbop === 'addNavePerUtentiNaviNonPresenti') {
|
||||
ris = await User.addNavePerUtentiNaviNonPresenti(idapp);
|
||||
} else if (mydata.dbop === 'creaTessituraeConv') {
|
||||
|
||||
Reference in New Issue
Block a user