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