
This should have been done much earlier, but wasn't done for nostalgic reasons. To new users, it didn't make sense that you could just enter an amount, and revbank would just accept that as "withdrawal or unlisted product". It existed for backwards compatibility with the very first revbank version, which didn't have a product list, and which was not yet used with a barcode scanner. You would simply enter the amount and your name, and there were no further statistics. Nowadays, there are statistics that are messed up if you don't use the product codes. And some people were looking for a withdrawal command, and try 'take' as that seems closest to it, but which instead transfers money to another account. Additionally, some texts were changed for improved clarity. ("Enter username to pay", when withdrawing, was confusing: one expects money back, not to pay more.)
25 lines
778 B
Perl
25 lines
778 B
Perl
#!perl
|
|
|
|
HELP "withdraw <amount>" => "Withdraw from your account";
|
|
|
|
sub command :Tab(withdraw) ($self, $cart, $command, @) {
|
|
if (defined parse_amount($command)) {
|
|
warn "Note: raw amounts for withdrawal or unlisted products are no longer supported.\n\n";
|
|
warn "Please use the 'withdraw' command to take money out of your revbank account, or\n";
|
|
warn "the 'unlisted' command to pay for an unlisted product.\n\n";
|
|
}
|
|
|
|
$command eq 'withdraw' or return NEXT;
|
|
|
|
return "Amount to withdraw from your account", \&amount;
|
|
}
|
|
|
|
sub amount($self, $cart, $arg, @) {
|
|
my $amount = parse_amount($arg);
|
|
defined $amount or return REJECT, "Invalid amount";
|
|
|
|
$cart->add(-$amount, "Withdrawal",
|
|
{ is_withdrawal => 1 });
|
|
|
|
return ACCEPT;
|
|
}
|