zero dollar transactions

in-shop credit applies to orders
This commit is contained in:
JT Smith 2008-05-05 19:53:25 +00:00
parent d7c6507c8b
commit fd7a1d28a1
12 changed files with 188 additions and 30 deletions

View file

@ -347,6 +347,15 @@ sub www_selectPaymentGateway {
$session->http->setRedirect( $session->url->page('shop=cart;method=view') );
return '';
}
# Complete Transaction if it's a $0 transaction.
my $total = $cart->calculateTotal;
if (($total + $cart->calculateShopCreditDeduction($total)) == 0) {
my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $cart});
$transaction->completePurchase('zero', 'success', 'success');
$cart->onCompletePurchase;
$transaction->www_thankYou($session);
}
# All the output stuff below is just a placeholder until it's templated.
my $output .= $i18n->echo('How would you like to pay?');