[freeside-commits] freeside/FS/FS cust_pay.pm, 1.42, 1.43 cust_refund.pm, 1.24, 1.25 Conf.pm, 1.142, 1.143 cust_main.pm, 1.198, 1.199 cust_pay_void.pm, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Fri Oct 21 08:21:39 PDT 2005


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv1308/FS/FS

Modified Files:
	cust_pay.pm cust_refund.pm Conf.pm cust_main.pm 
	cust_pay_void.pm 
Log Message:
add CASH and WEST payment types (payments only, not cust_main.payby)


Index: cust_pay_void.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay_void.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_pay_void.pm	6 Jul 2004 13:26:20 -0000	1.1
+++ cust_pay_void.pm	21 Oct 2005 15:21:37 -0000	1.2
@@ -47,7 +47,8 @@
 L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH),
-`LECB' (phone bill billing), `BILL' (billing), or `COMP' (free)
+`LECB' (phone bill billing), `BILL' (billing), `CASH' (cash),
+`WEST' (Western Union) or `COMP' (free)
 
 =item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively
 
@@ -128,7 +129,8 @@
 
   $self->void_date(time) unless $self->void_date;
 
-  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby";
+  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP|CASH|WEST)$/
+    or return "Illegal payby";
   $self->payby($1);
 
   #false laziness with cust_refund::check

Index: cust_refund.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_refund.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cust_refund.pm	6 Jul 2004 14:22:56 -0000	1.24
+++ cust_refund.pm	21 Oct 2005 15:21:37 -0000	1.25
@@ -51,7 +51,8 @@
 L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH),
-`LECB' (Phone bill billing), `BILL' (billing), or `COMP' (free)
+`LECB' (Phone bill billing), `BILL' (billing), `CASH' (cash),
+`WEST' (Western Union), or `COMP' (free)
 
 =item payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
 
@@ -211,7 +212,8 @@
     unless $self->crednum 
            || qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
 
-  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby";
+  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|CASH|WEST)$/
+    or return "Illegal payby";
   $self->payby($1);
 
   #false laziness with cust_pay::check

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- cust_pay.pm	10 Oct 2005 12:20:57 -0000	1.42
+++ cust_pay.pm	21 Oct 2005 15:21:37 -0000	1.43
@@ -61,7 +61,8 @@
 L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH),
-`LECB' (phone bill billing), `BILL' (billing), or `COMP' (free)
+`LECB' (phone bill billing), `BILL' (billing), `PREP` (prepaid card),
+`CASH' (cash), `WEST' (Western Union) or `COMP' (free)
 
 =item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively
 
@@ -373,7 +374,8 @@
 
   $self->_date(time) unless $self->_date;
 
-  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP)$/ or return "Illegal payby";
+  $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP|CASH|WEST)$/
+    or return "Illegal payby";
   $self->payby($1);
 
   #false laziness with cust_refund::check

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- Conf.pm	16 Oct 2005 14:04:00 -0000	1.142
+++ Conf.pm	21 Oct 2005 15:21:37 -0000	1.143
@@ -1294,11 +1294,19 @@
   },
 
   {
+    'key'         => 'payby',
+    'section'     => 'billing',
+    'description' => 'Available payment types.',
+    'type'        => 'selectmultiple',
+    'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP) ],
+  },
+
+  {
     'key'         => 'payby-default',
     'section'     => 'UI',
     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
     'type'        => 'select',
-    'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL COMP HIDE) ],
+    'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP HIDE) ],
   },
 
   {

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- cust_main.pm	7 Oct 2005 04:48:45 -0000	1.198
+++ cust_main.pm	21 Oct 2005 15:21:37 -0000	1.199
@@ -360,6 +360,7 @@
 
   my $prepay_identifier = '';
   my( $amount, $seconds ) = ( 0, 0 );
+  my $payby = '';
   if ( $self->payby eq 'PREPAY' ) {
 
     $self->payby('BILL');
@@ -373,6 +374,14 @@
       return $error;
     }
 
+    $payby = 'PREP' if $amount;
+
+  } elsif ( $self->payby =~ /^(CASH|WEST)$/ ) {
+
+    $payby = $1;
+    $self->payby('BILL');
+    $amount = $self->paid;
+
   }
 
   my $error = $self->SUPER::insert;
@@ -405,13 +414,15 @@
   }
 
   if ( $amount ) {
-    $error = $self->insert_cust_pay_prepay($amount, $prepay_identifier);
+    $error = $self->insert_cust_pay($payby, $amount, $prepay_identifier);
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
-      return "inserting prepayment (transaction rolled back): $error";
+      return "inserting payment (transaction rolled back): $error";
     }
   }
 
+
+
   unless ( $import || $skip_fuzzyfiles ) {
     $error = $self->queue_fuzzyfiles_update;
     if ( $error ) {
@@ -691,14 +702,42 @@
 =cut
 
 sub insert_cust_pay_prepay {
-  my( $self, $amount ) = splice(@_, 0, 2);
+  shift->insert_cust_pay('PREP', @_);
+}
+
+=item insert_cust_pay_cash AMOUNT [ PAYINFO ]
+
+Inserts a cash payment in the specified amount for this customer.  An optional
+second argument can specify the payment identifier for tracking purposes.
+If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+sub insert_cust_pay_cash {
+  shift->insert_cust_pay('CASH', @_);
+}
+
+=item insert_cust_pay_prepay AMOUNT [ PAYINFO ]
+
+Inserts a Western Union payment in the specified amount for this customer.  An
+optional second argument can specify the prepayment identifier for tracking
+purposes.  If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+sub insert_cust_pay_west {
+  shift->insert_cust_pay('WEST', @_);
+}
+
+sub insert_cust_pay {
+  my( $self, $payby, $amount ) = splice(@_, 0, 3);
   my $payinfo = scalar(@_) ? shift : '';
 
   my $cust_pay = new FS::cust_pay {
     'custnum' => $self->custnum,
     'paid'    => sprintf('%.2f', $amount),
     #'_date'   => #date the prepaid card was purchased???
-    'payby'   => 'PREP',
+    'payby'   => $payby,
     'payinfo' => $payinfo,
   };
   $cust_pay->insert;
@@ -1105,7 +1144,7 @@
     }
   }
 
-  $self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY)$/
+  $self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY|CASH|WEST)$/
     or return "Illegal payby: ". $self->payby;
 
   $error =    $self->ut_numbern('paystart_month')
@@ -1242,7 +1281,7 @@
 
   if ( $self->paydate eq '' || $self->paydate eq '-' ) {
     return "Expriation date required"
-      unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/;
+      unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB|CASH|WEST)$/;
     $self->paydate('');
   } else {
     my( $m, $y );



More information about the freeside-commits mailing list