New plugin: "unlisted"
Lets the user provide a description for deducting arbitrary amounts.
This commit is contained in:
parent
5c16008038
commit
997917ae82
1 changed files with 22 additions and 0 deletions
22
plugins/unlisted
Executable file
22
plugins/unlisted
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!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;
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue