RT# 81961 Repair broken links in POD documentation
[freeside.git] / FS / FS / cust_pay_batch.pm
index 774ea29..3cc8a7c 100644 (file)
@@ -236,7 +236,7 @@ sub expmmyy {
 
 =item pay_batch
 
-Returns the payment batch this payment belongs to (L<FS::pay_batch).
+Returns the payment batch this payment belongs to (L<FS::pay_batch>).
 
 =cut
 
@@ -332,6 +332,7 @@ sub approve {
       'custnum'   => $new->custnum,
       'payby'     => $new->payby,
       'payinfo'   => $new->payinfo || $old->payinfo,
+      'paymask'   => $new->mask_payinfo,
       'paid'      => $new->paid,
       '_date'     => $new->_date,
       'usernum'   => $new->usernum,
@@ -458,6 +459,17 @@ sub request_item {
     die "unsupported BatchPayment method: ".$pay_batch->payby;
   }
 
+  my $recurring;
+  if ( $cust_main->status =~ /^active|suspended|ordered$/ ) {
+    if ( $self->payinfo_used ) {
+      $recurring = 'S'; # subsequent
+    } else {
+      $recurring = 'F'; # first use
+    }
+  } else {
+    $recurring = 'N'; # non-recurring
+  }
+
   Business::BatchPayment->create(Item =>
     # required
     action      => 'payment',
@@ -473,6 +485,7 @@ sub request_item {
     ( map { $_ => $location->$_ } qw(address2 city state country zip) ),
     
     invoice_number  => $self->invnum,
+    recurring_billing => $recurring,
     %payment,
   );
 }
@@ -496,8 +509,8 @@ sub process_unbatch_and_delete {
 =item unbatch_and_delete
 
 May only be called on a record with an empty status and an associated
-L<pay_batch> with a status of 'O' (not yet in transit.)  Deletes all associated
-records from L<cust_bill_pay_batch> and then deletes this record.
+L<FS::pay_batch> with a status of 'O' (not yet in transit.)  Deletes all associated
+records from L<FS::cust_bill_pay_batch> and then deletes this record.
 If there is an error, returns the error, otherwise returns false.
 
 =cut