# Convert a single product into a product string
#
sub prod_string {
- my ($self, $currency, $taxes, %data) = @_;
+ my ($self, $currency, %data) = @_;
croak "Missing amount in product" unless defined $data{amount};
my @flags = ($currency);
- $taxes = uc $data{taxes} if defined $data{taxes};
- foreach (split ' ' => $taxes) {
+ foreach (split ' ' => uc($data{taxes} || '')) {
croak "Unknown tax code $_" unless /^(GST|PST|HST)$/;
push @flags, $_;
}
if (ref $content{description}) {
$data{Products} = join '|' => map $self->prod_string(
- $content{currency},
- $content{taxes},
- %$_),
- @{ $content{description} };
+ $content{currency},
+ taxes => $content{taxes},
+ %$_),
+ @{ $content{description} };
} else {
$self->required_fields(qw(amount));
$data{Products} = $self->prod_string(
$content{currency},
- $content{taxes},
- amount => $content{amount},
+ taxes => $content{taxes},
+ amount => $content{amount},
description => $content{description},
);
}