Internal error: activate-profile: ambiguous profile name
When I switch from business to personal profile I get error:
$ ./mbank-cli activate-profile personal
Internal error: activate-profile: ambiguous profile name at ./mbank-cli line 2682.
main::do_activate_profile("args", ARRAY(0x55f247d0d420), "login", HASH(0x55f24805dc88)) called at ./mbank-cli line 3342
main::main() called at ./mbank-cli line 3346
Switching from personal to business does work - if I log in via browser and switch profile to personale./mbank-cli list personal accounts, and then activate-profile business works as expected.
Non standard thing in my personal account is that I have access to two personal accounts - my own, and one with power of attorney.
I guess this could be fixed in a similar way it was done for multiple bussiness profiles: b49e35d81916bef3a855d577c5886030b3fcc772
@netmaniac, can you apply this patch:
diff --git a/mbank-cli b/mbank-cli
index 751fa30..a29744f 100755
--- a/mbank-cli
+++ b/mbank-cli
@@ -1493,4 +1493,5 @@ sub _extract_login_profiles
my ($js) = ($content =~ m/^\s*Ebre[.]Venezia[.]ProfileData\s*=\s*([{].+[}]);\s*$/m)
or next;
+ debug("profile data = $js");
$js = unicode_to_bytes($js, 'UTF-8');
my $json = decode_json($js, context => 'login.profiles.json');
then run mbank-cli --verbose, and paste the profile data it dumps?
(Or send it by e-mail if there's anything confidential there.)
Hello, Some time have passed :) but now I would like to try these feature again, but still is the same error. After applying patch (on current version from master cf1f9ac9e55101c849786401097ac73f301d97bd) output is as follow
./mbank-cli --config ~/.config/mbank-cli/config --verbose activate-profile "personal"
* selected command: activate-profile
* cookiejar = /home/viciu/mbank-cli/16678230.cookies
* GET https://online.mbank.pl/pl
* profile data = {"iProfiles":{"appURL":"#market/group/IO","active":false,"profiles":[{"profileCode":"L","active":false,"previouslyActive":false,"firmName":null},{"profileCode":"T","active":false,"previouslyActive":true,"firmName":null},{"profileCode":"*","active":false,"previouslyActive":false,"firmName":null}]},"fProfiles":{"appURL":"#market/group/BO","active":true,"profiles":[{"profileCode":"04275081","active":true,"previouslyActive":false,"firmName":"COMPANY NAME"}]}}
* logged in
Internal error: activate-profile: ambiguous profile name at ./mbank-cli line 2800.
main::do_activate_profile("args", ARRAY(0x562fd4090320), "login", HASH(0x562fd43d8048)) called at ./mbank-cli line 3443
main::main() called at ./mbank-cli line 3447
Please file a bug at <https://github.com/jwilk/mbank-cli/issues>.
I have only removed company name. As I have written earlier I have company account, my personal and some with with power of attorney.
The interesting part pretty-printed:
[
{
"profileCode": "L",
"active": false,
"previouslyActive": false,
"firmName": null
},
{
"profileCode": "T",
"active": false,
"previouslyActive": true,
"firmName": null
},
{
"profileCode": "*",
"active": false,
"previouslyActive": false,
"firmName": null
}
]
The code T means (or at least used to mean back in 2015) "own products" (in Polish: "produkty własne"). This is the only profile I have here.
No idea what the other codes mean.
We need to invent some names for the profiles. I suppose we could go with personal/L, personal/T etc., and leave figuring out what they mean as an exercise to the users. Not ideal, but certainly better than an internal error. :)
I suppose we could go with
personal/L,personal/Tetc.
Implemented in c41e95ae1080a7430818fc22aeb8850f7946176d.
Let me know if it works for you.
Also let me know if you have better ideas how it should work. :)
Will check later today, and regarding proflies - when I click in profile switcher on website I have four options (in Polish):
- pełnomocnictwa
- produkty własne
- wszystkie produkty
- profil firmowy COMPANY NAME
so I guess profile named "*" is "all products" from personal account.
I found this in one of the JavaScript files:
switch (code) {
case "L":
return this._getIndyvidualProfileLabel("powerOfAttorneyProfile");
case "T":
return this._getIndyvidualProfileLabel("ownProductsProfile");
case "*":
return this._getIndyvidualProfileLabel("allProductsProfile");
default:
return this._getLiteral("companyProfileLabel");
}
Works for me. Thank You.