summaryrefslogtreecommitdiff
path: root/bin/customer-faker
diff options
context:
space:
mode:
authorivan <ivan>2006-10-08 08:17:06 +0000
committerivan <ivan>2006-10-08 08:17:06 +0000
commit22c70177969f30e2e419b32cb5d475c143f10b12 (patch)
tree575464d297893db89f4452e85d3d5b3a92c89974 /bin/customer-faker
parent1530e25643850b0cd6e59332c79c8760243b5d5e (diff)
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
Diffstat (limited to 'bin/customer-faker')
-rwxr-xr-xbin/customer-faker20
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/customer-faker b/bin/customer-faker
index 86c8f7ce0..5ddc6d4ad 100755
--- a/bin/customer-faker
+++ b/bin/customer-faker
@@ -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 @@ until ( $num-- <= 0 ) {
'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 @@ until ( $num-- <= 0 ) {
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";
}