Business::OnlinePaymet fix for processors w/o order numbers, like VirtualNet
[freeside.git] / FS / FS / cust_bill.pm
index a10a6c4..d49657e 100644 (file)
@@ -490,6 +490,7 @@ sub send_csv {
     $self->invnum,
     $self->custnum,
     time2str("%x", $self->_date),
+    sprintf("%.2f", $self->charged),
     ( map { $cust_main->getfield($_) }
         qw( first last company address1 address2 city state zip country ) ),
     map { '' } (1..5),
@@ -673,14 +674,17 @@ sub realtime_card {
 
   if ( $transaction->is_success() && $action2 ) {
     my $auth = $transaction->authorization;
-    my $ordernum = $transaction->order_number;
+    my $ordernum = $transaction->can('order_number')
+                   ? $transaction->order_number
+                   : '';
 
     #warn "********* $auth ***********\n";
     #warn "********* $ordernum ***********\n";
     my $capture =
       new Business::OnlinePayment( $bop_processor, @bop_options );
 
-    $capture->content(
+    my %capture = (
+      type           => 'CC',
       action         => $action2,
       login          => $bop_login,
       password       => $bop_password,
@@ -688,8 +692,18 @@ sub realtime_card {
       amount         => $amount,
       authorization  => $auth,
       description    => $description,
+      card_number    => $cust_main->payinfo,
+      expiration     => $exp,
     );
 
+    foreach my $field (qw( authorization_source_code returned_ACI                                          transaction_identifier validation_code           
+                           transaction_sequence_num local_transaction_date    
+                           local_transaction_time AVS_result_code          )) {
+      $capture{$field} = $transaction->$field() if $transaction->can($field);
+    }
+
+    $capture->content( %capture );
+
     $capture->submit();
 
     unless ( $capture->is_success ) {
@@ -1100,7 +1114,7 @@ sub print_text {
 
 =head1 VERSION
 
-$Id: cust_bill.pm,v 1.39 2002-08-30 23:42:47 ivan Exp $
+$Id: cust_bill.pm,v 1.42 2002-09-10 03:31:00 ivan Exp $
 
 =head1 BUGS