@ISA = qw(Business::OnlinePayment::HTTPS);
$DEBUG = 0;
-$VERSION = '0.04';
+$VERSION = '0.06';
# mapping out all possible endpoints
# but this version will only be building out "charge", "void", & "credit"
$self->result_code($response->{Status}); # 0 /1
$self->response_code($response->{ResponseCode}); # see documentation for translation
$self->avs_code($response->{AvsResponse}); # Y / N
- $self->cvv2_response($response->{CvvResponse}); # P / F
+
+ #weird (missing?) gateway responses turn into a hashref screwing up Card Fortress
+ $self->cvv2_response( $response->{CvvResponse} =~ /^\w$/
+ ? $response->{CvvResponse}
+ : ''
+ );
+
$self->txn_date($response->{TransactionDate}); # MMDDhhmmss
$self->txn_amount($response->{TransactionAmount} / 100); # 00000003500 / 100
$self->reference_number($response->{ReferenceNumber});
$self->is_success($self->result_code() eq '0' ? 1 : 0);
if ($self->is_success()) {
$self->authorization($response->{ReferenceNumber});
- }
- # fill in error_message if there is is an error
- if ( !$self->is_success && exists($response->{AdditionalResponseData})) {
- $self->error_message('Error '.$response->{ResponseCode}.': '.$response->{AdditionalResponseData});
- }elsif ( !$self->is_success && exists($response->{Receipt}) ) {
- $self->error_message('Error '.$response->{ResponseCode}.': '.(exists($response->{Receipt})) ? $response->{Receipt} : '');
+ } else { # fill in error_message if there is is an error
+ $self->error_message( 'Error '.$response->{ResponseCode}.': '.
+ ( $response->{AdditionalResponseData}
+ || $response->{Receipt}
+ || $response->{ResultCode}
+ )
+ );
}
} else {
- die 'Error communicating with vSecureProcessing server';
- return;
+ die 'Error communicating with vSecureProcessing server (server sent response: '. $self->server_response. ')';
}
}