summaryrefslogtreecommitdiff
path: root/httemplate/edit/payment_gateway.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-06-30 16:37:06 -0700
committerMark Wells <mark@freeside.biz>2012-06-30 16:37:06 -0700
commit92aedddd3684167abb60cd3f1d77bbc156c592e6 (patch)
treef061fdd9dd2434ad6f490f01d682496b46a925d5 /httemplate/edit/payment_gateway.html
parente5fd495945bc0b907cf0d4d21d52bb6b12e7051a (diff)
Business::BatchPayment interface, #17373
Diffstat (limited to 'httemplate/edit/payment_gateway.html')
-rw-r--r--httemplate/edit/payment_gateway.html56
1 files changed, 36 insertions, 20 deletions
diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html
index cfb86048c..2840df35b 100644
--- a/httemplate/edit/payment_gateway.html
+++ b/httemplate/edit/payment_gateway.html
@@ -6,11 +6,12 @@
'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_options' => 'Options (Name/Value pairs, <BR>one element per line)',
'gateway_callback_url' => 'Callback URL',
},
)
@@ -18,18 +19,18 @@
<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];
+% my $json = JSON->new->canonical;
+ var modulesForNamespace = <% $json->encode(\%modules_for_namespace) %>;
+ function changeNamespace(what) {
+ var ns = what.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);
+ }
}
-
</SCRIPT>
<%init>
@@ -67,6 +68,7 @@ my %modules = (
'OpenECHO' => 'Business::OnlinePayment',
'PayConnect' => 'Business::OnlinePayment',
'PayflowPro' => 'Business::OnlinePayment',
+ 'Paymentech' => 'Business::BatchPayment',
'PaymenTech' => 'Business::OnlinePayment',
'PaymentsGateway' => 'Business::OnlinePayment',
'PayPal' => 'Business::OnlinePayment',
@@ -88,7 +90,13 @@ my %modules = (
'VirtualNet' => 'Business::OnlinePayment',
'WesternACH' => 'Business::OnlinePayment',
'WorldPay' => 'Business::OnlinePayment',
-);
+);
+
+my %modules_for_namespace;
+for (keys %modules) {
+ $modules_for_namespace{$modules{$_}} ||= [];
+ push @{ $modules_for_namespace{$modules{$_}} }, $_;
+}
my @actions = (
'Normal Authorization',
@@ -99,17 +107,23 @@ my @actions = (
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',
},
'gateway_username',
'gateway_password',
@@ -126,6 +140,8 @@ my $fields = [
{
field => 'gateway_options',
type => 'textarea',
+ rows => '8',
+ cols => '40',
curr_value_callback => sub { my($cgi, $object, $fref) = @_;
join("\r", $object->options );
},
@@ -135,7 +151,7 @@ my $fields = [
my $field_callback = sub {
my ($cgi, $object, $field_hashref ) = @_;
if ($object->gatewaynum) {
- if ( $field_hashref->{field} eq 'gateway_module' ) {
+ if ( $field_hashref->{field} =~ /gateway_(module|namespace)/ ) {
$field_hashref->{type} = 'fixed';
}
}