mueller-ma / PrepaidBalance

App to check your prepaid balance
Apache License 2.0
35 stars 12 forks source link

Parsing fails for Vodafone Germany #9

Closed FestplattenSchnitzel closed 3 years ago

FestplattenSchnitzel commented 3 years ago

Cellphone provider and Country

Actual USSD answer

Aktuelles Guthaben: XX,XX EUR
Wähl bitte aus:
1 Aufladen
2 Guthaben & Verbrauch
3  Tarife & Optionen
4 Spracheinstellungen
5 Vorteilsangebot

Additional notes

FestplattenSchnitzel commented 3 years ago

It'd be great, if you could add a new template for this issue, since I doubt this will happen more than once and doesn't really fit into a "Bug-Report" template.

FestplattenSchnitzel commented 3 years ago

And I should mention that this is RegExp related: The pattern (of the Parser) is not aware of that the first and the second part of the number can be split with a "," (komma) instead of a "." (period).

mueller-ma commented 3 years ago

Thanks for testing. Fixed in https://github.com/mueller-ma/PrepaidBalance/commit/1b3f9c8717d50d20e85595be7a09f5bb7d3c543c

It'd be great, if you could add a new template for this issue, since I doubt this will happen more than once and doesn't really fit into a "Bug-Report" template.

👍 https://github.com/mueller-ma/PrepaidBalance/commit/0ad0dd37ab8e1abf926d80ed1b0825c36df33859

And I should mention that this is RegExp related: The pattern (of the Parser) is not aware of that the first and the second part of the number can be split with a "," (komma) instead of a "." (period).

All , are replaced by . before passed to the regex matchers.

mueller-ma commented 3 years ago

I bumped the version to 0.3. Can you check it again?

FestplattenSchnitzel commented 3 years ago

The app is now able to parse the response, but the balance is totally wrong. 22.922,00 EUR prepaid balance would be great but it's actually 4,51 EUR … :smile:

mueller-ma commented 3 years ago

Did you configure the correct USSD code?

FestplattenSchnitzel commented 3 years ago

Yes, it's the default *100#. The result is the one from the issue description. (with 4,51 EUR instead of XX…). I tested it with Simple Dialer …

mueller-ma commented 3 years ago

Can you capture the app log?

FestplattenSchnitzel commented 3 years ago
2021-06-09 10:17:11.307 7927-7927/com.github.muellerma.prepaidbalance D/MainActivity: onRefresh()
2021-06-09 10:17:11.308 7927-7953/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Remove entries older than 6 months
2021-06-09 10:17:11.311 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Send USSD request to *100#
2021-06-09 10:17:14.173 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: onReceiveUssdResponseFailed(-1)
2021-06-09 10:17:14.173 7927-7927/com.github.muellerma.prepaidbalance D/MainActivity: Got result USSD_FAILED

2021-06-09 10:17:19.991 7927-7927/com.github.muellerma.prepaidbalance D/MainActivity: onRefresh()
2021-06-09 10:17:19.993 7927-7953/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Remove entries older than 6 months
2021-06-09 10:17:19.994 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Send USSD request to *100#
2021-06-09 10:17:20.627 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: onReceiveUssdResponseFailed(-1)
2021-06-09 10:17:20.627 7927-7927/com.github.muellerma.prepaidbalance D/MainActivity: Got result USSD_FAILED

2021-06-09 10:17:26.413 7927-7927/com.github.muellerma.prepaidbalance D/MainActivity: onRefresh()
2021-06-09 10:17:26.417 7927-7953/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Remove entries older than 6 months
2021-06-09 10:17:26.418 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Send USSD request to *100#
2021-06-09 10:17:26.906 7927-7927/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: onReceiveUssdResponse(Zu viele Eingabefehler.
    Bitte versuch es erneut oder probier es unter 22922.)
2021-06-09 10:17:26.940 7927-7927/com.github.muellerma.prepaidbalance D/ResponseParser: Check matcher MATCHER(regex=^(.*?)((\d)+\.?(\d)?(\d)?)(.*) EUR[ ,.](.*), groupContainsBalance=2)
2021-06-09 10:17:26.941 7927-7927/com.github.muellerma.prepaidbalance D/ResponseParser: Check matcher MATCHER(regex=^(.*?)((\d)+\.?(\d)?(\d)?)(.*)$, groupContainsBalance=2)
2021-06-09 10:17:26.947 7927-7927/com.github.muellerma.prepaidbalance D/ResponseParser: Found balance 22922.0
2021-06-09 10:17:26.957 7927-7953/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Insert BalanceEntry(id=null, timestamp=1623226646955, balance=22922.0)
2021-06-09 10:17:26.964 7927-7953/com.github.muellerma.prepaidbalance D/CheckBalanceWorker: Remove BalanceEntry(id=3, timestamp=1623223239762, balance=22922.0) from db
2021-06-09 10:17:26.971 7927-7953/com.github.muellerma.prepaidbalance D/MainActivity: Got result OK
2021-06-09 10:17:26.975 7927-7953/com.github.muellerma.prepaidbalance D/NotificationUtils: createChannels()
2021-06-09 10:17:27.034 7927-7955/com.github.muellerma.prepaidbalance D/MainActivity: updateBalanceList()

Ah, I see the problem …

mueller-ma commented 3 years ago

Can you check with *104# or *106#? https://www.inside-sim.de/8079/die-ussd-handy-codes-bei-vodafone-der-grosse-ueberblick/

FestplattenSchnitzel commented 3 years ago

*106# works fine, thanks. :+1: I didn't expected such a mess …

Maybe the issue with *100# is that it expects an input. It showed me a little prompt (see issue description) when I called it, but I guess USSD fails when no input is provided so your app calling USSD also fails despite the output of text to the user.