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

@ -128,7 +128,7 @@ sub getCartTemplateVariables {
my $cartProperties = $cart->get;
$cartProperties->{ totalPrice } = $cart->calculateSubtotal;
$cartProperties->{ tax } = $cart->getTaxes;
$cartProperties->{ tax } = $cart->calculateTaxes;
# Include shipping address
my $address = eval { $cart->getShippingAddress };
@ -236,9 +236,9 @@ sub www_pay {
my $billingAddress = $self->getBillingAddress( $session->scratch->get( 'ShopPayDriverCash_billingAddressId' ) );
# Complete the transaction
$self->processTransaction( $billingAddress );
my $transaction = $self->processTransaction( $billingAddress );
return $session->style->userStyle('Thank you for ordering');
return $transaction->www_thankYou($session);
}
#-------------------------------------------------------------------

View file

@ -144,6 +144,30 @@ sub _generatePaymentRequestXML {
}
}
# taxes, shipping, etc
my $i18n = WebGUI::International->new($session, "Shop");
if ($transaction->get('taxes') > 0) {
push @{ $orderItems->{ Item } }, {
Description => $i18n->get('taxes'),
Cost => $transaction->get('taxes'),
Qty => 1,
};
}
if ($transaction->get('shippingPrice') > 0) {
push @{ $orderItems->{ Item } }, {
Description => $i18n->get('shipping'),
Cost => $transaction->get('shippingPrice'),
Qty => 1,
};
}
if ($transaction->get('shopCreditDeduction') < 0) {
push @{ $orderItems->{ Item } }, {
Description => $i18n->get('in shop credit'),
Cost => $transaction->get('shopCreditDeduction'),
Qty => 1,
};
}
my $vendorData;
$vendorData->{ Element }->{ Name } = 'transactionId';
$vendorData->{ Element }->{ Value } = $transaction->getId;
@ -428,9 +452,9 @@ sub www_pay {
return $self->www_getCredentials( $credentialsErrors ) if $credentialsErrors;
# Payment time!
$self->processTransaction;
my $transaction = $self->processTransaction;
return $session->style->userStyle('Thank you for your order');
return $transaction->www_thankYou($session);
}
1;