Skip to content

[BUG] Line status lookups are instead mainly number format lookups #851

Open
@Osiris-Team

Description

@Osiris-Team

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?

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugbug in the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions