1 <% include( 'elements/edit.html',
2 'table' => 'payment_gateway',
3 'name_singular' => 'Payment gateway',
4 'viewall_dir' => 'browse',
6 'field_callback' => $field_callback,
8 'gatewaynum' => 'Gateway',
9 'gateway_namespace' => 'Gateway type',
10 'gateway_module' => 'Gateway',
11 'gateway_username' => 'Username',
12 'gateway_password' => 'Password',
13 'gateway_action' => 'Action',
14 'gateway_options' => 'Options (Name/Value pairs, <BR>one element per line)',
15 'gateway_callback_url' => 'Callback URL',
16 'gateway_cancel_url' => 'Cancel URL',
22 <SCRIPT TYPE="text/javascript">
23 var modulesForNamespace = <% $json->encode(\%modules) %>;
24 function changeNamespace() {
25 if (document.getElementById('gatewaynum').value) {
28 var ns = document.getElementById('gateway_namespace').value;
29 var select_module = document.getElementById('gateway_module');
30 select_module.options.length = 0;
31 for (var x in modulesForNamespace[ns]) {
32 var o = document.createElement('option');
33 o.value = o.text = modulesForNamespace[ns][x];
34 select_module.add(o, null);
37 window.onload = changeNamespace;
43 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
45 my $json = Cpanel::JSON::XS->new;
48 'Business::OnlinePayment' => [
51 'BankOfAmerica', #deprecated?
61 'ElavonVirtualMerchant',
64 'FirstDataGlobalGateway',
100 'TransactionCentral',
110 'Business::OnlineThirdPartyPayment' => [
111 #'eWayShared', support currently broken
113 #'Interswitchng', #incomplete?
116 'Business::BatchPayment' => [
127 'Normal Authorization',
128 'Authorization Only',
129 'Authorization Only,Post Authorization',
133 field => 'gateway_namespace',
136 Business::OnlinePayment
137 Business::BatchPayment
138 Business::OnlineThirdPartyPayment
141 'Business::OnlinePayment' => 'Direct',
142 'Business::BatchPayment' => 'Batch',
143 'Business::OnlineThirdPartyPayment' => 'Hosted',
145 onchange => 'changeNamespace',
148 field => 'gateway_module',
150 # does it even make sense to list all modules here?
151 options => [ sort { lc($a) cmp lc($b) }
152 map { @$_ } values %modules ],
157 field => 'gateway_action',
159 options => \@actions,
162 field => 'gateway_callback_url',
167 field => 'gateway_cancel_url',
172 field => 'gateway_options',
176 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
177 join("\r", $object->options );
182 my $field_callback = sub {
183 my ($cgi, $object, $field_hashref ) = @_;
184 if ($object->gatewaynum) {
185 if ( $field_hashref->{field} eq 'gateway_module' ) {
186 if ($object->gateway_namespace eq 'Business::OnlinePayment' &&
187 $object->gateway_module ne 'CardFortress'
189 $field_hashref->{options} = [ $object->gateway_module, 'CardFortress' ]
191 $field_hashref->{type} = 'fixed';
193 } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) {
194 $field_hashref->{type} = 'fixed';
195 $field_hashref->{formatted_value} = $object->namespace_description;