revbank/plugins/unlisted
Juerd Waalboer 997917ae82 New plugin: "unlisted"
Lets the user provide a description for deducting arbitrary amounts.
2018-08-03 00:58:19 +02:00

22 lines
554 B
Perl
Executable file

#!perl
HELP "unlisted" => "Buy unlisted product (manual entry)";
sub command :Tab(unlisted) {
my ($self, $cart, $command) = @_;
$command eq 'unlisted' or return NEXT;
return "Amount to deduct from your account", \&amount;
}
sub amount {
my ($self, $cart, $arg) = @_;
$self->{amount} = parse_amount($arg) or return REJECT, "Invalid amount.";
return "Please provide a short description", \&description;
}
sub description {
my ($self, $cart, $desc) = @_;
$cart->add(undef, -$self->{amount}, $desc);
return ACCEPT;
}