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 = JSON::XS->new;
45 'Business::OnlinePayment' => [
48 'BankOfAmerica', #deprecated?
56 'ElavonVirtualMerchant',
95 'Business::OnlineThirdPartyPayment' => [
100 'Business::BatchPayment' => [
108 'Normal Authorization',
109 'Authorization Only',
110 'Authorization Only,Post Authorization',
115 field => 'gateway_namespace',
118 Business::OnlinePayment
119 Business::BatchPayment
120 Business::OnlineThirdPartyPayment
123 'Business::OnlinePayment' => 'Direct',
124 'Business::BatchPayment' => 'Batch',
125 'Business::OnlineThirdPartyPayment' => 'Hosted',
127 onchange => 'changeNamespace',
130 field => 'gateway_module',
132 # does it even make sense to list all modules here?
133 options => [ sort { lc($a) cmp lc ($b) }
134 map { @$_ } values %modules ],
139 field => 'gateway_action',
141 options => \@actions,
144 field => 'gateway_callback_url',
149 field => 'gateway_cancel_url',
154 field => 'gateway_options',
158 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
159 join("\r", $object->options );
164 my $field_callback = sub {
165 my ($cgi, $object, $field_hashref ) = @_;
166 if ($object->gatewaynum) {
167 if ( $field_hashref->{field} =~ /gateway_(module|namespace)/ ) {
168 $field_hashref->{type} = 'fixed';