History

TLDR; The history of this project has probably the most popular reasons in the tech industry. As a software developer working full time on a job, i decided 2 years ago to start a side hustle šŸ™‚.

So 2.5 years ago i started a new full time job on a app, in the farming industry. In a nutshell it is a cattle managing app for farmers. 11 months into the project i was feeling pretty solid in the project, like at home, and the tasks were somewhat interesting at the time, i was really excited and interested in coding like probably never before.

So going through life here in Chisinau, doing groceries i started noticing a QR code on each receipt. So one day i scanned it, and it leads to a gov website, www.sfs.md within a receipt-verifier feature. This means that every receipt printed ever is there, and the stores are forced to actually make sure the naming of the products you bought are right, and prices. And a question popped my mind:

🧠 Can i parse it? and save them locally somehow so that i have a statistic of my expenses?

This thought went in the back of my mind for a while… i was scanning other receipts from time to time to check if anything changed and i noticed one thing Receipts are temporary.

What do i mean by that? Well one day i put one in my back pocket, and a day later i got it out and the QR code was not readable anymore, it turns out that the receipts are loosing data if they are bent, or heated šŸ”„.

🧠 Isn’t it weird that the only proof of your purchase is so fragile? If you buy something more expensive you really have to take care of this piece of paper.

I asked a few friends, and they said:

  • Yeah this is kinda weird, it would be nice to have it in electronic form.

  • And it is kinda nice to have only scan and let it calculate everything for me…

    So my excitement jumped through the roof (🧠 did i just prove the idea?).

Starting the POC…

Sunday morning i get to it….

And so it started. Since there is no official api i settled onto a simple web crawler. Decided to write in in TypeScript, since it is probably a good idea to parse html dom into the language it’s supposed to be run. So i spin up a cloud functions project and create the parser and publish it. Coupling it with firestore and storing results. And there it was, the glorious POC was done.

At this point having the receipt in firestore it was just natural to create a flutter app and connect the firebase project to it.

Next day after an epic standup meeting of 2 hours, i created the first commit during my lunch break.

Image Description

Making the app.

I focused on the ui part of the app, probably way too much ), it is my thing i like to build cool ui and subtile animations, and never before i did have the chance to do it. All the previous projects i had a designer in the team, and they were not bad… it’s just no one actually tried to do a mobile experience, and i had to fight for the simple improvements… Well not anymore i was solo and i could do whatever i like ).

Long story short… I went through all the cycles of development, apart from unit testing… it was a side project, and a small one at the time, with the time constrains of some weekends there is really no time for this…

To compensate for lack of unit tests, i gathered a group of friends and added them to my beta testers list ), some would download and tap through the app and give feedback, apart from me trying my best to test it. It worked well for this project magnitude…

The Struggles…

Making the app was the most time consuming part, but far from the most frustrating…

One beautiful morning i went to order a coffee, got the receipt and scanned it. The receipt was in the failed state in a few moments with a retry scheduled in a few…

i specifically made this mechanism since during testing i found out that not all merchants are the same… Some do print out the qrcode with a valid link to a receipt, but they did not send the receipt to www.sfs.md… Or the platform itself did not process it consistency. Anyways, sometimes the receipt was missing, but it would auto fix in time.

Next i bought some groceries the same day, and the same result… I got some time to check the logs when there was a pile of 15 failed receipts that week and i finally found the issue.

It turns out the guys from www.sfs.md did something and all my cloud function were failing with 401.

There is no documentation / explanation nor an official api for this public resource… so i was completely thrown off.

A few weekends later after i tested all work-arounds i could to fix this, including loading a headless browser, i gave up and started to seek help. Maybe i can reach a developer of the platform to understand if there is a way to fix it.

My social media network did not know anyone that were nearly connected to a developer of the platform, so i lost all hope and reached customer support.

Customer support saga.

Writing this rejuvenated some memories of that time so apologies for any future typos. šŸ˜„

Actually i changed my mind, i am gonna do short version of the story…

The fiscal services has 3 customer supports for different purposes.

  1. fiscal service
  2. certification center
  3. mev platform

Everyone interacts with the first, one way or the other… The second is used by developers of receipt printers that need an official certification in order to publish the receipts to the third (mev platform).

so i reached to the mev with a description of my issue and asked for any help or guidance, they said that i need a certification. The certification guys first sent me to the fiscal services they said we have no idea what you are talking about… you should call mev. So i did.

Mev gave me a number of a person from the certification center. I called and that person was not an employee anymore… šŸ¤¦ā€ā™‚ļø

At this point 3 weeks has passed through emails and calls and i learned nothing.

I did find a number from the certification and the guy actually was really helpful, he explained that in order to get a certification you need to fill in some forms… and have a device. Then they will give you access to a sandbox environment in order to test your device, and then you get a certification.

Finally someone explained something… I learned that i don’t need a certification in the first place.

So i go into debugging and found out that it was a cloudflare service that is supposed to block robots from accessing your site.

I was able to make a detailed report of the issue, with logs and traceId attached in response headers and sent a email to mev begging them to help me understand how to fix it.

After a week of waiting, they gave me the response.

Following the analysis, it was found that it is not possible to use the method with dynamic IP addresses, which is why it is blocked.

Since cloud functions spawn new ip every time they start, they say i cannot use the api…

What the in the actual #-±§~-…?

after a few more emails they wanted me to provide a static ip for some reason. I only have some assumptions at this point, no actual explanation from their experts…

I think the cloudflare blocker just added the whole google ip range, so that no serverless function could pass. And they have a whitelist that can be added, that’s why they wanted a static IP.

This solution is so frustrating i cannot put it into words…

So i decided to migrate everything on the client side… there still is a possibility of blocking but it is way less.

Now the app parses it’s own html… yay…

I hate this approach so much… And i hate the fact that i was forced to use it, i did time contrained myself in order to push this project and now i a forced to cut corners and hope for the best. True startup spirit ))

šŸŽŠ šŸŽŠ šŸŽŠ But it works… I managed to make a mechanism that runs in background… and it does not bloc the user.

Finally

I polished the app to the best of my capabilities. Added a few subscriptions with revenuecat. A few fancy effects here and there… and published it to appstore and google play.

I remember the day the app was approved on Appstore after 4 rejects, and i had this meditative state for a few minute of pure happiness šŸ˜„, i did not notice how tired this project made me…

Next steps.

I have a few friends that still test it, and give me feedback. And i am preparing a few shorts for social media (but this will be my next article…)

The App will officially launch when i’ll start marketing it, probably next week. :)

For now this abridged version of the last 6 months come to an end. And even writing this few lines give me a weird sense of satisfaction… I have been procrastinating writing this article for all this time, and now many details faded, i don’t think it is an interesting read but i am really happy to get it out of my system. :)

Until next time.