revbank/plugins/unlisted
Juerd Waalboer fa60e1081a chmod 644 plugins/*
Undoes 714b337 because github seems to no longer require chmod +x
for syntax highlighting extensionless files.
2019-08-07 15:42:16 +02:00

30 lines
760 B
Perl

#!perl
HELP "unlisted" => "Buy unlisted product (manual entry)";
sub command :Tab(unlisted,donate) {
my ($self, $cart, $command) = @_;
$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;
}
sub description {
my ($self, $cart, $desc) = @_;
$cart->add(undef, -$self->{amount}, $desc);
return ACCEPT;
}