diff options
author | fbriere <fbriere> | 2006-02-18 03:59:45 +0000 |
---|---|---|
committer | fbriere <fbriere> | 2006-02-18 03:59:45 +0000 |
commit | f30cb431188e85c2b03dd16a3f9b3cc8c901d2ed (patch) | |
tree | a5e65e11d8196a55ea57a7e776b2e5f92f72eea6 /InternetSecure.pm | |
parent | 9269574aa82993a70a22137949980ba5b87efe8f (diff) |
Allow taxes to be an array reference
Diffstat (limited to 'InternetSecure.pm')
-rwxr-xr-x | InternetSecure.pm | 21 |
1 files changed, 13 insertions, 8 deletions
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<CAD> (default) or C<USD>. =item taxes -Taxes to be added automatically to B<amount> by InternetSecure. +Taxes to be added automatically to B<amount> by InternetSecure. Available +taxes are C<GST>, C<PST> and C<HST>. -Available taxes are C<GST>, C<PST> and C<HST>. Multiple taxes can specified -by concatenating them with spaces, such as C<GST HST>. +This argument can either be a single string of taxes concatenated with spaces +(such as C<GST PST>), or a reference to an array of taxes (such as C<[ "GST", +"PST" ]>). =item name / company / address / city / state / zip / country / phone / email |