summaryrefslogtreecommitdiff
path: root/httemplate/edit/payment_gateway.html
blob: 4c7bae1726130d92e49bec291475ad10d9f33ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<% include( 'elements/edit.html',
            'table'          => 'payment_gateway',
            'name_singular'  => 'Payment gateway',
            'viewall_dir'    => 'browse',
            'fields'         => $fields,
            'field_callback' => $field_callback,
            'labels'         => {
                                  'gatewaynum'           => 'Gateway #',
                                  'gateway_module'       => 'Gateway',
                                  'gateway_username'     => 'Username',
                                  'gateway_password'     => 'Password',
                                  'gateway_action'       => 'Action',
                                  'gateway_options'      => 'Options: (Name/Value pairs, one element per line)',
                                  'gateway_callback_url' => 'Callback URL',
                                },
          )
%>


<SCRIPT TYPE="text/javascript">
  var gatewayNamespace = new Array;

% foreach my $module ( sort { lc($a) cmp lc ($b) } keys %modules ) {
    gatewayNamespace.push('<% $modules{$module} %>')
% } 

  // document.getElementById('gateway_namespace').value = gatewayNamespace[0];
  function setNamespace(what) {
    document.getElementById('gateway_namespace').value =
      gatewayNamespace[what.selectedIndex];
  }

</SCRIPT>

<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my %modules =  (
  '2CheckOut'          => 'Business::OnlinePayment',
  'AuthorizeNet'       => 'Business::OnlinePayment',
  'BankOfAmerica'      => 'Business::OnlinePayment', #deprecated?
  'Beanstream'         => 'Business::OnlinePayment',
  'Capstone'           => 'Business::OnlinePayment',
  'Cardstream'         => 'Business::OnlinePayment',
  'CashCow'            => 'Business::OnlinePayment',
  'CyberSource'        => 'Business::OnlinePayment',
  'eSec'               => 'Business::OnlinePayment',
  'eSelectPlus'        => 'Business::OnlinePayment',
  'Exact'              => 'Business::OnlinePayment',
  'iAuthorizer'        => 'Business::OnlinePayment',
  'Ingotz'             => 'Business::OnlinePayment',
  'InternetSecure'     => 'Business::OnlinePayment',
  'Interswitchng'      => 'Business::OnlineThirdPartyPayment',
  'IPaymentTPG'        => 'Business::OnlinePayment',
  'IPPay'              => 'Business::OnlinePayment',
  'Iridium'            => 'Business::OnlinePayment',
  'Jettis'             => 'Business::OnlinePayment',
  'LinkPoint'          => 'Business::OnlinePayment',
  'MerchantCommerce'   => 'Business::OnlinePayment',
  'Network1Financial'  => 'Business::OnlinePayment',
  'OCV'                => 'Business::OnlinePayment',
  'OpenECHO'           => 'Business::OnlinePayment',
  'PayConnect'         => 'Business::OnlinePayment',
  'PayflowPro'         => 'Business::OnlinePayment',
  'PaymenTech'         => 'Business::OnlinePayment',
  'PaymentsGateway'    => 'Business::OnlinePayment',
  'PayPal'             => 'Business::OnlinePayment',
  'PlugnPay '          => 'Business::OnlinePayment',
  'PPIPayMover '       => 'Business::OnlinePayment',
  'Protx '             => 'Business::OnlinePayment',
  'PXPost'             => 'Business::OnlinePayment',
  'SecureHostingUPG'   => 'Business::OnlinePayment',
  'Skipjack'           => 'Business::OnlinePayment',
  'StGeorge'           => 'Business::OnlinePayment',
  'SurePay'            => 'Business::OnlinePayment',
  'TCLink'             => 'Business::OnlinePayment',
  'TransactionCentral' => 'Business::OnlinePayment',
  'TransFirsteLink'    => 'Business::OnlinePayment',
  'Vanco'              => 'Business::OnlinePayment',
  'viaKLIX'            => 'Business::OnlinePayment',
  'VirtualNet'         => 'Business::OnlinePayment',
  'WesternACH'         => 'Business::OnlinePayment',
); 

my @actions = (
                'Normal Authorization',
                'Authorization Only',
                'Authorization Only, Post Authorization',
              );

my $fields = [
               {
                 field               => 'gateway_namespace',
                 type                => 'hidden',
                 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
                                              $modules{$object->gateway_module}
                                              || 'Business::OnlinePayment'
                                            },
               },
               {
                 field    => 'gateway_module',
                 type     => 'select',
                 options  => [ sort { lc($a) cmp lc ($b) } keys %modules ],
                 onchange => 'setNamespace',
               },
               'gateway_username',
               'gateway_password',
               {
                 field    => 'gateway_action',
                 type     => 'select',
                 options  => \@actions,
               },
               'gateway_callback_url',
               {
                 field               => 'gateway_options',
                 type                => 'textarea',
                 curr_value_callback => sub { my($cgi, $object, $fref) = @_;
                                              join("\r", $object->options );
                                            },
               },
             ];

my $field_callback = sub {
  my ($cgi, $object, $field_hashref ) = @_;
  if ($object->gatewaynum) {
    if ( $field_hashref->{field} eq 'gateway_module' ) {
      $field_hashref->{type} = 'fixed';
    }
  }
};

</%init>