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',
58 'FirstDataGlobalGateway',
96 'Business::OnlineThirdPartyPayment' => [
97 #'eWayShared', support currently broken
102 'Business::BatchPayment' => [
110 'Normal Authorization',
111 'Authorization Only',
112 'Authorization Only,Post Authorization',
116 field => 'gateway_namespace',
119 Business::OnlinePayment
120 Business::BatchPayment
121 Business::OnlineThirdPartyPayment
124 'Business::OnlinePayment' => 'Direct',
125 'Business::BatchPayment' => 'Batch',
126 'Business::OnlineThirdPartyPayment' => 'Hosted',
128 onchange => 'changeNamespace',
131 field => 'gateway_module',
133 # does it even make sense to list all modules here?
134 options => [ sort { lc($a) cmp lc ($b) }
135 map { @$_ } values %modules ],
140 field => 'gateway_action',
142 options => \@actions,
145 field => 'gateway_callback_url',
150 field => 'gateway_cancel_url',
155 field => 'gateway_options',
159 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
160 join("\r", $object->options );
165 my $field_callback = sub {
166 my ($cgi, $object, $field_hashref ) = @_;
167 if ($object->gatewaynum) {
168 if ( $field_hashref->{field} eq 'gateway_module' ) {
169 $field_hashref->{type} = 'fixed';
170 } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) {
171 $field_hashref->{type} = 'fixed';
172 $field_hashref->{formatted_value} = $object->namespace_description;