Google-Checkout

 view release on metacpan or  search on metacpan

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

Google::Checkout::General::Shipping
Google::Checkout::General::TaxTable
Google::Checkout::General::MerchantCalculations

=cut

#--
#--   <merchant-checkout-flow-support></merchant-checkout-flow-support>
#--

use strict;
use warnings;

use Google::Checkout::General::Util qw/is_shipping_method is_tax_table is_parameterized_url/;

sub new 
{
  my ($class, %args) = @_;

  my $self = {};

  if ($args{shipping_method})
  {
    push(@{$self->{shipping_method}}, $_) 
      for grep is_shipping_method($_), @{$args{shipping_method}};
  }
  if ($args{tax_table})
  {
    push(@{$self->{tax_table}}, $_) 
      for grep is_tax_table($_), @{$args{tax_table}};
  }

  $self->{edit_cart_url} = $args{edit_cart_url}
    if defined $args{edit_cart_url};

  $self->{continue_shopping_url} = $args{continue_shopping_url}
    if defined $args{continue_shopping_url};

  $self->{buyer_phone} = $args{buyer_phone}
    if defined $args{buyer_phone};

  $self->{merchant_calculation} = $args{merchant_calculation} 
    if $args{merchant_calculation};

  $self->{analytics_data} = $args{analytics_data}
    if $args{analytics_data};

  # DEPRECATED
  $self->{parameterized_url} = $args{parameterized_url}
    if $args{parameterized_url};
    
  if ($args{parameterized_urls})
  {
    push(@{$self->{parameterized_urls}}, $_) 
      for grep is_parameterized_url($_), @{$args{parameterized_urls}};
  }
  
  $self->{platform_id} = $args{platform_id}
    if defined $args{platform_id};

  return bless $self => $class;
}

sub get_shipping_method 
{ 
  my ($self) = @_;
  return $self->{shipping_method}; 
}

sub add_shipping_method
{
  my ($self, $shipping_method) = @_;

  push(@{$self->{shipping_method}}, $shipping_method)
    if is_shipping_method $shipping_method;
}

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

  return $self->{tax_table}; 
}

sub add_tax_table
{
  my ($self, $tax_table) = @_;

  push(@{$self->{tax_table}}, $tax_table)
    if is_tax_table $tax_table;
}

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

  return $self->{edit_cart_url}; 
}

sub set_edit_cart_url
{
  my ($self, $edit_cart_url) = @_;

  $self->{edit_cart_url} = $edit_cart_url 
    if defined $edit_cart_url;
}

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

  return $self->{continue_shopping_url}; 
}

sub set_continue_shopping_url
{
  my ($self, $continue_shopping_url) = @_;

  $self->{continue_shopping_url} = $continue_shopping_url
    if defined $continue_shopping_url;
}

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

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