4 use FS::UID qw(adminsuidsetup);
5 use FS::Record qw(qsearch);
10 $user = shift or die "usage: payment-faker $user";
11 adminsuidsetup($user);
13 for $month ( 1 .. 11 ) {
15 print "month $month\n";
17 system(qq!freeside-daily -d "$month/1/2006" $user!);
19 foreach my $cust_main ( qsearch('cust_main', {} ) ) {
20 next unless $cust_main->balance > 0;
23 $item = new FS::cust_credit {
24 'amount' => $cust_main->balance,
25 '_date' => str2time("$month/1/2006"),
26 'reason' => 'testing',
32 $payinfo = int(rand(10000));
35 $payinfo = '4111111111111111';
38 $item = new FS::cust_pay {
39 'paid' => $cust_main->balance,
40 '_date' => str2time("$month/1/2006"),
42 'payinfo' => $payinfo,
46 $item->custnum($cust_main->custnum);
47 my $error = $item->insert;
49 $cust_main->apply_payments;
50 $cust_main->apply_credits;