X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-IPPay.git;a=blobdiff_plain;f=IPPay.pm;fp=IPPay.pm;h=496048364f5458e31f53a3faf02f0462e625a6fc;hp=5d976553f5070f29549710e940cfe37835aece7c;hb=a5b53c10d1014b408075e2fe1cc31ea4042ecafc;hpb=1f19e67636476c7119cfb41920c5b176e617c697 diff --git a/IPPay.pm b/IPPay.pm index 5d97655..4960483 100644 --- a/IPPay.pm +++ b/IPPay.pm @@ -11,7 +11,7 @@ use Business::OnlinePayment::HTTPS; use vars qw($VERSION $DEBUG @ISA $me); @ISA = qw(Business::OnlinePayment::HTTPS); -$VERSION = '0.07'; +$VERSION = '0.08'; $VERSION = eval $VERSION; # modperlstyle: convert the string into a number $DEBUG = 0; @@ -107,9 +107,13 @@ sub map_fields { $content{'TransactionType'} = $check_actions{$action} || $action; # ACCOUNT TYPE MAP - my %account_types = ('personal checking' => 'Checking', - 'personal savings' => 'Savings', - 'business checking' => 'BusinessCk', + my %account_types = ('personal checking' => 'CHECKING', + 'personal savings' => 'SAVINGS', + 'business checking' => 'CHECKING', + 'business savings' => 'SAVINGS', + #not technically B:OP valid i guess? + 'checking' => 'CHECKING', + 'savings' => 'SAVINGS', ); $content{'account_type'} = $account_types{lc($content{'account_type'})} || $content{'account_type'}; @@ -281,6 +285,8 @@ sub submit { tie my %ach, 'Tie::IxHash', $self->revmap_fields( + #wtf, this is a "Type"" attribute of the ACH element, + # not a child element like the others #AccountType => 'account_type', AccountNumber => 'account_number', ABA => 'routing_code', @@ -433,7 +439,16 @@ sub _error_response { sub _xmlwrite { my ($self, $writer, $item, $value) = @_; - $writer->startTag($item); + + my %att = (); + if ( $item eq 'ACH' ) { + $att{'Type'} = $self->{_content}->{'account_type'} + if $self->{_content}->{'account_type'}; #necessary so we don't pass empty? + $att{'SEC'} = 'PPD'; + } + + $writer->startTag($item, %att); + if ( ref( $value ) eq 'HASH' ) { foreach ( keys ( %$value ) ) { $self->_xmlwrite($writer, $_, $value->{$_}); @@ -441,6 +456,7 @@ sub _xmlwrite { }else{ $writer->characters($value); } + $writer->endTag($item); }