1 package FS::payment_gateway;
5 use FS::Record qw( qsearch qsearchs );
8 @ISA = qw( FS::option_Common );
12 FS::payment_gateway - Object methods for payment_gateway records
16 use FS::payment_gateway;
18 $record = new FS::payment_gateway \%hash;
19 $record = new FS::payment_gateway { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::payment_gateway object represents an payment gateway.
32 FS::payment_gateway inherits from FS::Record. The following fields are
37 =item gatewaynum - primary key
39 =item gateway_module - Business::OnlinePayment:: module name
41 =item gateway_username - payment gateway username
43 =item gateway_password - payment gateway password
45 =item gateway_action - optional action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Defaults to `Normal Authorization'.
47 =item disabled - Disabled flag, empty or 'Y'
57 Creates a new payment gateway. To add the payment gateway to the database, see
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to. You can ask the object for a copy with the I<hash> method.
65 # the new method can be inherited from FS::Record, if a table method is defined
67 sub table { 'payment_gateway'; }
71 Adds this record to the database. If there is an error, returns the error,
72 otherwise returns false.
76 # the insert method can be inherited from FS::Record
80 Delete this record from the database.
84 # the delete method can be inherited from FS::Record
86 =item replace OLD_RECORD
88 Replaces the OLD_RECORD with this one in the database. If there is an error,
89 returns the error, otherwise returns false.
93 # the replace method can be inherited from FS::Record
97 Checks all fields to make sure this is a valid payment gateway. If there is
98 an error, returns the error, otherwise returns false. Called by the insert
103 # the check method should currently be supplied - FS::Record contains some
104 # data checking routines
110 $self->ut_numbern('gatewaynum')
111 || $self->ut_alpha('gateway_module')
112 || $self->ut_textn('gateway_username')
113 || $self->ut_anything('gateway_password')
114 || $self->ut_enum('disabled', [ '', 'Y' ] )
115 #|| $self->ut_textn('gateway_action')
117 return $error if $error;
119 if ( $self->gateway_action ) {
120 my @actions = split(/,\s*/, $self->gateway_action);
121 $self->gateway_action(
122 join( ',', map { /^(Normal Authorization|Authorization Only|Credit|Post Authorization)$/
123 or return "Unknown action $_";
130 $self->gateway_action('Normal Authorization');
142 L<FS::Record>, schema.html from the base documentation.