diff options
Diffstat (limited to 'VirtualNet.pm')
-rw-r--r-- | VirtualNet.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/VirtualNet.pm b/VirtualNet.pm index 016a525..3344f45 100644 --- a/VirtualNet.pm +++ b/VirtualNet.pm @@ -16,7 +16,7 @@ require Exporter; @ISA = qw(Exporter AutoLoader Business::OnlinePayment); @EXPORT = qw(); @EXPORT_OK = qw(); -$VERSION = '0.01'; +$VERSION = '0.02'; $DEBUG ||= 0; @@ -339,12 +339,17 @@ sub eis1080_response { my( $self, $response) = @_; my %response; - $response =~ /^$STX(.{67})([\w ]{0,15})$FS([\w ]{0,4})$FS.*$ETX(.)$/ + #$response =~ /^$STX(.{67})([\w ]{0,15})$FS([\w ]{0,4})$FS.*$ETX(.)$/ + $response =~ /^$STX(.{67})([\w ]{0,15})$FS([\w ]{0,4})$FS(\d{3})$ETX(.)$/ or die "can't decode (eis1080) response: $response\n". join(' ', map { sprintf("%x", unpack('C',$_)) } split('', $response) ); ( $response{transaction_identifier}, $response{validation_code}, + my $group3version, my $lrc - ) = ($2, $3, $4); + ) = ($2, $3, $4, $5); + + die "group iii version $group3version ne 014" + unless $group3version eq '014'; warn "$response\n". join(' ', map { sprintf("%x", unpack('C',$_)) } split('', $response) ). @@ -548,7 +553,11 @@ sub eis1081_request { $detail .= $param->{AVS_result_code}; # 62-76 15 A/N Transaction Identifier Left-Justified/Space-Filled 4.206 - $detail .= substr($param->{transaction_identifier}. (' 'x15), 0, 15); + my $transaction_identifier = + length($param->{transaction_identifier}) + ? substr($param->{transaction_identifier}. (' 'x15), 0, 15) + : '000000000000000'; + $detail .= $transaction_identifier; # 77-80 4 A/N Validation Code 4.218 $detail .= substr($param->{validation_code}.' ', 0, 4); |