From f30cb431188e85c2b03dd16a3f9b3cc8c901d2ed Mon Sep 17 00:00:00 2001 From: fbriere Date: Sat, 18 Feb 2006 03:59:45 +0000 Subject: Allow taxes to be an array reference --- InternetSecure.pm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'InternetSecure.pm') diff --git a/InternetSecure.pm b/InternetSecure.pm index 9aa2d8d..f3eacc8 100755 --- a/InternetSecure.pm +++ b/InternetSecure.pm @@ -108,9 +108,14 @@ sub prod_string { my @flags = ($currency); - foreach (ref $data{taxes} ? - @{ $data{taxes} } : - split(' ' => $data{taxes} || '')) { + my @taxes; + if (ref $data{taxes}) { + @taxes = @{ $data{taxes} }; + } elsif ($data{taxes}) { + @taxes = split ' ' => $data{taxes}; + } + + foreach (@taxes) { croak "Unknown tax code $_" unless /^(GST|PST|HST)$/i; push @flags, uc $_; } @@ -148,8 +153,6 @@ sub to_xml { croak "Unknown currency code ", $content{currency} unless $content{currency} =~ /^(CAD|USD)$/; - $content{taxes} = uc($content{taxes} || ''); - my %data = $self->get_remap_fields(qw( xxxCard_Number card_number @@ -467,10 +470,12 @@ C (default) or C. =item taxes -Taxes to be added automatically to B by InternetSecure. +Taxes to be added automatically to B by InternetSecure. Available +taxes are C, C and C. -Available taxes are C, C and C. Multiple taxes can specified -by concatenating them with spaces, such as C. +This argument can either be a single string of taxes concatenated with spaces +(such as C), or a reference to an array of taxes (such as C<[ "GST", +"PST" ]>). =item name / company / address / city / state / zip / country / phone / email -- cgit v1.2.1