Update readyForCheckout, shipping address is optional, must have gatewayId, too.

This commit is contained in:
Colin Kuskie 2010-04-27 17:29:14 -07:00
parent 822cac8dec
commit e0a9f34b53

View file

@ -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 };