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

Not possible to generate code without PaymentDueDate #13

Open
tom-m-26h opened this issue Jan 23, 2024 · 0 comments
Open

Not possible to generate code without PaymentDueDate #13

tom-m-26h opened this issue Jan 23, 2024 · 0 comments

Comments

@tom-m-26h
Copy link

The generate() function always includes PaymentDueDate in the generated data even if it is called without any date for it. According to the XSD spec at https://bsqr.co/schema/ the PaymentDueDate element is optional. But there seem to be no way to have generate() generate data without any date for PaymentDueDate. It always puts a date into the code. When not provided by the caller it uses the current date:

$ python3
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pay_by_square import generate
>>>
>>> # call without any date
>>> generate(amount=123, iban='SK7700000000000000000000')
'000480008M281NMNP30CU6FFUCP8579BUP8A3L1LQ1QMMQPUBGMUKU2KOQ37I3HH4LNS5QSBVGUK54VVVVATI000'
>>>
>>> exit()
$ 
$ # decode result with https://github.com/xseman/bysquare to verify
$ docker run -it --rm --mount type=bind,src=/tmp/pay_by_square/xseman/bysquare,dst=/mnt/bysquare \
> node /mnt/bysquare/node_modules/bysquare/dist/cli.js --decode \
> 000480008M281NMNP30CU6FFUCP8579BUP8A3L1LQ1QMMQPUBGMUKU2KOQ37I3HH4LNS5QSBVGUK54VVVVATI000
{
    "payments": [
        {
            "bankAccounts": [
                {
                    "iban": "SK7700000000000000000000"
                }
            ],
            "type": 1,
            "currencyCode": "EUR",
            "amount": 123,
            "paymentDueDate": "20240123"
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant