Make sure expiration date has a leading zero
[Business-OnlinePayment-TransactionCentral.git] / lib / Business / OnlinePayment / TransactionCentral.pm
index e16a484..aca83c6 100644 (file)
@@ -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";
@@ -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
@@ -229,7 +234,7 @@ Ivan Kohler <ivan-transactioncentral@420.am>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2005 by Ivan Kohler
+Copyright (C) 2006 by Ivan Kohler
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.