enable CardFortress in test database, #71513
[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_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',
17                                 },
18           )
19 %>
20
21
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);
32     }
33   }
34   window.onload = changeNamespace;
35 </SCRIPT>
36
37 <%init>
38
39 die "access denied"
40   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
41
42 my $json = Cpanel::JSON::XS->new;
43 $json->canonical(1);
44 my %modules = (
45   'Business::OnlinePayment' => [
46     '2CheckOut',
47     'AuthorizeNet',
48     'BankOfAmerica', #deprecated?
49     'Beanstream',
50     'Braintree',
51     'Capstone',
52     'CardFortress',
53     'Cardstream',
54     'CashCow',
55     'CyberSource',
56     'eSec',
57     'eSelectPlus',
58     'ElavonVirtualMerchant',
59     'eWay',
60     'Exact',
61     'FirstDataGlobalGateway',
62     'GlobalPayments',
63     'iAuthorizer',
64     'Ingotz',
65     'InternetSecure',
66     #'IPaymentTPG',
67     'IPPay',
68     'Iridium',
69     'Jettis',
70     'Jety',
71     'LinkPoint',
72     'Litle',
73     'MerchantCommerce',
74     'Network1Financial',
75     'NMI',
76     'OCV',
77     'Ogone',
78     'OpenECHO',
79     'PaperlessTrans',
80     'PayConnect',
81     'PayflowPro',
82     'PaymenTech',
83     'PaymentsGateway',
84     'PayPal',
85     #'PaySystems',
86     'PlugnPay',
87     'PPIPayMover',
88     'Protx', #now SagePay
89     'PXPost',
90     'SagePay',
91     'SecureHostingUPG',
92     'Skipjack',
93     'StGeorge',
94     'SurePay',
95     'SynapseGateway',
96     'TCLink',
97     'TransactionCentral',
98     'TransFirsteLink',
99     'USAePay',
100     'Vanco',
101     'viaKLIX',
102     'VirtualNet',
103     'vSecureProcessing',
104     'WesternACH',
105     'WorldPay',
106   ],
107   'Business::OnlineThirdPartyPayment' => [
108     #'eWayShared', support currently broken
109     'FCMB',
110     #'Interswitchng', #incomplete?
111     'PayPal',
112   ],
113   'Business::BatchPayment' => [
114     'BillBuddy',
115     'CardFortress',
116     'KeyBank',
117     'Paymentech',
118     'RBC',
119     'TD_EFT',
120   ],
121 );
122
123 my @actions = (
124                 'Normal Authorization',
125                 'Authorization Only',
126                 'Authorization Only,Post Authorization',
127               );
128
129 my $fields = [ {
130                  field               => 'gateway_namespace',
131                  type                => 'select',
132                  options             => [ qw(
133                    Business::OnlinePayment
134                    Business::BatchPayment
135                    Business::OnlineThirdPartyPayment
136                  ) ],
137                  labels       => {
138                    'Business::OnlinePayment' => 'Direct',
139                    'Business::BatchPayment'  => 'Batch',
140                    'Business::OnlineThirdPartyPayment'  => 'Hosted',
141                  },
142                  onchange => 'changeNamespace',
143                },
144                {
145                  field    => 'gateway_module',
146                  type     => 'select',
147                  # does it even make sense to list all modules here?
148                  options  => [ sort { lc($a) cmp lc($b) }
149                                map { @$_ } values %modules ],
150                },
151                'gateway_username',
152                'gateway_password',
153                {
154                  field    => 'gateway_action',
155                  type     => 'select',
156                  options  => \@actions,
157                },
158                {
159                  field    => 'gateway_callback_url',
160                  type     => 'text',
161                  size     => 40,
162                },
163                {
164                  field    => 'gateway_cancel_url',
165                  type     => 'text',
166                  size     => 40,
167                },
168                {
169                  field               => 'gateway_options',
170                  type                => 'textarea',
171                  rows                => '12',
172                  cols                => '40', 
173                  curr_value_callback => sub { my($cgi, $object, $fref) = @_;
174                                               join("\r", $object->options );
175                                             },
176                },
177              ];
178
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;
187     }
188   }
189 };
190
191 </%init>