mbank-cli icon indicating copy to clipboard operation
mbank-cli copied to clipboard

New history view

Open jwilk opened this issue 5 years ago • 21 comments

In May, mBank announced that they would be phasing out the old history view: https://www.mbank.pl/mbank-news/co-nowego/pokazemy-nowa-historie-operacji.html

The new history view is not feature complete yet, but it would be prudent to start the porting work now. Hopefully they won't change API too much in the mean time.

The date of arrival in unknown, and apparently user-dependent!? They say:

We will change the history feature gradually; we will send a message to each of you with a specific date.

What the hell… FWIW, I haven't received such a message yet.

jwilk avatar Oct 02 '19 17:10 jwilk

They haven't activated it for me too. Looks quite promising. If they added eksport to elixir compatible csv format, it would be great.

chilek avatar Oct 03 '19 08:10 chilek

I've looked at the HTTP traffic, and it looks pretty good. I expect to have a working prototype in a few days.

jwilk avatar Oct 03 '19 18:10 jwilk

Adventurous users can try the history2 command from the pu/84 branch. There's no paging implemented yet, so you'll be shown at most 25 transactions.

jwilk avatar Oct 10 '19 20:10 jwilk

I've just implemented paging.

jwilk avatar Oct 12 '19 17:10 jwilk

I've got earlier mentioned url (https://www.mbank.pl/mbank-news/co-nowego/pokazemy-nowa-historie-operacji.html) in my mbank account panel. New history means the old one stops working? Is there csv export feature in new history implementation on mbank-cli side?

chilek avatar Oct 15 '19 13:10 chilek

I've got a notice in the web UI about it today too. They say: as of October 21*, all the history features will be in one place.

* October 21 = next Monday

New history means the old one stops working?

I guess so.

Is there csv export feature in new history implementation on mbank-cli side?

No. I don't have this feature in the web UI yet.

jwilk avatar Oct 15 '19 14:10 jwilk

I didn't include the "Category" column, as I don't find it useful. Let me know if you need it.

The output currently looks like this:

card-pending	2019-10-19	    -11.53 PLN	Apteka Prywatna
xfer	2019-10-18	    -30.95 PLN	mTransfer
xfer	2019-10-02	     50.01 PLN	JAKUB WILK, PRZELEW ŚRODKÓW
card	2019-09-25	    -14.96 PLN	SKLEP OGÓLNOSPOŻYWCZY
other	2019-09-01	     -0.01 PLN	PODATEK OD ODSETEK KAPITAŁOWYCH
other	2019-09-01	      0.01 PLN	KAPITALIZACJA ODSETEK

Yes, it says only mTransfer. This is all that is available. To get more details, we would need to make an extra request for each history item. ☹

jwilk avatar Oct 21 '19 05:10 jwilk

They say: as of October 21*, all the history features will be in one place.

It's October 21 already, but it doesn't look like anything has changed.

jwilk avatar Oct 21 '19 05:10 jwilk

Maybe they have postponed history changes?

chilek avatar Oct 21 '19 08:10 chilek

They've changed history view on my account!

chilek avatar Oct 21 '19 16:10 chilek

... and export to csv in mbank-cli still works so far ;-)

chilek avatar Oct 21 '19 16:10 chilek

... and export to csv in mbank-cli still works so far ;-)

Probably they allow to use two history export mechanism for now, because it looks like it has completely changed.

chilek avatar Oct 21 '19 16:10 chilek

