[freeside-commits] freeside/FS/FS/ClientAPI Signup.pm, 1.37, 1.38 MyAccount.pm, 1.55, 1.56
Jeff Finucane,420,,
jeff at wavetail.420.am
Sun Apr 29 15:55:15 PDT 2007
- Previous message: [freeside-commits] freeside/FS/FS Conf.pm,1.194,1.195
- Next message: [freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi signup.cgi, 1.7, 1.8 signup.html, 1.9, 1.10 myaccount_menu.html, 1.7, 1.8 make_ach_payment.html, NONE, 1.1 ach_payment_results.html, NONE, 1.1 selfservice.cgi, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail:/tmp/cvs-serv15695/FS/FS/ClientAPI
Modified Files:
Signup.pm MyAccount.pm
Log Message:
ticket 1568 config options for new echeck fields and addition to selfservice interface
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- MyAccount.pm 26 Apr 2007 04:46:32 -0000 1.55
+++ MyAccount.pm 29 Apr 2007 22:55:13 -0000 1.56
@@ -23,6 +23,7 @@
use FS::cust_bill;
use FS::cust_main_county;
use FS::cust_pkg;
+use FS::payby;
use HTML::Entities;
#false laziness with FS::cust_main
@@ -237,6 +238,14 @@
'card_types' => card_types(),
+ 'paytypes' => [ @FS::cust_main::paytypes ],
+
+ 'stateid_label' => FS::Msgcat::_gettext('stateid'),
+ 'stateid_state_label' => FS::Msgcat::_gettext('stateid_state'),
+
+ 'show_ss' => $conf->exists('show_ss'),
+ 'show_stateid' => $conf->exists('show_stateid'),
+ 'show_paystate' => $conf->exists('show_bankstate'),
};
}
@@ -260,6 +269,7 @@
$return{$_} = $cust_main->get($_) for qw(address1 address2 city state zip);
$return{payby} = $cust_main->payby;
+ $return{stateid_state} = $cust_main->stateid_state;
if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
$return{card_type} = cardtype($cust_main->payinfo);
@@ -269,6 +279,15 @@
}
+ if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
+ my ($payinfo1, $payinfo2) = split '@', $cust_main->payinfo;
+ $return{payinfo1} = $payinfo1;
+ $return{payinfo2} = $payinfo2;
+ $return{paytype} = $cust_main->paytype;
+ $return{paystate} = $cust_main->paystate;
+
+ }
+
#doubleclick protection
my $_date = time;
$return{paybatch} = "webui-MyAccount-$_date-$$-". rand() * 2**32;
@@ -303,19 +322,23 @@
or return { 'error' => gettext('illegal_text'). " paybatch: ". $p->{'paybatch'} };
my $paybatch = $1;
+ $p->{'payby'} =~ /^([A-Z]{4})$/
+ or return { 'error' => "illegal_payby " . $p->{'payby'} };
+ my $payby = $1;
+
my $payinfo;
my $paycvv = '';
- #if ( $payby eq 'CHEK' ) {
- #
- # $p->{'payinfo1'} =~ /^(\d+)$/
- # or return { 'error' => "illegal account number ". $p->{'payinfo1'} };
- # my $payinfo1 = $1;
- # $p->{'payinfo2'} =~ /^(\d+)$/
- # or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} };
- # my $payinfo2 = $1;
- # $payinfo = $payinfo1. '@'. $payinfo2;
- #
- #} elsif ( $payby eq 'CARD' ) {
+ if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
+
+ $p->{'payinfo1'} =~ /^(\d+)$/
+ or return { 'error' => "illegal account number ". $p->{'payinfo1'} };
+ my $payinfo1 = $1;
+ $p->{'payinfo2'} =~ /^(\d+)$/
+ or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} };
+ my $payinfo2 = $1;
+ $payinfo = $payinfo1. '@'. $payinfo2;
+
+ } elsif ( $payby eq 'CARD' || $payby eq 'DCRD' ) {
$payinfo = $p->{'payinfo'};
$payinfo =~ s/\D//g;
@@ -339,19 +362,23 @@
}
}
- #} else {
- # die "unknown payby $payby";
- #}
+ } else {
+ die "unknown payby $payby";
+ }
- my $error = $cust_main->realtime_bop( 'CC', $p->{'amount'},
+ my %payby2fields = (
+ 'CARD' => [ qw( paystart_month paystart_year payissue address1 address2 city state zip payip ) ],
+ 'CHEK' => [ qw( ss paytype paystate stateid stateid_state payip ) ],
+ );
+
+ my $error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $p->{'amount'},
'quiet' => 1,
'payinfo' => $payinfo,
'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01',
'payname' => $payname,
'paybatch' => $paybatch,
'paycvv' => $paycvv,
- map { $_ => $p->{$_} } qw( paystart_month paystart_year payissue payip
- address1 address2 city state zip )
+ map { $_ => $p->{$_} } @{ $payby2fields{$payby} }
);
return { 'error' => $error } if $error;
@@ -359,11 +386,19 @@
if ( $p->{'save'} ) {
my $new = new FS::cust_main { $cust_main->hash };
- $new->set( $_ => $p->{$_} )
- foreach qw( payname paystart_month paystart_year payissue payip
- address1 address2 city state zip payinfo );
+ if ($payby eq 'CARD' || $payby eq 'DCRD') {
+ $new->set( $_ => $p->{$_} )
+ foreach qw( payname paystart_month paystart_year payissue payip
+ address1 address2 city state zip payinfo );
+ $new->set( 'payby' => $p->{'auto'} ? 'CARD' : 'DCRD' );
+ } elsif ($payby eq 'CHEK' || $payby eq 'DCHK') {
+ $new->set( $_ => $p->{$_} )
+ foreach qw( payname payip paytype paystate
+ stateid stateid_state );
+ $new->set( 'payinfo' => $payinfo );
+ $new->set( 'payby' => $p->{'auto'} ? 'CHEK' : 'DCHK' );
+ }
$new->set( 'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01' );
- $new->set( 'payby' => $p->{'auto'} ? 'CARD' : 'DCRD' );
my $error = $new->replace($cust_main);
return { 'error' => $error } if $error;
$cust_main = $new;
Index: Signup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Signup.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- Signup.pm 20 Mar 2007 22:10:38 -0000 1.37
+++ Signup.pm 29 Apr 2007 22:55:13 -0000 1.38
@@ -67,14 +67,24 @@
'card_types' => card_types(),
+ 'paytypes' => [ @FS::cust_main::paytypes ],
+
'cvv_enabled' => defined dbdef->table('cust_main')->column('paycvv'), # 1,
+ 'stateid_enabled' => $conf->exists('show_stateid'),
+
+ 'paystate_enabled' => $conf->exists('show_bankstate'),
+
'ship_enabled' => defined dbdef->table('cust_main')->column('ship_last'),#1,
'msgcat' => { map { $_=>gettext($_) } qw(
passwords_dont_match invalid_card unknown_card_type not_a empty_password illegal_or_empty_text
) },
+ 'label' => { map { $_ => FS::Msgcat::_gettext($_) } qw(
+ stateid stateid_state
+ ) },
+
'statedefault' => $conf->config('statedefault') || 'CA',
'countrydefault' => $conf->config('countrydefault') || 'US',
@@ -259,14 +269,14 @@
last first ss company address1 address2
city county state zip country
- daytime night fax
+ daytime night fax stateid stateid_state
ship_last ship_first ship_ss ship_company ship_address1 ship_address2
ship_city ship_county ship_state ship_zip ship_country
ship_daytime ship_night ship_fax
payby
- payinfo paycvv paydate payname
+ payinfo paycvv paydate payname paystate paytype
paystart_month paystart_year payissue
payip
- Previous message: [freeside-commits] freeside/FS/FS Conf.pm,1.194,1.195
- Next message: [freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi signup.cgi, 1.7, 1.8 signup.html, 1.9, 1.10 myaccount_menu.html, 1.7, 1.8 make_ach_payment.html, NONE, 1.1 ach_payment_results.html, NONE, 1.1 selfservice.cgi, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list