CatimaLoyalty/Android

Stocard / Klarna APP import failed

Closed this issue ยท 13 comments

Google Pixel 6
Android 13 (TQ3A.230901.001.C1)
Catima (Google Play) 2.31.1

protect.card_locker.FormatException: Couldn't find any loyalty cards in this Stocard export.

Screenshot_20241002-083235

Stocard is no longer a thing. It will force prompt user to download Klarna APP instead.
I contacted support@stocardapp.com to get my export data. I emailed the .zip file and password to catima.g9ex3@hackerchick.me Please take a look.

I checked issue #863, #1242, #1277. Maybe Stocard/Klarna (recently) changed the exported .zip structure again, so Catima import failed.

Quick note for those who see this issue

You can work around it by using a computer to extract and re-compress the Stocard zip file.
Make sure to not change the structure of the original ZIP file! The first directory in the ZIP file should be "extracts"

More details on what is going wrong:

Thanks for the report and the file you sent through email.

I've checked the file and after some testing I figured out that the structure didn't change, but the format changed.

Old files: Zip archive data, at least v1.0 to extract, compression method=store
Your file: Zip multi-volume archive data, at least PKZIP v2.50 to extract

I've created a small issue on zip4j but sadly the library hasn't been updated in a year so I fear we may need to switch to a different zip library to fix this (suggestions welcome!).

For now, I'm going to pin this issue to help users affected find this workaround.

Some notes. When re-compress the zip file, make sure to construct it in the same folder structure. i.e. \extracts\(user-ID-strings)\users\(user-ID-strings)\(11 folders)\
Missing any folders (missing \extracts\(user-ID-strings)\users\) will cause import errors in Catima.

Maybe this is something to be improved for Catima; better folder searching.

Thanks very much.

I would prefer Catima do a few things, 1. explicity tell the users within the app what format/folder structure it is expecting. (I didn't just request my cards but all my personal data) So after some guesswork I decided to come to the github to find out what it was expecting.

  1. I would also prefer and option for catima to just take the "loyalty-cards" and "loyalty-cards-custom-providers" folders directly

and 3. Maybe the zip files weren't password protected before, but they are now. so maybe a dialog box to paste in the password as well?

@Unessential 1. Catima already tells you what it expects: the .zip file that Stocard provides you as export. There is no logical reason for an user to manually modify an export file. There is only one version Stocard provides. If there were multiple versions, Catima should, if possible, autodetect which one it is so users don't have to figure it out.
2. That causes a lot of complexity that will only benefit people who do unsupported stuff (modifying the export file). I'm not interested in putting more work into support anything but "importing from the official unmodified export format".
3. Support for password protected exports has existed for years, Catima pops up a dialog box for a password when it needs one.

The issue is simple: Stocard started compressing the .zip files in a way zip4j doesn't understand, causing zip4j to say there are no files and thus making Catima think there are no cards in the zip. Catima should support these new zip files too so users can load newer Stocard exports into Catima without any manual work.

To be extra clear: extracting and re-compressing is a temporary workaround until this issue is fixed, it is by no means what should be the standard way of working. Users should be able to just load in whatever export file is provided by the app they're switching away from and have it work without thinking.

Oops. Yeah. Somehow I missed the post between the first one and your pin, and thought the issue was the folder structure rather than the zip format. I think it's because they way you formatted your post in my head it registered as "post content / signature" like you would see in social forums soI ended up subconsciously filtering it out it. (I know github doesn't have signatures, but my brain processed it that way due to the horizontal rule, and change in font size).

In my head I saw, first post that mendtioned sending example zip + passwords + changed structure, your post with workaround to re zip (which made me assume the zip wasn't previously password protected -- since I didn't get a password prompt before the error message) and then a post after suggesting better folder searching.

Hello, unfortunately I have the same problem.
I have tried the following:

  • Used the original file
  • File unpacked and repacked on a Windows 10 PC with Explorer
  • File repacked with 7zip as a zip on a Windows PC
  • File packed as a zip on Android

I have sent you the files to the above e-mail address and would be very happy if you can find a solution.

PS: For me, the export (reply to my email from Klarna) took 7 months.

Hey @dktzde, I've sent you an email with your fixed export and I've added more info to #2096 (comment) to make more clear it is important to be very careful to not change the structure of the ZIP file (adding an extra top level directory or removing the directory below it will make it fail to import).

PS: For me, the export (reply to my email from Klarna) took 7 months.

The GDPR requires them to give you your data within 30 days so if you're an EU citizen they broke the GDPR. You may want to consider filing a complaint at your local DPA (hopefully if more people put pressure on them through a DPA they may eventually be forced to actually stop breaking the law)

@obfusk fixed this issue (yay!). The fix will be in the next release. For now, I'm keeping this issue pinned until we have a new release and it's widely available so people can still find the workaround easily.

The patch is out on all app stores so I'll unpin this now :)

Oduig commented

For others on Android reading this: I was able to import my cards by compressing the 'extracts' folder as .zip with the WinRAR app from the Play store.

Thanks to the devs! Way better than Klarna!

@Oduig This was fixed in Catima 2.32.0 released October 28 though, so that shouldn't have been necessary anymore? Are you still running into issues with a newer version?

Oduig commented

It did not accept a zip file I created via my file manager app. It could be because it's a newer zip format e.g. zip v2. Or should I have imported the password protected zip from Stocard directly?

The idea of the importer is to directly import what you're given from another app/company with no manual steps to reduce the friction as much as possible. So yes, directly importing the .zip file Stocard gives you with no manual changes should work (and is the only supported use case).