You need to sign in to do that
Don't have an account?
Aryan Jha
Line: 1, Column: 45 Method does not exist or incorrect signature: void currencytoinr(Decimal) from the type CurrencyConvertorClass
public class CurrencyConvertorClass {
public static Decimal currencytoinr(Decimal eur)
{
Http http=new Http();
HttpRequest request=new HttpRequest();
request.setEndpoint('http://api.exchangeratesapi.io/latest');
request.setmethod('GET');
HttpResponse res=http.send(request);
if(res.getStatusCode()==200)
{
Map<String,Object>result=(Map<String,Object>)JSON.deserializeUntyped(res.getBody());
system.debug(result);
Map<Integer,Object>listrates=(Map<Integer,Object>)result.get('rates');
Decimal conversionRate=(Decimal)listrates.get('INR');
inr=eur*conversionrate;
return inr;
}
}
}
Decimal convertedAmt=CurrencyConvertorClass.currencytoinr(287.6);
system.debug(convertedAmt);
public static Decimal currencytoinr(Decimal eur)
{
Http http=new Http();
HttpRequest request=new HttpRequest();
request.setEndpoint('http://api.exchangeratesapi.io/latest');
request.setmethod('GET');
HttpResponse res=http.send(request);
if(res.getStatusCode()==200)
{
Map<String,Object>result=(Map<String,Object>)JSON.deserializeUntyped(res.getBody());
system.debug(result);
Map<Integer,Object>listrates=(Map<Integer,Object>)result.get('rates');
Decimal conversionRate=(Decimal)listrates.get('INR');
inr=eur*conversionrate;
return inr;
}
}
}
Decimal convertedAmt=CurrencyConvertorClass.currencytoinr(287.6);
system.debug(convertedAmt);
Greetings!
Can you please try the below to see,if it works:
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri