mbank-cli
mbank-cli copied to clipboard
Support for credit cards
Issue reported by szymon.zygmunt
at Google Code:
Is possible to extension functionality for credit cards (current and withholdings operatione etc.)?
None of the active mbank-cli developers use credit cards. So unless someone contributes code for this functionality, the answer is no.
Comment submitted by szymon.zygmunt
at Google Code:
I can cooperate and senda You required information to do it (I have Visa Classic). Do You think it's possible?
Comment submitted by marcind1976md
at Google Code:
Support for credit cards would be useful, but it isn't critical function. I can send in source code of appropriate pages.
Comment submitted by pkassin
at Google Code:
I just send mail with patch to @jwilk via email, please check this.
Comment submitted by [email protected]
at Google Code:
Will the patch be used? I'm interested in this functionality and don't want to reinvent the wheel.
Piotr, could you attach your latest patch to the bug log, so that we can revive the discussion (and let others test and comment)?
Comment submitted by szymon.zygmunt
at Google Code:
Ping...
Comment submitted by pkassin
at Google Code:
using:
dj@beer:~/mbank-cli$ ./mbank-cli_new_ccard ccard list
1801 - VISA CLASSIC CREDIT 4483 **** **** 1801 AKTYWNA 6400.00 PLN 2689.96 PLN
9913 - VISA CLASSIC CREDIT 4483 **** **** 9913 ZASTRZEŻONA 6400.00 PLN 2689.96 PLN
dj@beer:~/mbank-cli$ ./mbank-cli_new_ccard ccard 1801 present
VISA CLASSIC CREDIT 4483 **** **** 1801
2011-05-01 2011-05-03 *1801 W KRAJU -6.90 PLN -6.90 PLN STACJA STATOIL NR 245
2011-04-30 2011-05-03 *1801 W KRAJU -12.07 PLN -12.07 PLN REAL 1031 MOBILNA 120
2011-04-25 2011-04-29 *1801 INTERNET -284.96 PLN -284.96 PLN PAYPAL *SONYELECTRO
dj@beer:~/mbank-cli$ ./mbank-cli_new_ccard ccard 1801 block
VISA CLASSIC CREDIT 4483 **** **** 1801
2011-05-06 RIVER ISLAND Lublin 31.92PLN
2011-05-06 RIVER ISLAND Lublin 143.20PLN
dj@beer:~/mbank-cli$ ./mbank-cli_new_ccard ccard 9913 block
VISA CLASSIC CREDIT 4483 **** **** 9913
Brak blokad na karcie
dj@beer:~/mbank-cli$
list and present are default action, so you can ignore it:
./mbank-cli_new_ccard ccard
./mbank-cli_new_ccard ccard 1801
Attachment: ccard-2011-05-07.patch
Comment submitted by szymon.zygmunt
at Google Code:
I try this patch and ccard option almost works. I have problem with present
action and i guess that is caused by "mTransfer" transactions on my credit card. Probably "automatic repayment" do the problem as well. Screen of my last current transaction is in attachment.
Attachment: mBank.png
Comment submitted by szymon.zygmunt
at Google Code:
Here is a code of page with current transaction on my Visa Classic.
Attachment: cc_current_operations_list.aspx
Comment submitted by pkassin
at Google Code:
już powinno być ok,
Patch ccard-2012-06-18.patch
Zakładałem, że zawsze jest numer karty w operacji, nie ma jej też dla SPŁATY i tych Twoim MTRANSFER dodałem maskowanie ZWROTÓW, SPŁATY i MTRANSFER na krótki opis
teraz tak to wygląda:
dj@beer:~/mbank-cli$ ./mbank_2 ccard 1801 present
VISA CLASSIC CREDIT 4483 **** **** 1801
2012-06-18 2012-06-18 ---- SPŁATA 10.00 PLN 10.00 PLN -----
2012-06-16 2012-06-18 1801 W KRAJU -32.30 PLN -32.30 PLN REAL 1231 LUBLIN 21
2012-06-16 2012-06-18 1801 W KRAJU -40.40 PLN -40.40 PLN LIDL 1155 KASA 2
2012-06-13 2012-06-15 1801 ZWROT 20.00 PLN 20.00 PLN MARKET OBI 031 MB KASA
2012-06-12 2012-06-14 1801 W KRAJU -30.00 PLN -30.00 PLN Apteka Zana
Attachment: ccard-2012-06-18.patch
Comment submitted by szymon.zygmunt
at Google Code:
Łatka zaaplikowana z powodzeniem jednak nadal coś jest nie tak u mnie i dla "present" nie dostaję nic. Podesłać coś jeszcze?
Comment submitted by pkassin
at Google Code:
Fixed
ccard-2012-06-18_02.patch
Attachment: ccard-2012-06-18_02.patch
Comment submitted by szymon.zygmunt
at Google Code:
Now works perfect for me. Is any chance to include this patch to the repository?
Comment submitted by szymon.zygmunt
at Google Code:
Hi developers. What do you think about patch? Could you include to the official script?
I'll take a look at the patch in a few days.
Comment submitted by szymon.zygmunt
at Google Code:
Than you. We're waiting.
Ps. one small notice in `block` option - formatting of "Amount" field is different from other function (missing space between amount and currency eg.
```2012-06-30 CARREFOUR KRAKOW WITOSA KRAKOW 48.82PLN
^^^^^^^^
).
Okay, here's my review of the patch:
elsif (grep $action eq $_, qw(list funds deposits notices ccard))
For consistency with other command names, it should be plurar. I think it would be more future-proof if the command name was "cards". It might be not very difficult to extend this code to support other types of cards. On the other hand, we could rename it later as well.
my $card = shift @ARGV;
$card = 'list' unless defined $card;
my $card_action = shift @ARGV;
$card_action = 'present' unless defined $card_action;
I'd prefer ccard <action> <number>
over ccard <number> <action>
.
$web_accounts_list->{content} =~ m{<a[ ]onclick="([^"]*)" [^>]+?>Karty} or api_error('CCard1'); #"
Some time ago I renamed all error codes to be lowercase. For consistency, this should be updated, too.
my $cards_list_re =qr{<li[^>]*?><p class="Card"><a[^>]+>(.*?)</a>.*?<p class="CardStatus"><span[^>]+>(.*?)</span></p><p class="Amount"><span[^>]+>(.*?) ([A-Z]+)</span></p><p class="Amount"><span[^>]+>(.*?) ([A-Z]+)</span>};
A space after "=" is missing. I highly recommend not use .*
or .+
or .*?
when parsing HTML. They can easily consume more text than you wanted (even though the latter is non-greedy).
printf "%s - %s\t%12.12s %8.2f %s\t%8.2f %s\n", $cardnr_short, $cardnr, $card_status, $card_limit, $card_limit_currency, $card_available, $card_available_currency;
I don't think that printing both full card name and its last 4 digts is useful. Print just the former.
I'd not add any padding to keywords such as $card_status
. And I certainly don't want them to be trimmed if they happen to be longer than 12 characters.
elsif ($card_action eq "present")
Maybe "current" instead of "present"? http://www.mbank.pl/pomoc/eng/pomoc.html seems to agree with me. :)
$web_cards_list->{content} =~ m{<p class="Card"><a[^>]+"Wybierz kartę"[^>]+>([^<]+\*{4} \*{4} $card).*?<a.*?onclick="([^"]*)" [^>]+?>Operacje bie} or api_error('CCard1.5 - bad card numer??');
Please keep the code ASCII-only (no ę
s!).
print "$card_nr\n";
I'd like every line be in the same format. So without this print, please.
print "\tBrak operacji\n" unless ($web_card_list->{content} =~ /$card_re/);
As above, if there are no operation, then print nothing.
my $cardnr = substr($1 ? $1 : "----",-4);
Please use empty string instead of hyphens.
$namewhere =~ s/ZAKUP PRZY U.YCIU KARTY (- )?//;
$namewhere =~ s/(ZWROT).*/$1/;
$namewhere =~ s/(SP.ATA).*/$1/;
$namewhere =~ s/.*(MTRANSFER).*/$1/;
$namewhere=sprintf "%10.10s", $namewhere;
You are throwing away potentially useful information. Please don't. :)
elsif ($card_action eq "block")
Maybe blocked
instead of block
?
Last but not least, please add yourself to the list of copyright holders.
I started rewriting mbank-cli for the new web UI; see issue #49. This new code has some minimal support for cards, although I only tested it with debit cards.
I plan to release mbank-cli 1.0, which supports the new interface, in a week's time. Pre-release testing and feedback are very welcome. :-)
Could credit card holders see if the current version of mbank-cli work for them? Do you miss any functionality that's important for you?
Looks like I'm a miner :) Is there any plan to support credit card billings? Great tool!
Is there any plan to support credit card billings?
I'm the only active developer, and I don't have a credit card, so I'm afraid the answer is no.
Of course, if someone else contributed the code, I'd happy to merge it.
Please my credit card code send
Please my credit card code send
What do you mean?