From 6fe302774c1eb4e929579929ba53c64611ddf974 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 29 Apr 2010 14:57:27 -0700 Subject: [PATCH] remove www_selectPaymentGateway, and www_checkout which are now dead code --- lib/WebGUI/Shop/Cart.pm | 18 ------------ lib/WebGUI/Shop/Pay.pm | 64 ----------------------------------------- 2 files changed, 82 deletions(-) diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm index eaffdce21..2eff363ad 100644 --- a/lib/WebGUI/Shop/Cart.pm +++ b/lib/WebGUI/Shop/Cart.pm @@ -784,24 +784,6 @@ sub updateFromForm { $self->update( $cartProperties ); } -#------------------------------------------------------------------- -# -#=head2 www_checkout ( ) -# -#Update the cart and then redirect the user to the payment gateway screen. -# -#=cut -# -#sub www_checkout { -# my $self = shift; -# $self->updateFromForm; -# if ($error{id $self} ne "") { -# return $self->www_view; -# } -# $self->session->http->setRedirect($self->session->url->page('shop=pay;method=selectPaymentGateway')); -# return undef; -#} -# #------------------------------------------------------------------- =head2 www_continueShopping ( ) diff --git a/lib/WebGUI/Shop/Pay.pm b/lib/WebGUI/Shop/Pay.pm index 7f0d83f6a..d1b77ff6f 100644 --- a/lib/WebGUI/Shop/Pay.pm +++ b/lib/WebGUI/Shop/Pay.pm @@ -366,68 +366,4 @@ sub www_manage { return $console->render($output, $i18n->get("payment methods")); } -#------------------------------------------------------------------- - -=head2 www_selectPaymentGateway ( ) - -The screen in which a customer chooses a payment gateway. - -TODO: Template this screen. - -=cut - -sub www_selectPaymentGateway { - my $self = shift; - my $session = $self->session; - - my $cart = WebGUI::Shop::Cart->newBySession( $session ); - my $i18n = WebGUI::International->new( $session, 'Shop' ); - - # Make sure the user is logged in. - if ($session->user->isVisitor) { - $session->scratch->set( 'redirectAfterLogin', $session->url->page('shop=pay;method=selectPaymentGateway') ); - - # We cannot use WebGUI::Operation::execute( $session, 'auth'); because the method form param used by the - # Shop contenthandler overrides the method param used by WG::Op::Auth - $session->http->setRedirect( $session->url->page('op=auth;method=init') ); - - # If the redirect fails make sure people can still go to the login screen by giving them a link - return $session->style->userStyle( - sprintf $i18n->get('login message'), $session->url->page('op=auth;method=init') - ); - } - - # Check if the cart is ready for checkout - unless ($cart->readyForCheckout) { - $session->http->setRedirect( $session->url->page('shop=cart;method=view') ); - return ''; - } - - # Complete Transaction if it's a $0 transaction. - my $total = $cart->calculateTotal; - if (sprintf('%.2f', $total + $cart->calculateShopCreditDeduction($total)) eq '0.00') { - my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $cart}); - $transaction->completePurchase('zero', 'success', 'success'); - $cart->onCompletePurchase; - $transaction->sendNotifications(); - return $transaction->thankYou(); - } - - # All the output stuff below is just a placeholder until it's templated. - my $payOptions = $self->getOptions( $cart ); - - # TODO: If only one payOption exists, just send us there - # In order to do this, the PayDriver must give us a direct URL to go to - - my $var; - my @paymentGateways; - foreach my $payOption ( values %{$payOptions} ) { - push @paymentGateways, $payOption; - } - $var->{ paymentGateways } = \@paymentGateways; - $var->{ choose } = $i18n->get('choose payment gateway message'); - my $template = WebGUI::Asset::Template->new($session, $session->setting->get("selectGatewayTemplateId")); - return $session->style->userStyle($template->process($var)); -} - 1;