From 2b49cbe76b94c6c1561aa2bf37beba7d47591190 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Aug 2005 13:22:27 +0000 Subject: customer edit: abstract out billing info to billing.html, re-do payment type selection with HTML::Widgets::SelectLayers, add Switch/Solo/Maestro support for start date & issue #. customer view: re-order fields for consistency. selfservice API: support paystart_month, paystart_year, payissue and payip in MyAccount::process_payment and ::edit_info and Signup::new_customer, FS::cust_main::realtime_bop: support paystart_month paystart_year payissue payip fields --- FS/FS/ClientAPI/MyAccount.pm | 10 +++++++--- FS/FS/ClientAPI/Signup.pm | 7 ++++++- FS/FS/cust_main.pm | 36 ++++++++++++++++++++++++++++-------- FS/FS/cust_main_county.pm | 4 ++-- 4 files changed, 43 insertions(+), 14 deletions(-) (limited to 'FS') diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 45c2eb0de..4b67f53af 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -27,7 +27,7 @@ use vars qw( @cust_main_editable_fields ); county state zip country daytime night fax ship_first ship_last ship_company ship_address1 ship_address2 ship_city ship_state ship_zip ship_country ship_daytime ship_night ship_fax - payby payinfo payname + payby payinfo payname paystart_month paystart_year payissue payip ); use subs qw(_provision); @@ -226,6 +226,8 @@ sub payment_info { 'MasterCard' => 'MasterCard', 'Discover' => 'Discover card', 'American Express' => 'American Express card', + 'Switch' => 'Switch', + 'Solo' => 'Solo', }, }; @@ -341,7 +343,8 @@ sub process_payment { 'payname' => $payname, 'paybatch' => $paybatch, 'paycvv' => $paycvv, - map { $_ => $p->{$_} } qw( address1 address2 city state zip ) + map { $_ => $p->{$_} } qw( paystart_month paystart_year payissue payip + address1 address2 city state zip ) ); return { 'error' => $error } if $error; @@ -350,7 +353,8 @@ sub process_payment { if ( $p->{'save'} ) { my $new = new FS::cust_main { $cust_main->hash }; $new->set( $_ => $p->{$_} ) - foreach qw( payname address1 address2 city state zip payinfo ); + foreach qw( payname paystart_month paystart_year payissue payip + address1 address2 city state zip payinfo ); $new->set( 'paydate' => $p->{'year'}. '-'. $p->{'month'}. '-01' ); $new->set( 'payby' => $p->{'auto'} ? 'CARD' : 'DCRD' ); my $error = $new->replace($cust_main); diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index ede7ba9a0..ed71651fa 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -197,7 +197,12 @@ sub new_customer { ship_city ship_county ship_state ship_zip ship_country ship_daytime ship_night ship_fax - payby payinfo paycvv paydate payname referral_custnum comments + payby + payinfo paycvv paydate payname + paystart_month paystart_year payissue + payip + + referral_custnum comments ) } ); diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 8622b87e7..0169039b9 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -17,7 +17,7 @@ BEGIN { use Date::Format; #use Date::Manip; use String::Approx qw(amatch); -use Business::CreditCard; +use Business::CreditCard 0.28; use FS::UID qw( getotaker dbh ); use FS::Record qw( qsearchs qsearch dbdef ); use FS::Misc qw( send_email ); @@ -2195,13 +2195,33 @@ sub realtime_bop { $paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; $content{expiration} = "$2/$1"; - if ( defined $self->dbdef_table->column('paycvv') ) { - my $paycvv = exists($options{'paycvv'}) - ? $options{'paycvv'} - : $self->paycvv; - $content{cvv2} = $self->paycvv - if length($paycvv); - } + my $paycvv = exists($options{'paycvv'}) + ? $options{'paycvv'} + : $self->paycvv; + $content{cvv2} = $self->paycvv + if length($paycvv); + + my $paystart_month = exists($options{'paystart_month'}) + ? $options{'paystart_month'} + : $self->paystart_month; + + my $paystart_year = exists($options{'paystart_year'}) + ? $options{'paystart_year'} + : $self->paystart_year; + + $content{card_start} = "$paystart_month/$paystart_year" + if $paystart_month && $paystart_year; + + my $payissue = exists($options{'payissue'}) + ? $options{'payissue'} + : $self->payissue; + $content{issue_number} = $payissue if $payissue; + + my $payip = exists($options{'payip'}) + ? $options{'payip'} + : $self->payip; + $content{customer_ip} = $payip + if length($payip); $content{recurring_billing} = 'YES' if qsearch('cust_pay', { 'custnum' => $self->custnum, diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index e44f919f2..17f346071 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -251,7 +251,7 @@ END foreach my $state ( sort keys %{ $cust_main_county{$selected_country} } ) { my $text = $state || '(n/a)'; my $selected = $state eq $selected_state ? 'SELECTED' : ''; - $state_html .= "\n" + $state_html .= qq(\n); } $state_html .= ''; @@ -265,7 +265,7 @@ END keys %cust_main_county ) { my $selected = $country eq $selected_country ? ' SELECTED' : ''; - $country_html .= "\n$country" + $country_html .= qq(\n$country"); } $country_html .= ''; -- cgit v1.2.1