diff --git a/lib/WebGUI/Shop/PayDriver/Cash.pm b/lib/WebGUI/Shop/PayDriver/Cash.pm index fd24194a4..5f3d2a53e 100644 --- a/lib/WebGUI/Shop/PayDriver/Cash.pm +++ b/lib/WebGUI/Shop/PayDriver/Cash.pm @@ -175,14 +175,6 @@ sub www_pay { my $billingAddress = $self->getBillingAddress( $session->scratch->get( 'ShopPayDriverCash_billingAddressId' ) ); - # Create a transaction and complete the purchase - my $transaction = WebGUI::Shop::Transaction->create( $session, { - cart => $cart, - paymentAddress => $billingAddress, - paymentMethod => $self, - }); - $transaction->completePurchase( $cart, 'CASH', 'OK', 'Cash payment' ); - # Generate a receipt and send it if enabled. if ( $self->get('sendReceipt') ) { # Setup receipt tmpl_vars @@ -205,6 +197,14 @@ sub www_pay { } + # Create a transaction and complete the purchase + my $transaction = WebGUI::Shop::Transaction->create( $session, { + cart => $cart, + paymentAddress => $billingAddress, + paymentMethod => $self, + }); + $transaction->completePurchase( $cart, 'CASH', 'OK', 'Cash payment' ); + return $session->style->userStyle('Thank you for ordering'); }