[freeside-commits] freeside/FS/FS/ClientAPI Signup.pm, 1.64.2.5, 1.64.2.6
Mark Wells
mark at wavetail.420.am
Sat Feb 26 03:02:31 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv19796/ClientAPI
Modified Files:
Tag: FREESIDE_2_1_BRANCH
Signup.pm
Log Message:
unhide non-realtime payment fields in selfservice, RT#11734
Index: Signup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Signup.pm,v
retrieving revision 1.64.2.5
retrieving revision 1.64.2.6
diff -u -w -d -r1.64.2.5 -r1.64.2.6
--- Signup.pm 21 Jan 2011 19:32:03 -0000 1.64.2.5
+++ Signup.pm 26 Feb 2011 11:02:28 -0000 1.64.2.6
@@ -317,30 +317,30 @@
if ( $agentnum ) {
warn "$me setting agent-specific payment flag\n" if $DEBUG > 1;
- my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+ my $agent = qsearchs('agent', { 'agentnum' => $agentnum } )
+ or return { 'error' => "Self-service agent #$agentnum does not exist" };
warn "$me has agent $agent\n" if $DEBUG > 1;
- if ( $agent ) { #else complain loudly?
+ my @paybys = @{ $signup_info->{'payby'} };
$signup_info->{'hide_payment_fields'} = [];
+
my $gatewaynum = $conf->config('selfservice-payment_gateway');
+ my $force_gateway;
if ( $gatewaynum ) {
- my $pg = qsearchs('payment_gateway', { gatewaynum => $gatewaynum });
- die "configured gatewaynum $gatewaynum not found!" if !$pg;
- my $hide = $pg->gateway_namespace eq 'Business::OnlineThirdPartyPayment';
- $signup_info->{'hide_payment_fields'} = [
- map { $hide } @{$signup_info->{'payby'}}
- ];
+ $force_gateway = qsearchs('payment_gateway', { gatewaynum => $gatewaynum });
+ warn "using forced gateway #$gatewaynum - " .
+ $force_gateway->gateway_username . '@' . $force_gateway->gateway_module
+ if $DEBUG > 1;
+ die "configured gatewaynum $gatewaynum not found!" if !$force_gateway;
}
- else {
- foreach my $payby (@{$signup_info->{payby}}) {
+ foreach my $payby (@paybys) {
warn "$me checking $payby payment fields\n" if $DEBUG > 1;
my $hide = 0;
if ( FS::payby->realtime($payby) ) {
- my $payment_gateway =
+ my $gateway = $force_gateway ||
$agent->payment_gateway( 'method' => FS::payby->payby2bop($payby),
'nofatal' => 1,
);
- if ( $payment_gateway
- && $payment_gateway->gateway_namespace
+ if ( $gateway && $gateway->gateway_namespace
eq 'Business::OnlineThirdPartyPayment'
) {
warn "$me hiding $payby payment fields\n" if $DEBUG > 1;
@@ -349,8 +349,6 @@
}
push @{$signup_info->{'hide_payment_fields'}}, $hide;
} # foreach $payby
- }
- }
warn "$me done setting agent-specific payment flag\n" if $DEBUG > 1;
warn "$me setting agent-specific package list\n" if $DEBUG > 1;
More information about the freeside-commits
mailing list