update gateway list in order to add WesternACH, RT#5409
[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', #deprecated?
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   'Ingotz'             => 'Business::OnlinePayment',
54   'InternetSecure'     => 'Business::OnlinePayment',
55   'Interswitchng'      => 'Business::OnlineThirdPartyPayment',
56   'IPaymentTPG'        => 'Business::OnlinePayment',
57   'IPPay'              => 'Business::OnlinePayment',
58   'Iridium'            => 'Business::OnlinePayment',
59   'Jettis'             => 'Business::OnlinePayment',
60   'LinkPoint'          => 'Business::OnlinePayment',
61   'MerchantCommerce'   => 'Business::OnlinePayment',
62   'Network1Financial'  => 'Business::OnlinePayment',
63   'OCV'                => 'Business::OnlinePayment',
64   'OpenECHO'           => 'Business::OnlinePayment',
65   'PayConnect'         => 'Business::OnlinePayment',
66   'PayflowPro'         => 'Business::OnlinePayment',
67   'PaymenTech'         => 'Business::OnlinePayment',
68   'PaymentsGateway'    => 'Business::OnlinePayment',
69   'PayPal'             => 'Business::OnlinePayment',
70   'PlugnPay '          => 'Business::OnlinePayment',
71   'PPIPayMover '       => 'Business::OnlinePayment',
72   'Protx '             => 'Business::OnlinePayment',
73   'PXPost'             => 'Business::OnlinePayment',
74   'SecureHostingUPG'   => 'Business::OnlinePayment',
75   'Skipjack'           => 'Business::OnlinePayment',
76   'StGeorge'           => 'Business::OnlinePayment',
77   'SurePay'            => 'Business::OnlinePayment',
78   'TCLink'             => 'Business::OnlinePayment',
79   'TransactionCentral' => 'Business::OnlinePayment',
80   'TransFirsteLink'    => 'Business::OnlinePayment',
81   'Vanco'              => 'Business::OnlinePayment',
82   'viaKLIX'            => 'Business::OnlinePayment',
83   'VirtualNet'         => 'Business::OnlinePayment',
84   'WesternACH'         => 'Business::OnlinePayment',
85 ); 
86
87 my @actions = (
88                 'Normal Authorization',
89                 'Authorization Only',
90                 'Authorization Only, Post Authorization',
91               );
92
93 my $fields = [
94                {
95                  field               => 'gateway_namespace',
96                  type                => 'hidden',
97                  curr_value_callback => sub { my($cgi, $object, $fref) = @_;
98                                               $modules{$object->gateway_module}
99                                               || 'Business::OnlinePayment'
100                                             },
101                },
102                {
103                  field    => 'gateway_module',
104                  type     => 'select',
105                  options  => [ sort { lc($a) cmp lc ($b) } keys %modules ],
106                  onchange => 'setNamespace',
107                },
108                'gateway_username',
109                'gateway_password',
110                {
111                  field    => 'gateway_action',
112                  type     => 'select',
113                  options  => \@actions,
114                },
115                'gateway_callback_url',
116                {
117                  field               => 'gateway_options',
118                  type                => 'textarea',
119                  curr_value_callback => sub { my($cgi, $object, $fref) = @_;
120                                               join("\r", $object->options );
121                                             },
122                },
123              ];
124
125 my $field_callback = sub {
126   my ($cgi, $object, $field_hashref ) = @_;
127   if ($object->gatewaynum) {
128     if ( $field_hashref->{field} eq 'gateway_module' ) {
129       $field_hashref->{type} = 'fixed';
130     }
131   }
132 };
133
134 </%init>