From e0a9f34b53420e292ad6f69df80bfdc0f99c6517 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Apr 2010 17:29:14 -0700 Subject: [PATCH] Update readyForCheckout, shipping address is optional, must have gatewayId, too. --- lib/WebGUI/Shop/Cart.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm index 1385be61c..23947209a 100644 --- a/lib/WebGUI/Shop/Cart.pm +++ b/lib/WebGUI/Shop/Cart.pm @@ -526,13 +526,15 @@ sub readyForCheckout { return 0 if WebGUI::Error->caught; # Check if the shipping address is set and correct - my $shipAddress = eval{$self->getShippingAddress}; - return 0 if WebGUI::Error->caught; + if ($self->requiresShipping) { + my $shipAddress = eval{$self->getShippingAddress}; + return 0 if WebGUI::Error->caught; + } # Check if the cart has items return 0 unless scalar @{ $self->getItems }; - # fail if there are multiple recurring items or if + # fail if there are multiple recurring items return 0 if ($self->hasMixedItems); # Check minimum cart checkout requirement @@ -549,6 +551,9 @@ sub readyForCheckout { ##Must have a configured shipping id. return 0 if ! $self->get('shipperId'); + ##Must have a configured payment method. + return 0 if ! $self->get('gatewayId'); + ##Check for any other logged errors return 0 if $error{ id $self };