diff --git a/plugins/unlisted b/plugins/unlisted index cb100a1..1ef9964 100755 --- a/plugins/unlisted +++ b/plugins/unlisted @@ -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; }