X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=lib%2FBusiness%2FOnlinePayment%2FWesternACH.pm;h=94ba800535e7d97ab65d673f826a41ed4545f9f4;hb=02a97cd04f67078f4a238f5968b00bca5fc68dc0;hp=e18a122012d3d84062170c7754c580fc71a2a5a0;hpb=c5ceaf62f0fb0366a47cb6142e6fe4c31c7e9828;p=Business-OnlinePayment-WesternACH.git diff --git a/lib/Business/OnlinePayment/WesternACH.pm b/lib/Business/OnlinePayment/WesternACH.pm index e18a122..94ba800 100644 --- a/lib/Business/OnlinePayment/WesternACH.pm +++ b/lib/Business/OnlinePayment/WesternACH.pm @@ -22,6 +22,20 @@ my $defaults = { schedule => 'live', }; +my $required = { map { $_ => 1 } ( qw( + login + password + command + amount + tender_type + _full_name + routing_code + check_number + _check_type +))}; + + + # Structure of the XML request document # Right sides of the hash entries are Business::OnlinePayment # field names. Those that start with _ are local method names. @@ -144,7 +158,11 @@ sub build { elsif(exists($defaults->{$val})) { $data->{$k} = $defaults->{$val}; } - # 6. Fail. + # 6. If the value is not required, use an empty string. + elsif(! $required->{$val}) { + $data->{$k} = ''; + } + # 7. Fail. else { croak "Missing request field: '$val'"; }