- fixed: Se tenti d'inviare dei RIS a chi ha raggiunto il limite, deve comparirti un msg ed inviare un msg al destinatario !
This commit is contained in:
@@ -439,3 +439,8 @@ Lun 03/03 ORE 01:06: [<b>Circuito RIS Arezzo</b>]: Inviate Monete da surya1977 a
|
||||
Saldi:
|
||||
surya1977: -1.10 RIS]
|
||||
Andro: 1.00 RIS]
|
||||
Mer 12/03 ORE 21:30: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a Giovannifruttadisicilia 60 RIS [causale: prova]
|
||||
|
||||
Saldi:
|
||||
surya1977: 34.20 RIS]
|
||||
Giovannifruttadisicilia: 458.50 RIS]
|
||||
@@ -104,8 +104,8 @@
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "🔄 Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED": "%s %s rifiutati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED_TO_ME": "%s %s rifiutati da %s sul '%s'.",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "L'importo supera la quantità massima concessa per %s",
|
||||
"CIRCUIT_AMOUNT_EXCEED_QTAMAX": "L'importo supera la quantità massima che il destinatario (%s) può accumulare",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "⚠️ L'importo supera la quantità massima concessa per %s",
|
||||
"CIRCUIT_AMOUNT_EXCEED_QTAMAX": "⚠️ L'importo supera la quantità massima che il destinatario (%s) può accumulare",
|
||||
"CIRCUIT_COINS_ALREADY_PROCESSED": "La richiesta è stata già processata. Stato %s",
|
||||
"STATUS_SENT": "Inviato",
|
||||
"STATUS_REFUSED": "Rifiutato",
|
||||
@@ -127,6 +127,9 @@
|
||||
"🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.",
|
||||
"🚫 %s ha rifiutato l'accesso alla App a %s !": "🚫 %s ha rifiutato l'accesso alla App a %s !",
|
||||
"✅ Hai Ammesso l'accesso alla App a %s !": "✅ Hai Ammesso l'accesso alla App a %s !",
|
||||
"EXCEED_FIDO": "⚠️ L'importo supera la Fiducia concessa per %s",
|
||||
"EXCEED_QTAMAX": "⚠️ Attenzione! %s sta tentando di inviarti %s RIS, ma il tuo conto ha raggiunto il limite massimo di accumulo sul %s. \nPer poter ricevere il pagamento, devi prima spendere alcuni RIS cercando quello che ti serve, in modo da liberare spazio nel tuo conto. 🙏🏻",
|
||||
"EXCEED_QTAMAX_MITTENTE": "⚠️ Attenzione! %s ha raggiunto la quota massima accumulabile in RIS, pertanto non puoi inviarglieli. Dovrebbe prima cercare di spendere i RIS cercando quello che gli serve, in modo da liberare spazio nel suo conto. 🙏🏻",
|
||||
"Good: %": "Good: %",
|
||||
"Service: %": "Service: %"
|
||||
}
|
||||
@@ -720,6 +720,7 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
let ris = {
|
||||
result: false,
|
||||
cansend: true,
|
||||
errorcode: 0,
|
||||
errormsg: '',
|
||||
rec: null,
|
||||
useraccounts: [],
|
||||
@@ -768,11 +769,13 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
if (accountorigTable.saldo - myqty < -accountorigTable.fidoConcesso) {
|
||||
ris.cansend = false;
|
||||
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_FIDO', usernameOrig);
|
||||
ris.errorcode = shared_consts.SENDRIS_CODES.EXCEED_FIDO;
|
||||
}
|
||||
|
||||
if (accountdestTable.saldo + myqty > accountdestTable.qta_maxConcessa) {
|
||||
ris.cansend = false;
|
||||
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_QTAMAX', extrarec.dest);
|
||||
ris.errorcode = shared_consts.SENDRIS_CODES.EXCEED_QTAMAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3023,6 +3023,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
// console.log('setCircuitCmd', cmd);
|
||||
|
||||
const { SendNotif } = require('../models/sendnotif');
|
||||
const telegrambot = require('../telegram/telegrambot');
|
||||
|
||||
let ris = null;
|
||||
let outres = {
|
||||
@@ -3261,15 +3262,6 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
outres = await Circuit.sendCoins(onlycheck, idapp, usernameOrig, extrarec);
|
||||
|
||||
if (outres.cansend) {
|
||||
// Invia una notifica di moneta alla persona
|
||||
//const out = await tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, false, true, username_action,
|
||||
// extrarec);
|
||||
//if (out)
|
||||
// outres.result = out.ris;
|
||||
} else {
|
||||
outres.cansend = false;
|
||||
}
|
||||
|
||||
ris = true;
|
||||
// } else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// Before to accept, I see if it's already set !
|
||||
@@ -3329,6 +3321,28 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (outres.errormsg) {
|
||||
let msgerr = '';
|
||||
let username_dest = extrarec.dest;
|
||||
if (outres.errorcode === shared_consts.SENDRIS_CODES.EXCEED_FIDO) {
|
||||
} else if (outres.errorcode === shared_consts.SENDRIS_CODES.EXCEED_QTAMAX) {
|
||||
// invia un messaggio al destinatario
|
||||
const msgDest = i18n.__('EXCEED_QTAMAX', usernameOrig, extrarec.qty.toString(), extrarec.circuitname);
|
||||
await telegrambot.sendMsgTelegram(idapp, username_dest, msgDest);
|
||||
|
||||
msgerr = i18n.__('EXCEED_QTAMAX_MITTENTE', username_dest);
|
||||
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgDest);
|
||||
}
|
||||
|
||||
console.warn('🔴 ATTENZIONE! ', outres.errormsg + '\n(Mittente: ' + usernameOrig + ')');
|
||||
// await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgOrig);
|
||||
|
||||
// Invia questo msg anche all'Admin
|
||||
await telegrambot.sendMsgTelegramToTheAdmin(idapp, outres.errormsg + '\n(Mittente: ' + usernameOrig + ')', true);
|
||||
|
||||
}
|
||||
|
||||
} else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// Before to accept, I see if it's already set !
|
||||
|
||||
@@ -1187,6 +1187,11 @@ module.exports = {
|
||||
SET: 1,
|
||||
},
|
||||
|
||||
SENDRIS_CODES: {
|
||||
EXCEED_FIDO: 10,
|
||||
EXCEED_QTAMAX: 20,
|
||||
},
|
||||
|
||||
// Download, DVD, Epub, Mobi, Nuovo, PDF, Streaming, Usato
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user