-
Notifications
You must be signed in to change notification settings - Fork 111
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: Apple doesn't support passing both a currencyCode and numberStyle #37
Conversation
…encyCode supplied. This is needed since apple pukes if you pass both
.cache/v/cache/lastfailed
Outdated
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a line to the .gitignore
file, so this file does is added to the git repo:
# Unit test / coverage reports
.coverage
.tox
.cache # <--- Add this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, but unfortunately I forgot to mention that you must delete this file too.
passbook/test/test_passbook.py
Outdated
passfile.passInformation.headerFields.append(balance_field) | ||
passfile.passInformation.addAuxiliaryField('aux1', 'VIP Store Card', 'Famous Inc.') | ||
pass_json = passfile.json_dict() | ||
print(pass_json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, almost ready.
.cache/v/cache/lastfailed
Outdated
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, but unfortunately I forgot to mention that you must delete this file too.
@johnksterling @mbaechtold Hi guys. Did something need to happen to merge this? I can see it didn't reach the master. Thanks! |
Would just changing |
We are running into a problem where we set the currencyCode on the balance field of a pass, but never set the numberStyle - yet the passbook python library re-injects a default numberStyle. Apple, however, doesn't support having both a numberStyle and a currency field.
There are a few ways to resolve this, but I chose to just over-ride the json generation on CurrencyField to only strip numberStyle if currencyCode is present (which looks to be almost always, unless someone explicitly deletes one of them).
Note that the proposed solution will leave 'empty' the json as-is if one of them is an empty string. I am not sure if this is the desired behavior since we don't set either to empty string - bit it would be an easy change to check json_dictionary.get('currencyCode') and json_dictionary.get('currencyCode').strip() if that was preferred.
I have tested this with a couple of version of the ios and it seems to work well. Anyone else running into this and interested in fixing it?
Closes #38