I need to return the value of boby to another controller but there it arrives as undefined
async functionA({InformationA,informationB}){
this.generatepayment(InformationA,informationB, function(body,err) {
console.log(body) //get the value correctly
return body; //but it does not return the value to another controller
})
}
In this function there is an internet service which gives me the value that I want to return in the a function, I need it to be returned from the first function
async generatepayment(InformationA,informationB, callback){
const datasend= {
InformationA: InformationA[0],
InformationB InformacionB
}
const options = {
url: 'https://www',
json: true,
body: datasend
};
request.post(options, (err,res,body) => {
if (err) {
return console.log(err);
}
return callback(body['string_value']);
});
}