Fix #7
This commit is contained in:
parent
31a1aa5c45
commit
f7a7a19d8d
5 changed files with 18 additions and 6 deletions
|
@ -75,6 +75,12 @@ sub size {
|
|||
sub checkout {
|
||||
my ($self, $user) = @_;
|
||||
|
||||
if ($self->entries('refuse_checkout')) {
|
||||
warn "Refusing to finalize deficient transaction.\n";
|
||||
$self->display;
|
||||
return;
|
||||
}
|
||||
|
||||
my $entries = $self->{entries};
|
||||
|
||||
my %deltas;
|
||||
|
@ -98,6 +104,7 @@ sub checkout {
|
|||
$self->empty;
|
||||
|
||||
sleep 1; # Ensure new timestamp/id for new transaction
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub entries {
|
||||
|
|
|
@ -27,9 +27,11 @@ sub hook_cart_changed {
|
|||
say "Pending:";
|
||||
$cart->display;
|
||||
|
||||
my $sum = $cart->sum;
|
||||
my $what = $sum > 0 ? "add %.2f" : "pay %.2f";
|
||||
say sprintf "Enter username to $what; type 'abort' to abort.", abs $sum;
|
||||
if (not $cart->entries('refuse_checkout')) {
|
||||
my $sum = $cart->sum;
|
||||
my $what = $sum > 0 ? "add %.2f" : "pay %.2f";
|
||||
say sprintf "Enter username to $what; type 'abort' to abort.", abs $sum;
|
||||
}
|
||||
}
|
||||
|
||||
sub hook_abort {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue