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

Support for credit cards

Open jwilk opened this issue 14 years ago • 25 comments

Issue reported by szymon.zygmunt at Google Code:

Is possible to extension functionality for credit cards (current and withholdings operatione etc.)?

jwilk avatar Dec 30 '10 19:12 jwilk

None of the active mbank-cli developers use credit cards. So unless someone contributes code for this functionality, the answer is no.

jwilk avatar Dec 30 '10 20:12 jwilk

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?

jwilk avatar Feb 08 '11 14:02 jwilk

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.

jwilk avatar Feb 17 '11 18:02 jwilk

Comment submitted by pkassin at Google Code:

I just send mail with patch to @jwilk via email, please check this.

jwilk avatar May 04 '11 15:05 jwilk

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.

jwilk avatar Jul 25 '11 12:07 jwilk

Piotr, could you attach your latest patch to the bug log, so that we can revive the discussion (and let others test and comment)?

jwilk avatar Jul 25 '11 17:07 jwilk

Comment submitted by szymon.zygmunt at Google Code:

Ping...

jwilk avatar Aug 05 '11 11:08 jwilk

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

jwilk avatar Aug 09 '11 10:08 jwilk

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

jwilk avatar Jun 15 '12 19:06 jwilk

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

jwilk avatar Jun 16 '12 10:06 jwilk

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

jwilk avatar Jun 18 '12 16:06 jwilk

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?

jwilk avatar Jun 18 '12 17:06 jwilk

Comment submitted by pkassin at Google Code:

Fixed ccard-2012-06-18_02.patch


Attachment: ccard-2012-06-18_02.patch

jwilk avatar Jun 18 '12 21:06 jwilk

Comment submitted by szymon.zygmunt at Google Code:

Now works perfect for me. Is any chance to include this patch to the repository?

jwilk avatar Jun 19 '12 15:06 jwilk

Comment submitted by szymon.zygmunt at Google Code:

Hi developers. What do you think about patch? Could you include to the official script?

jwilk avatar Jul 01 '12 16:07 jwilk

I'll take a look at the patch in a few days.

jwilk avatar Jul 02 '12 10:07 jwilk

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
                                                   ^^^^^^^^

).

jwilk avatar Jul 02 '12 16:07 jwilk

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.

jwilk avatar Jul 07 '12 20:07 jwilk

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.

jwilk avatar May 27 '14 21:05 jwilk

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. :-)

jwilk avatar Jun 10 '14 11:06 jwilk

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?

jwilk avatar Jun 08 '15 17:06 jwilk

Looks like I'm a miner :) Is there any plan to support credit card billings? Great tool!

uKL avatar Oct 24 '17 16:10 uKL

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.

jwilk avatar Nov 13 '17 15:11 jwilk

Please my credit card code send

Zainkoko12 avatar Sep 16 '23 22:09 Zainkoko12

Please my credit card code send

What do you mean?

jwilk avatar Sep 19 '23 09:09 jwilk