}
-sub get_mac_address {
- my $p = shift;
-
-## access radius exports acct tables to get mac
- my @part_export = ();
- @part_export = (
- qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
- qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } ),
- qsearch( 'part_export', { 'exporttype' => 'broadband_sqlradius' } ),
- );
-
- my @sessions;
- foreach my $part_export (@part_export) {
- push @sessions, ( @{ $part_export->usage_sessions( {
- 'ip' => $p->{'ip'},
- } ) } );
- }
-
- my $mac = $sessions[0]->{'callingstationid'};
-
- return { 'mac_address' => $mac, };
-}
-
sub login_info {
my $p = shift;
$svc_x = $svc_phone;
- } elsif ( $p->{'domain'} eq 'ip_mac' ) {
-
- my $mac_address = $p->{'username'};
- $mac_address =~ s/\://g;
-
- my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $mac_address } );
- return { error => 'MAC address not found '.$p->{'username'} }
- unless $svc_broadband;
- $svc_x = $svc_broadband;
-
} elsif ( $p->{email}
&& (my $contact = FS::contact->by_selfservice_email($p->{email}))
)
$return{$_} = $cust_main->bill_location->get($_)
for qw(address1 address2 city state zip);
+ $p->{'payment_payby'} = $payment_info->{paybys} if !$p->{'payment_payby'};
+
# look for stored cust_payby info
# only if we've been given a clear payment_payby (to avoid payname conflicts)
- if ($p->{'payment_payby'} =~ /^(CARD|CHEK)$/) {
- my @search_payby = ($p->{'payment_payby'} eq 'CARD') ? ('CARD','DCRD') : ('CHEK','DCHK');
+ if ($p->{'payment_payby'} =~ /^(CARD|CHEK)$/ || (ref($p->{'payment_payby'}))) {
+ my @search_payby = ();
+ if ($p->{'payment_payby'} eq 'CARD') { @search_payby = ('CARD','DCRD'); }
+ elsif ($p->{'payment_payby'} eq 'CHEK') { @search_payby = ('CHEK','DCHK'); }
+ elsif (ref($p->{'payment_payby'}) eq 'ARRAY') { @search_payby = @{$payment_info->{paybys}}; }
my ($cust_payby) = $cust_main->cust_payby(@search_payby);
if ($cust_payby) {
+ $return{payby} = $cust_payby->payby;
$return{payname} = $cust_payby->payname
|| ( $cust_main->first. ' '. $cust_main->get('last') );
$return{custpaybynum} = $cust_payby->custpaybynum;