History export conversation looks like below:

  1. Send request to https://online.mbank.pl/pl/Pfm/HistoryApi/GetHostInitialData.
  2. We get the following reply:
{"hostProducts":[{"id":"","contractNumber":"38114020040000380231502494","name":"mBiznes konto","productName":"mBiznes konto","subTitle":"","isSelected":false,"isInPfm":false,"isInHost":true,"contractCurrency":"PLN","contractAlias":"cZU0orqAq8WOzfK+hkvdUdKSYENb5p5N8TCjxILNMEYCcFGyVTJHU08KPT8ty1JtOnFamKb1kReoA0cptx7TlA==","productType":null},{"id":"","contractNumber":"43114020040000370300261970","name":"mBiznes Konto VAT","productName":"mBiznes Konto VAT","subTitle":"","isSelected":false,"isInPfm":false,"isInHost":true,"contractCurrency":"PLN","contractAlias":"E+kpebx0y7lOgMuTspLIWbnSFjHK0c6/rv9ewWlbC9Fn8k1qv2okyStPrW8CyFeUYvmKZgvjPKaNTakxbo3fsw==","productType":null},{"id":"","contractNumber":"82114020040000330231502529","name":"mBiznes max","productName":"mBiznes max","subTitle":"","isSelected":false,"isInPfm":false,"isInHost":true,"contractCurrency":"PLN","contractAlias":"oyVCsGnztUxVwgS6J1lXGNpUUwELeRCYgvdveS5xPm/ORV5nysJ5ytvspaOKL/tKBdUGxfSqVmsdt5V6PkxdCQ==","productType":null}],"hostTransactionTypes":[{"value":"ALL000000","label":"Wszystkie","isSelected":false,"subtypes":[]},{"value":"ABO000000","label":"Uznania rachunku","isSelected":false,"subtypes":[]},{"value":"CAR000000","label":"Obciążenia rachunku","isSelected":false,"subtypes":[]},{"value":"TRI111000","label":"Przelewy przychodzące","isSelected":false,"subtypes":[]},{"value":"TRO111000","label":"Przelewy wychodzące","isSelected":false,"subtypes":[]},{"value":"TIH111000","label":"Przelewy własne","isSelected":false,"subtypes":[]},{"value":"TUS111000","label":"Przelewy podatkowe","isSelected":false,"subtypes":[]},{"value":"TRZ101000","label":"Przelewy do ZUS","isSelected":false,"subtypes":[]},{"value":"LDS100000","label":"Operacje kartowe","isSelected":false,"subtypes":[]},{"value":"CRE100000","label":"Operacje na kredycie","isSelected":false,"subtypes":[]},{"value":"CAI100000","label":"Wpłaty gotówkowe","isSelected":false,"subtypes":[]},{"value":"INT000000","label":"Kapitalizacja odsetek","isSelected":false,"subtypes":[]},{"value":"COM100000","label":"Prowizje i opłaty","isSelected":false,"subtypes":[]},{"value":"TDI111000","label":"Przelew z/na r-ek brokerski","isSelected":false,"subtypes":[]},{"value":"TRS000000","label":"Regularne oszczędzanie","isSelected":false,"subtypes":[]}],"nmbDesktopOperationId":null,"redirectedOperationDataForDetails":null,"shouldOverWiteLocalStorage":false}
  1. We send export history request to https://online.mbank.pl/pl/Pfm/HistoryApi/GetHostTransactionsSummary with json encoded data:
{"accountNumber":"cZU0orqAq8WOzfK+hkvdUdKSYENb5p5N8TCjxILNMEYCcFGyVTJHU08KPT8ty1JtOnFamKb1kReoA0cptx7TlA==","dateFrom":"2019-07-20T22:00:00.000Z","dateTo":"2019-10-20T22:00:00.000Z","saveFileType":"CSV"}
  1. We get reply with csv history!

chilek avatar Oct 21 '19 17:10 chilek

They've deployed the new thing for me too. It looks like they revamped it more than I anticipated, so the code I wrote so far won't be very useful.

jwilk avatar Oct 21 '19 17:10 jwilk

"dateFrom":"2019-07-20T22:00:00.000Z"

What the hell. So this is UTC timestamp, but it points to midnight in the local time zone. I wonder what happens when the client's and server's local time zones don't match…

jwilk avatar Oct 21 '19 17:10 jwilk

Curiously, both previous history views still work.

Perhaps they kept the old APIs around, because the new history view hasn't been enabled for everyone yet?

jwilk avatar Oct 21 '19 18:10 jwilk

ETA: tomorrow morning

jwilk avatar Oct 21 '19 18:10 jwilk

I've implemented new export. Check out branch pu/84, command history2019.

It took way more time than expected, so I'm unlikely to finish this up in the morning.

jwilk avatar Oct 21 '19 23:10 jwilk

Wow - thanks a lot for great job! ;-)

For me `history2019' works as should!

chilek avatar Oct 22 '19 07:10 chilek

I have now implemented the non-export parts for history2019.

jwilk avatar Oct 22 '19 17:10 jwilk

I've now merged the history2019 command into master.

I'm not sure how to proceed.

On one hand I feel nervous about using the old API, which is normally inaccessible in a web browser. On the other hand, the lack of mTransfer details is a deal breaker for me. ☹

jwilk avatar Jan 27 '22 20:01 jwilk