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

Receipt parsing fails due to format changes #13

Closed
Theome opened this issue Sep 27, 2020 · 5 comments
Closed

Receipt parsing fails due to format changes #13

Theome opened this issue Sep 27, 2020 · 5 comments

Comments

@Theome
Copy link
Contributor

Theome commented Sep 27, 2020

Since a few days ago, some of the App Receipts that are generated by iOS have a slightly different format and Kvitto fails to parse these receipts properly. In my app, around 50% of the app receipts are affected. I'm already using Kvitto in my app since about a year, but this problem occurred for the first time on September 24.

It seems that the issue is that sometimes the date format contains fractional seconds, so for example a date looks like this

2020-09-27T12:07:19.686Z

instead of this:

2020-09-27T12:07:19Z

The method _dateFromRFC3339String() fails to parse the former date string, so _dateFromData() throws and Receipt.init?(contentsOfURL) returns nil.

It's possible that there are some more changes to the format - I'm still investigating. If I find time in the next days, I'll prepare a pull request with a fix.

@odrobnik
Copy link
Collaborator

Do you have an example receipt? Then We could easily fix that. I'll look into supporting the conversion function with fractional seconds as well.

@Theome
Copy link
Contributor Author

Theome commented Sep 27, 2020

Sure. Can I send you the receipt by email? I don't want to accidentally leak sensitive data.

@odrobnik
Copy link
Collaborator

Sure. Can I send you the receipt by email? I don't want to accidentally leak sensitive data.

Of course, oliver@cocoanetics.com

@odrobnik
Copy link
Collaborator

@Theome I enhanced the date parsing function to work with and without fractional seconds.

@odrobnik
Copy link
Collaborator

Fix released in 1.0.4

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

2 participants