From 789c34c5251f4b831a7cb27bd2a9af700ccf2ced Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Nov 2002 09:51:59 +0000 Subject: [PATCH] add LEC billing --- FS/FS/cust_bill.pm | 29 ++++- FS/FS/cust_main.pm | 17 ++- FS/FS/cust_pay.pm | 6 +- FS/FS/cust_refund.pm | 6 +- FS/FS/part_bill_event.pm | 4 +- FS/FS/part_export/ldap.pm | 2 +- FS/FS/part_pkg.pm | 2 + fs_signup/FS-SignupClient/cgi/signup.cgi | 204 ++---------------------------- fs_signup/FS-SignupClient/cgi/signup.html | 5 + httemplate/docs/schema.html | 8 +- httemplate/edit/cust_main.cgi | 6 +- httemplate/edit/part_bill_event.cgi | 2 +- httemplate/view/cust_main.cgi | 7 + 13 files changed, 81 insertions(+), 217 deletions(-) diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 708b99746..a682c5958 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -637,6 +637,28 @@ sub realtime_ach { ); } +=item realtime_lec + +Attempts to pay this invoice with phone bill (LEC) payment via a +Business::OnlinePayment realtime gateway. See +http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment +for supported processors. + +=cut + +sub realtime_ach { + my $self = shift; + $self->realtime_bop( + 'LEC', + $bop_processor, + $bop_login, + $bop_password, + $bop_action, + \@bop_options, + @_ + ); +} + sub realtime_bop { my( $self, $method, $processor, $login, $password, $action, $options ) = @_; my $cust_main = $self->cust_main; @@ -695,12 +717,13 @@ sub realtime_bop { ( $content{account_number}, $content{routing_code} ) = split('@', $cust_main->payinfo); $content{bank_name} = $cust_main->payname; + } elsif ( $method eq 'LEC' ) { + $content{phone} = $cust_main->payinfo; } my $transaction = new Business::OnlinePayment( $processor, @$options ); $transaction->content( - %content, 'type' => $method, 'login' => $login, 'password' => $password, @@ -720,6 +743,7 @@ sub realtime_bop { 'referer' => 'http://cleanwhisker.420.am/', 'email' => $email, 'phone' => $cust_main->daytime || $cust_main->night, + %content, #after ); $transaction->submit(); @@ -771,6 +795,7 @@ sub realtime_bop { my %method2payby = ( 'CC' => 'CARD', 'CHECK' => 'CHEK', + 'LEC' => 'LECB', ); my $cust_pay = new FS::cust_pay ( { @@ -1096,7 +1121,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.51 2002-11-16 10:33:16 ivan Exp $ +$Id: cust_bill.pm,v 1.52 2002-11-19 09:51:58 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f9f473db9..4a5cff2fc 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -158,7 +158,7 @@ FS::Record. The following fields are currently supported: =item ship_fax - phone (optional) -=item payby - `CARD' (credit cards), `CHEK' (electronic check), `BILL' (billing), `COMP' (free), or `PREPAY' (special billing type: applies a credit - see L and sets billing type to BILL) +=item payby - `CARD' (credit cards), `CHEK' (electronic check), `LECB' (Phone bill billing), `BILL' (billing), `COMP' (free), or `PREPAY' (special billing type: applies a credit - see L and sets billing type to BILL) =item payinfo - card number, P.O., comp issuer (4-8 lowercase alphanumerics; think username) or prepayment identifier (see L) @@ -484,14 +484,15 @@ sub replace { $self->invoicing_list( $invoicing_list ); } - if ( $self->payby =~ /^(CARD|CHEK)$/ && + if ( $self->payby =~ /^(CARD|CHEK|LECB)$/ && grep { $self->get($_) ne $old->get($_) } qw(payinfo paydate payname) ) { # card/check info has changed, want to retry realtime_card invoice events #false laziness w/collect foreach my $cust_bill_event ( grep { #$_->part_bill_event->plan eq 'realtime-card' - $_->part_bill_event->eventcode eq '$cust_bill->realtime_card();' + $_->part_bill_event->eventcode =~ + /^\$cust_bill\->realtime_(card|ach|lec)\(\);$/ && $_->status eq 'done' && $_->statustext } @@ -691,6 +692,14 @@ sub check { $payinfo = "$1\@$2"; $self->payinfo($payinfo); + } elsif ( $self->payby eq 'LECB' ) { + + my $payinfo = $self->payinfo; + $payinfo =~ s/\D//g; + $payinfo =~ /^1?(\d{10})$/ or return 'invalid btn billing telephone number'; + $payinfo = $1; + $self->payinfo($payinfo); + } elsif ( $self->payby eq 'BILL' ) { $error = $self->ut_textn('payinfo'); @@ -715,7 +724,7 @@ sub check { if ( $self->paydate eq '' || $self->paydate eq '-' ) { return "Expriation date required" - unless $self->payby =~ /^(BILL|PREPAY|CHEK)$/; + unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/; $self->paydate(''); } else { $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 222691408..79cf82755 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -61,7 +61,7 @@ currently supported: L and L for conversion functions. =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), -`BILL' (billing), or `COMP' (free) +`LECB' (phone bill billing), `BILL' (billing), or `COMP' (free) =item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively @@ -347,7 +347,7 @@ sub check { $self->_date(time) unless $self->_date; - $self->payby =~ /^(CARD|CHEK|BILL|COMP)$/ or return "Illegal payby"; + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby"; $self->payby($1); #false laziness with cust_refund::check @@ -406,7 +406,7 @@ sub unapplied { =head1 VERSION -$Id: cust_pay.pm,v 1.22 2002-10-12 10:15:55 ivan Exp $ +$Id: cust_pay.pm,v 1.23 2002-11-19 09:51:58 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index aac320e61..763671736 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -48,7 +48,7 @@ inherits from FS::Record. The following fields are currently supported: L and L for conversion functions. =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), -`BILL' (billing), or `COMP' (free) +`LECB' (Phone bill billing), `BILL' (billing), or `COMP' (free) =item payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username) @@ -235,7 +235,7 @@ sub check { unless $self->crednum || qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); - $self->payby =~ /^(CARD|CHEK|BILL|COMP)$/ or return "Illegal payby"; + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby"; $self->payby($1); #false laziness with cust_pay::check @@ -267,7 +267,7 @@ sub check { =head1 VERSION -$Id: cust_refund.pm,v 1.19 2002-10-12 10:15:55 ivan Exp $ +$Id: cust_refund.pm,v 1.20 2002-11-19 09:51:58 ivan Exp $ =head1 BUGS diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm index e86b5c1fb..dc10be879 100644 --- a/FS/FS/part_bill_event.pm +++ b/FS/FS/part_bill_event.pm @@ -37,7 +37,7 @@ FS::Record. The following fields are currently supported: =item eventpart - primary key -=item payby - CARD, CHEK, BILL, or COMP +=item payby - CARD, CHEK, LECB, BILL, or COMP =item event - event name @@ -140,7 +140,7 @@ sub check { } my $error = $self->ut_numbern('eventpart') - || $self->ut_enum('payby', [qw( CARD CHEK BILL COMP )] ) + || $self->ut_enum('payby', [qw( CARD CHEK LECB BILL COMP )] ) || $self->ut_text('event') || $self->ut_anything('eventcode') || $self->ut_number('seconds') diff --git a/FS/FS/part_export/ldap.pm b/FS/FS/part_export/ldap.pm index 40f27d695..ec1d37fd5 100644 --- a/FS/FS/part_export/ldap.pm +++ b/FS/FS/part_export/ldap.pm @@ -31,7 +31,7 @@ sub _export_insert { grep { /^\s*(\w+)\s+(.*\S)\s*$/ } split("\n", $self->option('attributes')); - if ( $self->option('radius') { + if ( $self->option('radius') ) { foreach my $table (qw(reply check)) { my $method = "radius_$table"; my %radius = $svc_acct->$method(); diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index f290420df..99d88d56a 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -282,6 +282,8 @@ following logic instead; If the package has B<0> setup and B<0> recur, the single item B is returned, otherwise, the single item B is returned. +(CHEK? LEC? Probably shouldn't accept those by default, prone to abuse) + =cut sub payby { diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 333a88cf8..1eb0613ba 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.31 2002-10-12 10:15:55 ivan Exp $ +# $Id: signup.cgi,v 1.32 2002-11-19 09:51:59 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $init_data $error @@ -18,7 +18,7 @@ use vars qw( @payby $cgi $locales $packages $pops $init_data $error $self_url ); use subs qw( print_form print_okay print_decline - signup_default success_default decline_default + success_default decline_default expselect ); use CGI; #use CGI::Carp qw(fatalsToBrowser); @@ -88,11 +88,13 @@ if ( -e $signup_html ) { $agentnum = $1; } } else { - $signup_template = new Text::Template ( TYPE => 'STRING', - SOURCE => &signup_default, - DELIMITERS => [ '<%=', '%>' ] - ) - or die $Text::Template::ERROR; + #too much maintenance hassle to keep in this file + die "can't find ./signup.html or /usr/local/freeside/signup.html"; + #$signup_template = new Text::Template ( TYPE => 'STRING', + # SOURCE => &signup_default, + # DELIMITERS => [ '<%=', '%>' ] + # ) + # or die $Text::Template::ERROR; } if ( -e $success_html ) { @@ -510,191 +512,3 @@ support. END } -sub signup_default { #html to use if you don't specify a template file - <<'END'; -ISP Signup form -ISP Signup form

-<%= $error %> -
- - - -Contact Information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*Contact name
(last, first)
, -
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
-
Billing information - - -<%= scalar(@payby) > 1 ? '' : '' %> -
- - <%= - $OUT .= ' - - Postal mail invoice -
Email invoice -
Billing type
- - - - <%= - - my $cardselect = ''; - - my %payby = ( - 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD"). qq!
*Name on card
!, - 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, - 'BILL' => qq!Billing
P.O.
Attention
!, - 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), - 'PREPAY' => qq!Prepaid card
*!, - ); - - my( $account, $aba ) = split('@', $payinfo); - - my %paybychecked = ( - 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, - 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, - 'BILL' => qq!Billing
P.O.
Attention
!, - 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), - 'PREPAY' => qq!Prepaid card
*!, - ); - - for (@payby) { - if ( scalar(@payby) == 1) { - $OUT .= '"; - } else { - $OUT .= qq!!; - } else { - $OUT .= qq!> $payby{$_}!; - } - - } - } - %> - -
'. - qq!!. - "$paybychecked{$_} $paybychecked{$_}
* required fields for each billing type -

First package - - - - - - - - - - - - - - - - -<%= - if ( $init_data->{'security_phrase'} ) { - $OUT .= < - - - -ENDOUT - } else { - $OUT .= ''; - } -%> -<%= - if ( scalar(@$pops) ) { - $OUT .= ''; - } else { - $OUT .= popselector($popnum); - } -%> -
Username
Password
Re-enter Password
Security Phrase -
Access number'. - popselector($popnum). '
-

-
-END -} diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html index 6c601410c..d89b6854b 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.html +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -97,13 +97,18 @@ Contact Information my %payby = ( 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), 'PREPAY' => qq!Prepaid card
*!, ); + my( $account, $aba ) = split('@', $payinfo); my %paybychecked = ( 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), 'PREPAY' => qq!Prepaid card
*!, diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index c518d4a4d..b4d21f3b9 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -39,7 +39,7 @@
  • part_bill_event - Invoice event definitions
    • eventpart - primary key -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • event - event name
    • eventcode - event action
    • seconds - how long after the invoice date (cust_bill._date) events of this type are triggered @@ -109,7 +109,7 @@
    • ship_daytime
    • ship_night
    • ship_fax -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paydate - expiration date
    • payname - billing name (name on card) @@ -150,7 +150,7 @@
    • custnum - customer
    • paid - amount
    • _date -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paybatch - text field for tracking card processor batches
    • closed - books closed flag, empty or `Y' @@ -200,7 +200,7 @@
    • custnum - customer
    • refund - amount
    • _date -
    • payby - CARD, BILL or COMP +
    • payby - CARD, CHEK, LECB, BILL or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • otaker - order taker
    • closed - books closed flag, empty or `Y' diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index c8db6b206..5642604d2 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -353,7 +353,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD CHEK BILL COMP )) { + foreach my $payby (qw( CARD CHEK LECB BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -403,6 +403,7 @@ if ( $payby_default eq 'HIDE' ) { my %payby = ( 'CARD' => qq!Credit card
      ${r}
      ${r}Exp !. expselect("CARD"). qq!
      ${r}Name on card
      !, 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'LECB' => qq!Phone bill billing
      ${r}Phone number !, 'BILL' => qq!Billing
      P.O.
      Attention
      !, 'COMP' => qq!Complimentary
      ${r}Approved by
      ${r}Exp !. expselect("COMP"), ); @@ -412,12 +413,13 @@ if ( $payby_default eq 'HIDE' ) { my %paybychecked = ( 'CARD' => qq!Credit card
      ${r}
      ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
      ${r}Name on card
      !, 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'LECB' => qq!Phone bill billing
      ${r}Phone number !, 'BILL' => qq!Billing
      P.O.
      Attention
      !, 'COMP' => qq!Complimentary
      ${r}Approved by
      ${r}Exp !. expselect("COMP", $cust_main->paydate), ); $cust_main->payby($payby_default) unless $cust_main->payby; - for (qw(CARD CHEK BILL COMP)) { + for (qw(CARD CHEK LECB BILL COMP)) { print qq!payby eq "$_") { print qq! CHECKED> $paybychecked{$_}!; diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 70aca99eb..30a60ea41 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -41,7 +41,7 @@ print ntable("#cccccc",2), <Payby