From: ivan Date: Mon, 21 Apr 2003 20:53:57 +0000 (+0000) Subject: on-demand vs. automatic cards & checks: added DCRD and DCHK payment types X-Git-Tag: freeside_1_5_0pre1~14 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=030bef17868168b05a67d9f5866b55da1bb9439c on-demand vs. automatic cards & checks: added DCRD and DCHK payment types --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index cb404ff03..5681dde38 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -905,7 +905,7 @@ httemplate/docs/config.html 'section' => '', 'description' => 'Acceptable payment types for the signup server', 'type' => 'selectmultiple', - 'select_enum' => [ qw(CARD CHEK LECB PREPAY BILL COMP) ], + 'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ], }, { @@ -1013,7 +1013,7 @@ httemplate/docs/config.html 'section' => 'UI', 'description' => 'Default payment type. HIDE disables display of billing information and sets customers to BILL.', 'type' => 'select', - 'select_enum' => [ '', qw(CARD CHEK LECB BILL COMP HIDE) ], + 'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL COMP HIDE) ], }, { diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index cde370c68..cefc7648f 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -159,7 +159,7 @@ FS::Record. The following fields are currently supported: =item ship_fax - phone (optional) -=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 payby - I (credit card - automatic), I (credit card - on-demand), I (electronic check - automatic), I (electronic check - on-demand), I (Phone bill billing), I (billing), I (free), or I (special billing type: applies a credit - see L and sets billing type to I) =item payinfo - card number, P.O., comp issuer (4-8 lowercase alphanumerics; think username) or prepayment identifier (see L) @@ -700,11 +700,11 @@ sub check { } } - $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREPAY)$/ + $self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY)$/ or return "Illegal payby: ". $self->payby; $self->payby($1); - if ( $self->payby eq 'CARD' ) { + if ( $self->payby eq 'CARD' || $self->payby eq 'DCRD' ) { my $payinfo = $self->payinfo; $payinfo =~ s/\D//g; @@ -717,7 +717,7 @@ sub check { return gettext('unknown_card_type') if cardtype($self->payinfo) eq "Unknown"; - } elsif ( $self->payby eq 'CHEK' ) { + } elsif ( $self->payby eq 'CHEK' || $self->payby eq 'DCHK' ) { my $payinfo = $self->payinfo; $payinfo =~ s/[^\d\@]//g; @@ -770,7 +770,9 @@ sub check { } if ( $self->payname eq '' && $self->payby ne 'CHEK' && - ( ! $conf->exists('require_cardname') || $self->payby ne 'CARD' ) ) { + ( ! $conf->exists('require_cardname') + || $self->payby !~ /^(CARD|DCRD)$/ ) + ) { $self->payname( $self->first. " ". $self->getfield('last') ); } else { $self->payname =~ /^([\w \,\.\-\']+)$/ @@ -1244,8 +1246,9 @@ sub bill { (Attempt to) collect money for this customer's outstanding invoices (see L). Usually used after the bill method. -Depending on the value of `payby', this may print an invoice (`BILL'), charge -a credit card (`CARD'), or just add any necessary (pseudo-)payment (`COMP'). +Depending on the value of `payby', this may print or email an invoice (I, +I, or I), charge a credit card (I), charge via electronic +check/ACH (I), or just add any necessary (pseudo-)payment (I). Most actions are now triggered by invoice events; see L and the invoice events web interface. diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm index a75a011b0..e0e4f3f19 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, LECB, BILL, or COMP +=item payby - CARD, DCRD, CHEK, DCHK, 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 LECB BILL COMP )] ) + || $self->ut_enum('payby', [qw( CARD DCRD CHEK DCHK LECB BILL COMP )] ) || $self->ut_text('event') || $self->ut_anything('eventcode') || $self->ut_number('seconds') diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 579d071ac..63e621b57 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -113,7 +113,7 @@ the bill and collect methods of a cust_main object. See L. -d: Pretend it's 'date'. Date is in any format Date::Parse is happy with, but be careful. - -p: Only process customers with the specified payby (CARD, CHEK, BILL, COMP, LECB) + -p: Only process customers with the specified payby (I, I, I, I, I, I, I) -v: enable debugging diff --git a/FS/bin/freeside-expiration-alerter b/FS/bin/freeside-expiration-alerter index 5399f6d22..691fd3aa5 100755 --- a/FS/bin/freeside-expiration-alerter +++ b/FS/bin/freeside-expiration-alerter @@ -97,7 +97,7 @@ foreach my $customer (@customers) my $expire_time = timelocal(0,0,0,$payday,--$paymonth,$payyear); #credit cards expire at the end of the month/year of their exp date - if ($payby eq 'CARD') { + if ($payby eq 'CARD' || $payby eq 'DCRD') { ($paymonth < 11) ? $paymonth++ : ($paymonth=0, $payyear++); $expire_time = timelocal(0,0,0,$payday,$paymonth,$payyear); $expire_time--; @@ -127,7 +127,7 @@ foreach my $customer (@customers) $FS::alerter::_template::first = $first; $FS::alerter::_template::last = $last; $FS::alerter::_template::company = $company; - if ($payby eq 'CARD') { + if ($payby eq 'CARD' || $payby eq 'DCRD') { $FS::alerter::_template::payby = "credit card (" . substr($payinfo, 0, 2) . "xxxxxxxxxx" . substr($payinfo, -4) . ")"; @@ -202,7 +202,7 @@ user: From the mapsecrets file - see config.html from the base documentation =head1 VERSION -$Id: freeside-expiration-alerter,v 1.4 2002-09-16 09:27:14 ivan Exp $ +$Id: freeside-expiration-alerter,v 1.5 2003-04-21 20:53:57 ivan Exp $ =head1 BUGS diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 010ec4c14..8ec014186 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -291,6 +291,8 @@ foreach my $aref ( [ 'COMP', 'Comp invoice', '$cust_bill->comp();', 30, 'comp' ], [ 'CARD', 'Batch card', '$cust_bill->batch_card();', 40, 'batch-card' ], [ 'BILL', 'Send invoice', '$cust_bill->send();', 50, 'send' ], + [ 'DCRD', 'Send invoice', '$cust_bill->send();', 50, 'send' ], + [ 'DCHK', 'Send invoice', '$cust_bill->send();', 50, 'send' ], ) { my $part_bill_event = new FS::part_bill_event({ diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 6672e605c..e384aaf8e 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.35 2002-12-24 23:03:27 ivan Exp $ +# $Id: signup.cgi,v 1.36 2003-04-21 20:53:57 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $init_data $error @@ -160,9 +160,10 @@ if ( defined $cgi->param('magic') ) { } $payby = $cgi->param('payby'); - if ( $payby eq 'CHEK' ) { + if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { #$payinfo = join('@', map { $cgi->param( $payby. "_payinfo$_" ) } (1,2) ); - $payinfo = $cgi->param('CHEK_payinfo1').'@'.$cgi->param('CHEK_payinfo2'); + $payinfo = $cgi->param($payby. '_payinfo1'). '@'. + $cgi->param($payby. '_payinfo2'); } else { $payinfo = $cgi->param( $payby. '_payinfo' ); } @@ -212,7 +213,7 @@ if ( defined $cgi->param('magic') ) { } else { $password2 = $cgi->param('_password2'); - if ( $payby eq 'CARD' && $cgi->param('CARD_type') ) { + if ( $payby =~ /^(CARD|DCRD)$/ && $cgi->param('CARD_type') ) { $payinfo =~ s/\D//g; $payinfo =~ /^(\d{13,16})$/ diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html index 724ffd7f8..80774099c 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.html +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -92,7 +92,9 @@ Contact Information my %payby = ( 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'DCRD' => qq!Credit card
*$cardselect
*Exp !. expselect("DCRD"). qq!
*Name on card
!, 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => 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"), @@ -102,7 +104,9 @@ Contact Information my( $account, $aba ) = split('@', $payinfo); my %paybychecked = ( 'CARD' => qq!Credit card
*$cardselect
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'DCRD' => qq!Credit card
*$cardselect
*Exp !. expselect("DCRD", $paydate). qq!
*Name on card
!, 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, + 'DCHK' => 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), diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 593ea82a0..a59755e76 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, CHEK, LECB, BILL, or COMP +
    • payby - CARD, DCRD, CHEK, DCHK, 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 @@ -116,7 +116,7 @@
    • ship_daytime
    • ship_night
    • ship_fax -
    • payby - CARD, CHEK, LECB, BILL, or COMP +
    • payby - CARD, DCHK, CHEK, DCHK, LECB, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paydate - expiration date
    • payname - billing name (name on card) diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 706526865..d8edbcd8e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -357,7 +357,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD CHEK LECB BILL COMP )) { + foreach my $payby (qw( CARD DCRD CHEK DCHK LECB BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -405,8 +405,10 @@ 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 !, + 'CARD' => qq!Credit card (automatic)
      ${r}
      ${r}Exp !. expselect("CARD"). qq!
      ${r}Name on card
      !, + 'DCRD' => qq!Credit card (on-demand)
      ${r}
      ${r}Exp !. expselect("DCRD"). qq!
      ${r}Name on card
      !, + 'CHEK' => qq!Electronic check (automatic)
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
      ${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"), @@ -415,15 +417,17 @@ if ( $payby_default eq 'HIDE' ) { my( $account, $aba ) = split('@', $payinfo); 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 !, + 'CARD' => qq!Credit card (automatic)
      ${r}
      ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
      ${r}Name on card
      !, + 'DCRD' => qq!Credit card (on-demand)
      ${r}
      ${r}Exp !. expselect("DCRD", $cust_main->paydate). qq!
      ${r}Name on card
      !, + 'CHEK' => qq!Electronic check (automatic)
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
      ${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 LECB BILL COMP)) { + for (qw(CARD DCRD CHEK DCHK 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 2104b4530..6426eed93 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -41,7 +41,7 @@ print ntable("#cccccc",2), <Payby