Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / edit / payment_gateway.html
index 37618d6..f9b8f24 100644 (file)
@@ -22,6 +22,9 @@
 <SCRIPT TYPE="text/javascript">
   var modulesForNamespace = <% $json->encode(\%modules) %>;
   function changeNamespace() {
+    if (document.getElementById('gatewaynum').value) {
+      return true;
+    }
     var ns = document.getElementById('gateway_namespace').value;
     var select_module = document.getElementById('gateway_module');
     select_module.options.length = 0;
@@ -39,7 +42,7 @@
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
-my $json = JSON::XS->new;
+my $json = Cpanel::JSON::XS->new;
 $json->canonical(1);
 my %modules = (
   'Business::OnlinePayment' => [
@@ -47,27 +50,36 @@ my %modules = (
     'AuthorizeNet',
     'BankOfAmerica', #deprecated?
     'Beanstream',
+    'Braintree',
     'Capstone',
+    'CardFortress',
     'Cardstream',
     'CashCow',
     'CyberSource',
     'eSec',
     'eSelectPlus',
     'ElavonVirtualMerchant',
+    'eWay',
     'Exact',
+    'FirstDataGlobalGateway',
+    'GlobalPayments',
     'iAuthorizer',
     'Ingotz',
     'InternetSecure',
-    'IPaymentTPG',
+    #'IPaymentTPG',
     'IPPay',
     'Iridium',
     'Jettis',
     'Jety',
     'LinkPoint',
+    'Litle',
     'MerchantCommerce',
     'Network1Financial',
+    'NMI',
     'OCV',
+    'Ogone',
     'OpenECHO',
+    'PaperlessTrans',
     'PayConnect',
     'PayflowPro',
     'PaymenTech',
@@ -83,24 +95,30 @@ my %modules = (
     'Skipjack',
     'StGeorge',
     'SurePay',
+    'SynapseGateway',
     'TCLink',
     'TransactionCentral',
     'TransFirsteLink',
+    'USAePay',
     'Vanco',
     'viaKLIX',
     'VirtualNet',
+    'vSecureProcessing',
     'WesternACH',
     'WorldPay',
   ],
   'Business::OnlineThirdPartyPayment' => [
     #'eWayShared', support currently broken
-    #'Interswitchng',
-    'PayPal',
     'FCMB',
+    #'Interswitchng', #incomplete?
+    'PayPal',
   ],
   'Business::BatchPayment' => [
+    'BillBuddy',
+    'CardFortress',
     'KeyBank',
     'Paymentech',
+    'RBC',
     'TD_EFT',
   ],
 );
@@ -111,8 +129,7 @@ my @actions = (
                 'Authorization Only,Post Authorization',
               );
 
-my $fields = [
-               {
+my $fields = [ {
                  field               => 'gateway_namespace',
                  type                => 'select',
                  options             => [ qw(
@@ -131,7 +148,7 @@ my $fields = [
                  field    => 'gateway_module',
                  type     => 'select',
                  # does it even make sense to list all modules here?
-                 options  => [ sort { lc($a) cmp lc ($b) }
+                 options  => [ sort { lc($a) cmp lc($b) }
                                map { @$_ } values %modules ],
                },
                'gateway_username',
@@ -165,8 +182,17 @@ my $fields = [
 my $field_callback = sub {
   my ($cgi, $object, $field_hashref ) = @_;
   if ($object->gatewaynum) {
-    if ( $field_hashref->{field} =~ /gateway_(module|namespace)/ ) {
+    if ( $field_hashref->{field} eq 'gateway_module' ) {
+      if ($object->gateway_namespace eq 'Business::OnlinePayment' &&
+          $object->gateway_module ne 'CardFortress'
+      ) {
+        $field_hashref->{options} = [ $object->gateway_module, 'CardFortress' ]
+      } else {
+        $field_hashref->{type} = 'fixed';
+      }
+    } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) {
       $field_hashref->{type} = 'fixed';
+      $field_hashref->{formatted_value} = $object->namespace_description;
     }
   }
 };