Allow taxes to be an array reference
[Business-OnlinePayment-InternetSecure.git] / InternetSecure.pm
index 9aa2d8d..f3eacc8 100755 (executable)
@@ -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