merge webpay support in with autoselection of old realtime_bop and realtime_refund_bop
[freeside.git] / httemplate / edit / payment_gateway.html
1 <% include( 'elements/edit.html',
2             'table'          => 'payment_gateway',
3             'name_singular'  => 'Payment gateway',
4             'viewall_dir'    => 'browse',
5             'fields'         => $fields,
6             'field_callback' => $field_callback,
7             'labels'         => {
8                                   'gatewaynum'           => 'Gateway #',
9                                   'gateway_module'       => 'Gateway',
10                                   'gateway_username'     => 'Username',
11                                   'gateway_password'     => 'Password',
12                                   'gateway_action'       => 'Action',
13                                   'gateway_options'      => 'Options: (Name/Value pairs, one element per line)',
14                                   'gateway_callback_url' => 'Callback URL',
15                                 },
16           )
17 %>
18
19
20 <SCRIPT TYPE="text/javascript">
21   var gatewayNamespace = new Array;
22
23 % foreach my $module ( sort { lc($a) cmp lc ($b) } keys %modules ) {
24     gatewayNamespace.push('<% $modules{$module} %>')
25 % } 
26
27   // document.getElementById('gateway_namespace').value = gatewayNamespace[0];
28   function setNamespace(what) {
29     document.getElementById('gateway_namespace').value =
30       gatewayNamespace[what.selectedIndex];
31   }
32
33 </SCRIPT>
34
35 <%init>
36
37 die "access denied"
38   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
39
40 my %modules =  (
41   '2CheckOut'          => 'Business::OnlinePayment',
42   'AuthorizeNet'       => 'Business::OnlinePayment',
43   'BankOfAmerica'      => 'Business::OnlinePayment',
44   'Beanstream'         => 'Business::OnlinePayment',
45   'Capstone'           => 'Business::OnlinePayment',
46   'Cardstream'         => 'Business::OnlinePayment',
47   'CashCow'            => 'Business::OnlinePayment',
48   'CyberSource'        => 'Business::OnlinePayment',
49   'eSec'               => 'Business::OnlinePayment',
50   'eSelectPlus'        => 'Business::OnlinePayment',
51   'Exact'              => 'Business::OnlinePayment',
52   'iAuthorizer'        => 'Business::OnlinePayment',
53   'Interswitchng'      => 'Business::OnlineThirdPartyPayment',
54   'IPaymentTPG'        => 'Business::OnlinePayment',
55   'Jettis'             => 'Business::OnlinePayment',
56   'LinkPoint'          => 'Business::OnlinePayment',
57   'MerchantCommerce'   => 'Business::OnlinePayment',
58   'Network1Financial'  => 'Business::OnlinePayment',
59   'OCV'                => 'Business::OnlinePayment',
60   'OpenECHO'           => 'Business::OnlinePayment',
61   'PayConnect'         => 'Business::OnlinePayment',
62   'PayflowPro'         => 'Business::OnlinePayment',
63   'PaymentsGateway'    => 'Business::OnlinePayment',
64   'PXPost'             => 'Business::OnlinePayment',
65   'SecureHostingUPG'   => 'Business::OnlinePayment',
66   'Skipjack'           => 'Business::OnlinePayment',
67   'StGeorge'           => 'Business::OnlinePayment',
68   'SurePay'            => 'Business::OnlinePayment',
69   'TCLink'             => 'Business::OnlinePayment',
70   'TransactionCentral' => 'Business::OnlinePayment',
71   'TransFirsteLink'    => 'Business::OnlinePayment',
72   'VirtualNet'         => 'Business::OnlinePayment',
73 ); 
74
75 my @actions = (
76                 'Normal Authorization',
77                 'Authorization Only',
78                 'Authorization Only, Post Authorization',
79               );
80
81 my $fields = [
82                {
83                  field               => 'gateway_namespace',
84                  type                => 'hidden',
85                  curr_value_callback => sub { my($cgi, $object, $fref) = @_;
86                                               $modules{$object->gateway_module}
87                                               || 'Business::OnlinePayment'
88                                             },
89                },
90                {
91                  field    => 'gateway_module',
92                  type     => 'select',
93                  options  => [ sort { lc($a) cmp lc ($b) } keys %modules ],
94                  onchange => 'setNamespace',
95                },
96                'gateway_username',
97                'gateway_password',
98                {
99                  field    => 'gateway_action',
100                  type     => 'select',
101                  options  => \@actions,
102                },
103                'gateway_callback_url',
104                {
105                  field               => 'gateway_options',
106                  type                => 'textarea',
107                  curr_value_callback => sub { my($cgi, $object, $fref) = @_;
108                                               join("\r", $object->options );
109                                             },
110                },
111              ];
112
113 my $field_callback = sub {
114   my ($cgi, $object, $field_hashref ) = @_;
115   if ($object->gatewaynum) {
116     if ( $field_hashref->{field} eq 'gateway_module' ) {
117       $field_hashref->{type} = 'fixed';
118     }
119   }
120 };
121
122 </%init>