From fdb151fc357a62023f6f9db6e21710522da0f4c7 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 24 Mar 2008 18:32:47 +0000 Subject: [PATCH] a little streamlining --- lib/WebGUI/Shop/PayDriver.pm | 6 +++--- lib/WebGUI/Shop/Transaction.pm | 13 ++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/WebGUI/Shop/PayDriver.pm b/lib/WebGUI/Shop/PayDriver.pm index 5fee6f4a0..087d1b14b 100644 --- a/lib/WebGUI/Shop/PayDriver.pm +++ b/lib/WebGUI/Shop/PayDriver.pm @@ -482,14 +482,14 @@ sub processTransaction { my ($self, $paymentAddress) = @_; my $cart = $self->getCart; my $transaction = WebGUI::Shop::Transaction->create($self->session,{ - cart => $cart, paymentMethod => $self, paymentAddress => $paymentAddress, }); my ($success, $transactionCode, $statusCode, $statusMessage) = $self->processPayment; if ($success) { - $transaction->completePurchase($cart, $transactionCode, $statusCode, $statusMessage); - $self->sendNotifications($transaction); + $transaction->completePurchase($cart, $transactionCode, $statusCode, $statusMessage); + $cart->onCompletePurchase; + $self->sendNotifications($transaction); } else { $transaction->denyTransaction($transactionCode, $statusCode, $statusMessage); diff --git a/lib/WebGUI/Shop/Transaction.pm b/lib/WebGUI/Shop/Transaction.pm index 361848c33..55d28a47b 100644 --- a/lib/WebGUI/Shop/Transaction.pm +++ b/lib/WebGUI/Shop/Transaction.pm @@ -67,18 +67,10 @@ sub addItem { #------------------------------------------------------------------- -=head2 completePurchase ( cart transactionCode, statusCode, statusMessage ) +=head2 completePurchase ( transactionCode, statusCode, statusMessage ) See also denyPurchase(). Completes a purchase by updating the transaction as a success, and clearing the cart of it's items. -=head3 cart - -A reference to the current cart that's full of items just purchased. - -=head3 paydriver - -A reference to the pay driver that just completed the transaction. - =head3 transactionCode The transaction id or code given by the payment gateway. @@ -94,8 +86,7 @@ The extended status message that came back from the payment gateway when trying =cut sub completePurchase { - my ($self, $cart, $transactionCode, $statusCode, $statusMessage) = @_; - $cart->onCompletePurchase; + my ($self, $transactionCode, $statusCode, $statusMessage) = @_; $self->update({ transactionCode => $transactionCode, isSuccessful => 1,