Add common cart summary template variables to the PayDriver. Add a summary screen for Cash. i18n fixes for Cash.

This commit is contained in:
Colin Kuskie 2010-04-28 11:19:34 -07:00
parent d48d9bc90f
commit a472f9ebdd
5 changed files with 106 additions and 67 deletions

View file

@ -80,6 +80,33 @@ sub _buildObj {
}
#-------------------------------------------------------------------
=head2 appendCartVariables ( $var )
Append the subtotal, shipping, tax, and shop credeductions to a set of template
variables.
=cut
sub appendCartVariables {
my ($self, $var) = @_;
$var ||= {};
my $cart = $self->getCart;
$var->{shippableItemsInCart} = $cart->requiresShipping;
$var->{subtotal} = $cart->calculateSubtotal;
$var->{shipping} = $cart->calculateShipping;
$var->{taxes} = $cart->calculateTaxes;
my $totalPrice = $var->{subtotal} + $var->{shipping} + $var->{taxes};
my $session = $self->session;
my $credit = WebGUI::Shop::Credit->new($session, $cart->getPosUser->userId);
$var->{inShopCreditAvailable} = $credit->getSum;
$var->{inShopCreditDeduction} = $credit->calculateDeduction($var->{totalPrice});
$var->{totalPrice } = $self->formatCurrency($totalPrice + $var->{inShopCreditDeduction});
return $self;
}
#-------------------------------------------------------------------
=head2 cancelRecurringPayment ( transaction )