I earlier had a code with Promise.allSettled(payoutPromises);
But it couldn't work on our server because it has a version 10 for nodejs.
This is what I came up with to do something similar , using some blogs as reference .
async.each(transactions, function(transaction, iteratorCB) {
payoutPromises.push(function(callback) {
ValidationHelper.bankPayoutTransfer(transaction, 'neft').then((data) => {
response.push({"status":"fulfilled","value":data});
callback(null, data);
}).catch((_err) => {
response.push({"status":"rejected","reason":_err});
});
});
iteratorCB();
}, function() {
async.parallel(payoutPromises, function(err, results) {
console.log(err,results);
});
})
The problem I am facing is I want to wait for this async block before executing the rest of the code, like we can using a then after Promise.allSettled
I am a noob in terms of nodejs and working on it since a year.