X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpayment_gateway.html;h=b44b3151383dbb7a6ce985ef7890b50e515b0440;hp=1eda112494987228904fd54a4dca169421a90703;hb=b9f68ca7d2a521b037995d1512067ac19cf6db7b;hpb=860e628d3d0d2ba432d401de5c9d4784c918be54 diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index 1eda11249..b44b31513 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -1,128 +1,191 @@ -<% - -my $payment_gateway; -if ( $cgi->param('error') ) { - $payment_gateway = new FS::payment_gateway ( { - map { $_, scalar($cgi->param($_)) } fields('payment_gateway') - } ); -} elsif ( $cgi->keywords ) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $payment_gateway = qsearchs( 'payment_gateway', { 'gatewaynum' => $1 } ); -} else { #adding - $payment_gateway = new FS::payment_gateway {}; -} -my $action = $payment_gateway->gatewaynum ? 'Edit' : 'Add'; -#my $hashref = $payment_gateway->hashref; - +<% include( 'elements/edit.html', + 'table' => 'payment_gateway', + 'name_singular' => 'Payment gateway', + 'viewall_dir' => 'browse', + 'fields' => $fields, + 'field_callback' => $field_callback, + 'labels' => { + 'gatewaynum' => 'Gateway', + 'gateway_namespace' => 'Gateway type', + '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', + 'gateway_cancel_url' => 'Cancel URL', + }, + ) %> -<%= include("/elements/header.html","$action Payment gateway", menubar( - 'Main Menu' => $p, - 'View all payment gateways' => $p. 'browse/payment_gateway.html', -)) %> - -<% if ( $cgi->param('error') ) { %> -Error: <%= $cgi->param('error') %> -<% } %> - -
- -Gateway #<%= $payment_gateway->gatewaynum || "(NEW)" %> - -<%= ntable('#cccccc', 2, '') %> - - - Gateway: - - - <% if ( $payment_gateway->gatewaynum ) { %> - - <%= $payment_gateway->gateway_module %> - - - <% } else { %> - - - - <% } %> - - - - - - Username: - - - - - Password: - - - - - Action: - - - - - - - Options: - - - - - - - -
"> -
- - + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $json = Cpanel::JSON::XS->new; +$json->canonical(1); +my %modules = ( + 'Business::OnlinePayment' => [ + '2CheckOut', + 'AuthorizeNet', + 'BankOfAmerica', #deprecated? + 'Beanstream', + 'Braintree', + 'Capstone', + 'CardFortress', + 'Cardstream', + 'CashCow', + 'CyberSource', + 'eSec', + 'eSelectPlus', + 'ElavonVirtualMerchant', + 'eWay', + 'Exact', + 'FirstDataGlobalGateway', + 'GlobalPayments', + 'iAuthorizer', + 'Ingotz', + 'InternetSecure', + #'IPaymentTPG', + 'IPPay', + 'Iridium', + 'Jettis', + 'Jety', + 'LinkPoint', + 'Litle', + 'MerchantCommerce', + 'Network1Financial', + 'NMI', + 'OCV', + 'Ogone', + 'OpenECHO', + 'PaperlessTrans', + 'PayConnect', + 'PayflowPro', + 'PaymenTech', + 'PaymentsGateway', + 'PayPal', + #'PaySystems', + 'PlugnPay', + 'PPIPayMover', + 'Protx', #now SagePay + 'PXPost', + 'SagePay', + 'SecureHostingUPG', + 'Skipjack', + 'StGeorge', + 'SurePay', + 'SynapseGateway', + 'TCLink', + 'TransactionCentral', + 'TransFirsteLink', + 'USAePay', + 'Vanco', + 'viaKLIX', + 'VirtualNet', + 'vSecureProcessing', + 'WesternACH', + 'WorldPay', + ], + 'Business::OnlineThirdPartyPayment' => [ + #'eWayShared', support currently broken + 'FCMB', + #'Interswitchng', #incomplete? + 'PayPal', + ], + 'Business::BatchPayment' => [ + 'BillBuddy', + 'CardFortress', + 'KeyBank', + 'Paymentech', + 'RBC', + 'TD_EFT', + ], +); + +my @actions = ( + 'Normal Authorization', + 'Authorization Only', + 'Authorization Only,Post Authorization', + ); + +my $fields = [ { + field => 'gateway_namespace', + type => 'select', + options => [ qw( + Business::OnlinePayment + Business::BatchPayment + Business::OnlineThirdPartyPayment + ) ], + labels => { + 'Business::OnlinePayment' => 'Direct', + 'Business::BatchPayment' => 'Batch', + 'Business::OnlineThirdPartyPayment' => 'Hosted', + }, + onchange => 'changeNamespace', + }, + { + field => 'gateway_module', + type => 'select', + # does it even make sense to list all modules here? + options => [ sort { lc($a) cmp lc($b) } + map { @$_ } values %modules ], + }, + 'gateway_username', + 'gateway_password', + { + field => 'gateway_action', + type => 'select', + options => \@actions, + }, + { + field => 'gateway_callback_url', + type => 'text', + size => 40, + }, + { + field => 'gateway_cancel_url', + type => 'text', + size => 40, + }, + { + field => 'gateway_options', + type => 'textarea', + rows => '12', + cols => '40', + 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'; + } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) { + $field_hashref->{type} = 'fixed'; + $field_hashref->{formatted_value} = $object->namespace_description; + } + } +}; + +