Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: DISABLE_PAYG and COUNTER_SYNC are incorrectly decoded as SET_TIME in extended token mode #24

Open
3 tasks done
dmohns opened this issue Nov 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dmohns
Copy link
Member

dmohns commented Nov 6, 2024

Preflight Checklist

Expected Behavior

When using OpenPAYGO in Extended Token mode I would expect DISABLE_PAYG and COUNTER_SYNC to be decoded as such.

Actual Behavior

However, they are decoded as SET_TIME Tokens.

Steps to reproduce

# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenEncoder, TokenType

encoder = OpenPAYGOTokenEncoder()


new_count, final_token = encoder.generate_token(
    secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
    count=4,
    value=None,
    token_type=TokenType.DISABLE_PAYG,
    starting_code=516959010,
    restricted_digit_set=False,
    extended_token=True,
)

print(f"{new_count=}")
print(f"{final_token=}")
new_count=5
final_token='223770960008'
# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenDecoder

decoder = OpenPAYGOTokenDecoder()


value, token_type, count, updated_counts = decoder.decode_token(
    secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
    starting_code=516959010,
    restricted_digit_set=False,
    token="223770960008",
    count=4,
)

print(f"{value=}")
print(f"{token_type=}")
print(f"{count=}")
print(f"{updated_counts=}")
value=998.0
token_type=2
count=5
updated_counts=None

Note that token_type=2 is wrong.

What operating system(s) are you using?

macOS

Additional Information

No response

@dmohns dmohns added the bug Something isn't working label Nov 6, 2024
@dmohns dmohns mentioned this issue Nov 6, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant