1 package FS::prepay_credit;
5 #use FS::Record qw( qsearch qsearchs );
12 FS::prepay_credit - Object methods for prepay_credit records
16 use FS::prepay_credit;
18 $record = new FS::prepay_credit \%hash;
19 $record = new FS::prepay_credit {
20 'identifier' => '4198123455512121'
24 $record = new FS::prepay_credit {
25 'identifier' => '4198123455512121'
30 $error = $record->insert;
32 $error = $new_record->replace($old_record);
34 $error = $record->delete;
36 $error = $record->check;
40 An FS::table_name object represents an pre--paid credit, such as a pre-paid
41 "calling card". FS::prepay_credit inherits from FS::Record. The following
42 fields are currently supported:
46 =item field - description
48 =item identifier - identifier entered by the user to receive the credit
50 =item amount - amount of the credit
52 =item seconds - time amount of credit (see L<FS::svc_acct/seconds>)
62 Creates a new pre-paid credit. To add the example to the database, see
65 Note that this stores the hash reference, not a distinct copy of the hash it
66 points to. You can ask the object for a copy with the I<hash> method.
70 sub table { 'prepay_credit'; }
74 Adds this record to the database. If there is an error, returns the error,
75 otherwise returns false.
81 Delete this record from the database.
85 =item replace OLD_RECORD
87 Replaces the OLD_RECORD with this one in the database. If there is an error,
88 returns the error, otherwise returns false.
94 Checks all fields to make sure this is a valid pre-paid credit. If there is
95 an error, returns the error, otherwise returns false. Called by the insert
103 my $identifier = $self->identifier;
104 $identifier =~ s/\W//g; #anything else would just confuse things
105 $self->identifier($identifier);
107 $self->ut_numbern('prepaynum')
108 || $self->ut_alpha('identifier')
109 || $self->ut_money('amount')
110 || $self->utnumbern('seconds')
111 || $self->SUPER::check
122 L<FS::svc_acct>, L<FS::Record>, schema.html from the base documentation.