Google-Checkout

 view release on metacpan or  search on metacpan

lib/Google/Checkout/General/ShippingRestrictions.pm  view on Meta::CPAN

      s/\s//g;
      push(@{$self->{allowed_state}}, $_);
    }
  }

  if ($args{allowed_zip})
  {
    for (@{$args{allowed_zip}})
    {
      #--
      #-- Clean up. Even an extra space cause GCO to error out!
      #--
      s/\s//g;
      push(@{$self->{allowed_zip}}, $_); 
    }
  }

  if ($args{allowed_country_area})
  {
    push(@{$self->{allowed_country_area}}, $_) 
      for (@{$args{allowed_country_area}});
  }
  
  if ($args{allowed_postal_area})
  {
    foreach my $postal_area (@{$args{allowed_postal_area}})
    {
      if (ref($postal_area) eq 'HASH')
      {
        push(@{$self->{allowed_postal_area}}, $postal_area);
      }
      elsif ($postal_area eq Google::Checkout::XML::Constants::EU_COUNTRIES)
      {
        foreach my $country (Google::Checkout::General::ShippingRestrictions::EU_COUNTRIES)
        {
          push(@{$self->{allowed_postal_area}}, {country_code => $country});
        }
      }
    }
  }

  #--
  #-- Excluded area
  #--
  if ($args{excluded_state})
  {
    push(@{$self->{excluded_state}}, $_) for (@{$args{excluded_state}});
  }

  if ($args{excluded_zip})
  {
    push(@{$self->{excluded_zip}}, $_) for (@{$args{excluded_zip}});
  }

  if ($args{excluded_country_area})
  {
    push(@{$self->{excluded_country_area}}, $_) 
      for (@{$args{excluded_country_area}});
  }

  return bless $self => $class;
}

### BEGIN DEPRECATED ###
sub add_allowed_allow_us_po_box
{
  my ($self, $data) = @_;
  
  return $self->set_allow_us_po_box($data);
}

sub get_allowed_allow_us_po_box
{
  my ($self) = @_;

  return $self->get_allow_us_po_box; 
}
### END DEPRECATED ###

# Allowed State
sub add_allowed_state        
{ 
  my ($self, $data) = @_;

  $data =~ s/\s//g;

  push(@{$self->{allowed_state}}, $data) if defined $data;
}

sub get_allowed_state        
{ 
  my ($self) = @_;

  return $self->{allowed_state}; 
}

# Allowed Zip
sub add_allowed_zip          
{
  my ($self, $data) = @_;

  $data =~ s/\s//g;
 
  push(@{$self->{allowed_zip}}, $data) if defined $data;
}

sub get_allowed_zip          
{ 
  my ($self) = @_;

  return $self->{allowed_zip};
}

# Allowed US Country Area e.g. All states, 48 States
sub add_allowed_country_area 
{
  my ($self, $data) = @_;
 
  push(@{$self->{allowed_country_area}}, $data) if defined $data;
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.916 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )