Add "donate" command
This commit is contained in:
parent
9ef84285a4
commit
3e49346bc5
1 changed files with 10 additions and 2 deletions
|
@ -2,15 +2,23 @@
|
|||
|
||||
HELP "unlisted" => "Buy unlisted product (manual entry)";
|
||||
|
||||
sub command :Tab(unlisted) {
|
||||
sub command :Tab(unlisted,donate) {
|
||||
my ($self, $cart, $command) = @_;
|
||||
$command eq 'unlisted' or return NEXT;
|
||||
$command eq 'unlisted' or $command eq 'donate' or return NEXT;
|
||||
$self->{command} = $command;
|
||||
|
||||
return "Amount to deduct from your account", \&amount;
|
||||
}
|
||||
|
||||
sub amount {
|
||||
my ($self, $cart, $arg) = @_;
|
||||
$self->{amount} = parse_amount($arg) or return REJECT, "Invalid amount.";
|
||||
|
||||
if ($self->{command} eq 'donate') {
|
||||
$cart->add(undef, -$self->{amount}, "Donation (THANK YOU!)");
|
||||
return ACCEPT;
|
||||
}
|
||||
|
||||
return "Please provide a short description", \&description;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue