'paytypes' => [ @FS::cust_main::paytypes ],
'paybys' => [ $conf->config('signup_server-payby') ],
+ 'cust_paybys' => [ map { FS::payby->payby2payment($_) }
+ $conf->config('signup_server-payby')
+ ],
'stateid_label' => FS::Msgcat::_gettext('stateid'),
'stateid_state_label' => FS::Msgcat::_gettext('stateid_state'),
my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
or return { 'error' => "unknown custnum $custnum" };
+ $return{hide_payment_fields} =
+ [
+ map { FS::payby->realtime($_) &&
+ $cust_main
+ ->agent
+ ->payment_gateway( 'method' => FS::payby->payby2bop($_) )
+ ->gateway_namespace
+ eq 'Business::OnlineThirdPartyPayment'
+ }
+ @{ $return{cust_paybys} }
+ ];
+
$return{balance} = $cust_main->balance;
$return{payname} = $cust_main->payname
'payinfo' => $payinfo,
'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01',
'payname' => $payname,
- 'paybatch' => $paybatch,
+ 'paybatch' => $paybatch, #this doesn't actually do anything
'paycvv' => $paycvv,
map { $_ => $p->{$_} } @{ $payby2fields{$payby} }
);
}
+sub realtime_collect {
+
+ my $p = shift;
+
+ my $session = _cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or return { 'error' => "unknown custnum $custnum" };
+
+ my $error = $cust_main->realtime_collect( 'method' => $p->{'method'},
+ 'session_id' => $p->{'session_id'},
+ );
+ return { 'error' => $error } unless ref( $error );
+
+ return { 'error' => '', amount => $cust_main->balance, %$error };
+}
+
sub process_payment_order_pkg {
my $p = shift;
my %fields = (
'svc_acct' => [ qw( username domsvc _password sec_phrase popnum ) ],
'svc_domain' => [ qw( domain ) ],
+ 'svc_phone' => [ qw( phonenum pin sip_password ) ],
'svc_external' => [ qw( id title ) ],
);
#return { 'error' => 'No active packages to renew.' } unless @cust_pkg;
- my $total = 0;
+ my $total = $cust_main->balance;
my @array = map {
$total += $_->part_pkg->base_recur;
'bill_date_pretty' => time2str('%x', $_->bill),
'renew_date' => $renew_date,
'renew_date_pretty' => time2str('%x', $renew_date),
- 'amount' => sprintf('.%2f', $total),
+ 'amount' => sprintf('%.2f', $total),
};
}
@cust_pkg;