Open
Description
Describe the bug
All requests should have been line status lookups, however as you can see in the billing details most requests are the free ones (number format lookup), which looking at the code cannot be possible like shown here:
var moneySpent = new BigDecimal(s.twilioAPIDollarsSpentThisMonth);
var moneyMax = new BigDecimal(s.twilioAPIDollarsMaxPerMonth);
var costLineStatus = new BigDecimal("0.007");
if(moneySpent.compareTo(moneyMax) >= 0)
throw new RuntimeException("Twilio max dollars spent per month reached: "+ moneySpent+" >= "+ moneyMax);
var map = PhoneNumber.fetcher(numDB.replace(" ", ""))
.setFields("line_status")
.fetch(Twilio.getRestClient()).getLineStatus();
lineStatus.set((String) map.get("status"));
if(map.get("error_code") != null) // Dont update money because errors don't cost
lineStatusError.set("Error "+map.get("error_code")+" see https://www.twilio.com/docs/api/errors/"+map.get("error_code"));
moneySpent = moneySpent.add(costLineStatus);
BigDecimal finalMoneySpent = moneySpent;
s.twilioAPIDollarsSpentThisMonth = finalMoneySpent.doubleValue();
s.update();
Now I have a theory why this happens, maybe the requests that fail / return an error code are not billed? Because there are quite a bit that fail, but I don't think its that many, like shown in the screenshot.
Or what is going on?
Code snippet
see above
Actual behavior
see above
Expected behavior
see above
twilio-java version
latest
Java version
latest
Logs or error messages
none
Additional context
No response