fix auth bug! 0.02!
[Business-OnlinePayment-TransactionCentral.git] / lib / Business / OnlinePayment / TransactionCentral.pm
index 68a193d..a0765fc 100644 (file)
@@ -8,7 +8,7 @@ use Business::OnlinePayment::HTTPS 0.02;
 use vars qw($VERSION @ISA $DEBUG);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.01';
+$VERSION = '0.02';
 $DEBUG = 0;
 
 sub set_defaults {
@@ -18,7 +18,9 @@ sub set_defaults {
     $self->port('443');
     $self->path('/billing/TransactionCentral/');
 
-    $self->build_subs(qw( order_number avs_code cvv2_response ));
+    $self->build_subs(qw( order_number avs_code cvv2_response
+                          response_page response_code response_headers
+                     ));
 }
 
 sub submit {
@@ -59,7 +61,7 @@ sub submit {
       $content{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
         or croak "unparsable expiration ". $content{'expiration'};
       my( $month, $year ) = ( $1, $2 );
-      #$month = '0'. $month if $month =~ /^\d$/;
+      $month = '0'. $month if $month =~ /^\d$/;
       $content{'CCMonth'} = $month;
       $content{'CCYear'} = $year;
 
@@ -107,10 +109,13 @@ sub submit {
     DESCRIPTION DESCDATE TRANSTYPE TRANSROUTE
   );
 
-  #my( $page, $response, %reply_headers ) =
-  my( $page, $response ) =
+  my( $page, $response, %reply_headers ) =
     $self->https_post( $self->get_fields( @fields ) );
 
+  $self->response_code( $response );
+  $self->response_page( $page );
+  $self->response_headers( \%reply_headers );
+
   warn "\n" if $DEBUG > 1;
   if ( $DEBUG > 2 ) {
     warn "response: $response\n";
@@ -127,7 +132,7 @@ sub submit {
   $self->avs_code(      $return{'AVSCode'} );
   $self->cvv2_response( $return{'CVV2ResponseMsg'} );
 
-  if ( $return{'Auth'} =~ /^(\d+)$/ ) {
+  if ( $return{'Auth'} =~ /^(\w+)$/ ) {
 
     $self->is_success(1);
     $self->authorization( $return{'Auth'}   );
@@ -177,7 +182,7 @@ Business::OnlinePayment::TransactionCentral - Transaction Central backend module
   # One step transaction, the simple case.
   ####
 
-  my $tx = new Business::OnlinePayment("Capstone");
+  my $tx = new Business::OnlinePayment("TransactionCentral");
   $tx->content(
       type           => 'CC',
       login          => '10011', #MerchantID