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 var ns = document.getElementById('gateway_namespace').value;
26 var select_module = document.getElementById('gateway_module');
27 select_module.options.length = 0;
28 for (var x in modulesForNamespace[ns]) {
29 var o = document.createElement('option');
30 o.value = o.text = modulesForNamespace[ns][x];
31 select_module.add(o, null);
34 window.onload = changeNamespace;
40 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
42 my $json = Cpanel::JSON::XS->new;
45 'Business::OnlinePayment' => [
48 'BankOfAmerica', #deprecated?
58 'ElavonVirtualMerchant',
61 'FirstDataGlobalGateway',
107 'Business::OnlineThirdPartyPayment' => [
108 #'eWayShared', support currently broken
110 #'Interswitchng', #incomplete?
113 'Business::BatchPayment' => [
124 'Normal Authorization',
125 'Authorization Only',
126 'Authorization Only,Post Authorization',
130 field => 'gateway_namespace',
133 Business::OnlinePayment
134 Business::BatchPayment
135 Business::OnlineThirdPartyPayment
138 'Business::OnlinePayment' => 'Direct',
139 'Business::BatchPayment' => 'Batch',
140 'Business::OnlineThirdPartyPayment' => 'Hosted',
142 onchange => 'changeNamespace',
145 field => 'gateway_module',
147 # does it even make sense to list all modules here?
148 options => [ sort { lc($a) cmp lc($b) }
149 map { @$_ } values %modules ],
154 field => 'gateway_action',
156 options => \@actions,
159 field => 'gateway_callback_url',
164 field => 'gateway_cancel_url',
169 field => 'gateway_options',
173 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
174 join("\r", $object->options );
179 my $field_callback = sub {
180 my ($cgi, $object, $field_hashref ) = @_;
181 if ($object->gatewaynum) {
182 if ( $field_hashref->{field} eq 'gateway_module' ) {
183 $field_hashref->{type} = 'fixed';
184 } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) {
185 $field_hashref->{type} = 'fixed';
186 $field_hashref->{formatted_value} = $object->namespace_description;