blob: cb4ba7fc6e8f27e908094ecb302bee30123a8dcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/perl -w
use strict;
use FS::UID qw(adminsuidsetup);
use FS::prepay_credit;
require 5.004; #srand(time|$$);
my $user = shift or die &usage;
&adminsuidsetup( $user );
my $amount = shift or die &usage;
my $seconds = shift or die &usage;
my $num_digits = shift or die &usage;
my $num_entries = shift or die &usage;
for ( 1 .. $num_entries ) {
my $identifier = join( '', map int(rand(10)), ( 1 .. $num_digits ) );
my $prepay_credit = new FS::prepay_credit {
'identifier' => $identifier,
'amount' => $amount,
'seconds' => $seconds,
};
my $error = $prepay_credit->insert;
die $error if $error;
print "$identifier\n";
}
sub usage {
die "Usage:\n\n generate-prepay user amount seconds num_digits num_entries";
}
|