'fields' => $fields,
'field_callback' => $field_callback,
'labels' => {
- 'gatewaynum' => 'Gateway #',
+ '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_options' => 'Options (Name/Value pairs, <BR>one element per line)',
'gateway_callback_url' => 'Callback URL',
+ 'gateway_cancel_url' => 'Cancel 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];
+ var modulesForNamespace = <% $json->encode(\%modules) %>;
+ function changeNamespace() {
+ var ns = document.getElementById('gateway_namespace').value;
+ var select_module = document.getElementById('gateway_module');
+ select_module.options.length = 0;
+ for (var x in modulesForNamespace[ns]) {
+ var o = document.createElement('option');
+ o.value = o.text = modulesForNamespace[ns][x];
+ select_module.add(o, null);
+ }
}
-
+ window.onload = changeNamespace;
</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 $json = JSON::XS->new;
+$json->canonical(1);
+my %modules = (
+ 'Business::OnlinePayment' => [
+ '2CheckOut',
+ 'AuthorizeNet',
+ 'BankOfAmerica', #deprecated?
+ 'Beanstream',
+ 'Capstone',
+ 'Cardstream',
+ 'CashCow',
+ 'CyberSource',
+ 'eSec',
+ 'eSelectPlus',
+ 'ElavonVirtualMerchant',
+ 'Exact',
+ 'FirstDataGlobalGateway',
+ 'iAuthorizer',
+ 'Ingotz',
+ 'InternetSecure',
+ 'IPaymentTPG',
+ 'IPPay',
+ 'Iridium',
+ 'Jettis',
+ 'Jety',
+ 'LinkPoint',
+ 'MerchantCommerce',
+ 'Network1Financial',
+ 'OCV',
+ 'OpenECHO',
+ 'PayConnect',
+ 'PayflowPro',
+ 'PaymenTech',
+ 'PaymentsGateway',
+ 'PayPal',
+ #'PaySystems',
+ 'PlugnPay',
+ 'PPIPayMover',
+ 'Protx', #now SagePay
+ 'PXPost',
+ 'SagePay',
+ 'SecureHostingUPG',
+ 'Skipjack',
+ 'StGeorge',
+ 'SurePay',
+ 'TCLink',
+ 'TransactionCentral',
+ 'TransFirsteLink',
+ 'Vanco',
+ 'viaKLIX',
+ 'VirtualNet',
+ 'WesternACH',
+ 'WorldPay',
+ ],
+ 'Business::OnlineThirdPartyPayment' => [
+ #'eWayShared', support currently broken
+ #'Interswitchng',
+ 'PayPal',
+ 'FCMB',
+ ],
+ 'Business::BatchPayment' => [
+ 'KeyBank',
+ 'Paymentech',
+ 'TD_EFT',
+ ],
+);
my @actions = (
'Normal Authorization',
'Authorization Only',
- 'Authorization Only, Post Authorization',
+ 'Authorization Only,Post Authorization',
);
-my $fields = [
- {
+my $fields = [ {
field => 'gateway_namespace',
- type => 'hidden',
- curr_value_callback => sub { my($cgi, $object, $fref) = @_;
- $modules{$object->gateway_module}
- || 'Business::OnlinePayment'
- },
+ 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',
- options => [ sort { lc($a) cmp lc ($b) } keys %modules ],
- onchange => 'setNamespace',
+ # does it even make sense to list all modules here?
+ options => [ sort { lc($a) cmp lc ($b) }
+ map { @$_ } values %modules ],
},
'gateway_username',
'gateway_password',
type => 'select',
options => \@actions,
},
- 'gateway_callback_url',
+ {
+ 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 );
},
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;
}
}
};