summaryrefslogtreecommitdiff
path: root/InternetSecure.pm
diff options
context:
space:
mode:
authorfbriere <fbriere>2006-02-18 03:59:45 +0000
committerfbriere <fbriere>2006-02-18 03:59:45 +0000
commitf30cb431188e85c2b03dd16a3f9b3cc8c901d2ed (patch)
treea5e65e11d8196a55ea57a7e776b2e5f92f72eea6 /InternetSecure.pm
parent9269574aa82993a70a22137949980ba5b87efe8f (diff)
Allow taxes to be an array reference
Diffstat (limited to 'InternetSecure.pm')
-rwxr-xr-xInternetSecure.pm21
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