Google-Checkout

 view release on metacpan or  search on metacpan

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

FLAG is optional and if passed in, it will be used to set whether
or not this is the default tax table. After the flag is set,
the old value is returned. If FLAG is not passed in, the current
value is returned.

=item get_name

Returns the name of the tax table.

=item set_name NAME

Sets the name of the tax table.

=item get_standalone

Returns the string 'true' if this tax table can be used as
standalone. Returns the string 'false' otherwise.

=item set_standalone FLAG

If FLAG is true, the tax table can be standalone. Otherwise,
it's not standalone.

=item get_tax_rules

Returns an array reference of all tax rules. Each element is
an object of C<Google::Checkout::General::TaxRule>.

=item add_tax_rule RULE

Adds another C<Google::Checkout::General::TaxRule>.

=back

=cut

=head1 COPYRIGHT

Copyright 2006 Google. All rights reserved.

=head1 SEE ALSO

Google::Checkout::General::TaxRule
Google::Checkout::General::MerchantCheckoutFlow

=cut

use strict;
use warnings;

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

  my $self = {default      => $args{default},
              name         => $args{name} || '',
              standalone   => $args{standalone} ? 'true' : 'false'};

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

  return bless $self => $class;
}

sub is_default 
{
  my ($self, $data) = @_;

  my $oldv = $self->{default};

  $self->{default} = $data if @_ > 1;

  return $oldv;
}

sub get_name 
{
  my ($self) = @_;
 
  return $self->{name}; 
}

sub set_name
{
  my ($self, $name) = @_;

  $self->{name} = $name if $name;
}

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

  return $self->{standalone}; 
}

sub set_standalone
{
  my ($self, $value) = @_;

  $self->{standalone} = $value ? 'true' : 'false';
}

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

  return $self->{rules}; 
}

sub add_tax_rule
{
  my ($self, $rule) = @_;

  push(@{$self->{rules}}, $rule) if $rule;
}

1;

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

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