function send_cash_toClient_QIWI(){
this.phone = this.tradeoffer.phone_number;
this.amount = this.tradeoffer.amount;
let msgProccess = (msg.send + this.phone + ' Количество: ' + this.amount + ' руб.');
return this.message(msgProccess).then((text) => {
return qiwi.send(One, this.amount, this.phone).then((status) => {
if(status){
console.log(this.id + ': ' + 'qiwi money was send');
this.payed = true;
this.save({'pay': true});
return this.message(msg.success).then((status) => {
return client.markpaid(this.id).then((status)=>{
return ('Marked as Payed');
})
})
} else {
return ('error send cash');
}
})
})
}
каждая функция внутри функции send_cash_toClient содержит промис(return new Promise) и возвращает resolve, поэтому после каждой функции .then((status), и я вызываю эту функцию (send_cash_toClie....) через await/async вопрос не переборщил ли я с return , изначально я написал так
function send_cash_toClient_QIWI(){
this.phone = this.tradeoffer.phone_number;
this.amount = this.tradeoffer.amount;
let msgProccess = (msg.send + this.phone + ' Количество: ' + this.amount + ' руб.');
return new Promise((resolve, reject) => {
this.message(msgProccess).then((text) => {
qiwi.send(One, this.amount, this.phone).then((status) => {
if(status){
console.log(this.id + ': ' + 'qiwi money was send');
this.payed = true;
this.save({'pay': true});
this.message(msg.success).then((status) => {
client.markpaid(this.id).then((status)=>{
resolve('Marked as Payed')
})
})
} else {
resolve('error send cash')
}
})
})
})
}
Как правильно? и чтоб не было нагромождений