[freeside-commits] freeside/bin customer-faker,1.1,1.2

Ivan,,, ivan at wavetail.420.am
Sun Oct 8 01:17:08 PDT 2006


Update of /home/cvs/cvsroot/freeside/bin
In directory wavetail:/tmp/cvs-serv332/bin

Modified Files:
	customer-faker 
Log Message:
add menu items for credit card batching, debug last-minute changes to payby.pm, add ACL for re-processing batches, separate CARD and CHEK batches, fixed defaults for batch formats

Index: customer-faker
===================================================================
RCS file: /home/cvs/cvsroot/freeside/bin/customer-faker,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- customer-faker	16 Sep 2006 20:07:46 -0000	1.1
+++ customer-faker	8 Oct 2006 08:17:06 -0000	1.2
@@ -2,12 +2,17 @@
 
 use strict;
 use Data::Faker;
+use Business::CreditCard;
 use FS::UID qw(adminsuidsetup);
 use FS::cust_main;
+use Getopt::Std;
 
 my $agentnum = 1;
 my $refnum = 1;
 
+use vars qw( $opt_p );
+getopts('p:');
+
 my $user = shift or die &usage;
 my $num = shift or die &usage;
 adminsuidsetup($user);
@@ -38,6 +43,18 @@
     'payip'    => $faker->ip_address,
   };
 
+  if ( $opt_p eq 'CARD' || ( !$opt_p && rand() > .33 ) ) {
+    $cust_main->payby('CARD');
+    my $cardnum = '4123'. sprintf('%011u', int(rand(100000000000)) );
+    $cust_main->payinfo( $cardnum. generate_last_digit($cardnum) );
+    $cust_main->paydate( '2009-05-01' );
+  } elsif ( $opt_p eq 'CHEK' || ( !$opt_p && rand() > .66 ) ) {
+    $cust_main->payby('CHEK');
+    my $payinfo = sprintf('%7u@%09u', int(rand(10000000)), int(rand(1000000000)) ); 
+    $cust_main->payinfo($payinfo);
+    $cust_main->payname( 'First International Bank of Testing' );
+  }
+
   # could insert invoicing_list and other stuff too..  hell, could insert
   # packages, services, more
   # but i just wanted 10k customers to test the pager and this was good enough
@@ -50,11 +67,12 @@
 my $end = time;
 
 my $sec = $end-$start;
+$sec=1 if $sec==0;
 my $persec = $onum / $sec;
 print "$onum customers inserted in $sec seconds ($persec customers/sec)\n";
 
 #---
 
 sub usage {
-  die "Usage:\n\n  customer-faker user num_fakes\n";
+  die "Usage:\n\n  customer-faker [ -p payby ] user num_fakes\n";
 }



More information about the freeside-commits mailing list