From 73f34cbe08a9be968a2557cd6906dde5bb9a97a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Mar 2004 00:06:55 +0000 Subject: one-time credit card and ACH payments (like self-service) closes: Bug#648 --- httemplate/misc/payment.cgi | 209 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 httemplate/misc/payment.cgi (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi new file mode 100644 index 000000000..bf89a3da7 --- /dev/null +++ b/httemplate/misc/payment.cgi @@ -0,0 +1,209 @@ +<% + my %type = ( 'CARD' => 'credit card', + 'CHEK' => 'electronic check (ACH)', + ); + + $cgi->param('payby') =~ /^(CARD|CHEK)$/ + or die "unknown payby ". $cgi->param('payby'); + my $payby = $1; + + $cgi->param('custnum') =~ /^(\d+)$/ + or die "illegal custnum ". $cgi->param('custnum'); + my $custnum = $1; + + my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } ); + die "unknown custnum $custnum" unless $cust_main; + + my $balance = $cust_main->balance; + + my $payinfo = ''; + + #false laziness w/selfservice make_payment.html shortcut for one-country + my $conf = new FS::Conf; + my %states = map { $_->state => 1 } + qsearch('cust_main_county', { + 'country' => $conf->config('defaultcountry') || 'US' + } ); + my @states = sort { $a cmp $b } keys %states; + + my $paybatch = "webui-payment-". time. "-$$-". rand() * 2**32; + +%> +<%= include( '/elements/header.html', "Process $type{$payby} payment" ) %> +<%= include( '/elements/small_custview.html', $cust_main ) %> +
+ + + + +<% #include( '/elements/table.html', '#cccccc' ) %> +<%= ntable('#cccccc') %> + + Payment amount + +
+ $"> +
+ + +<% if ( $payby eq 'CARD' ) { + my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); + my $payname = $cust_main->first. ' '. $cust_main->getfield('last'); + my $address1 = $cust_main->address1; + my $address2 = $cust_main->address2; + my $city = $cust_main->city; + my $state = $cust_main->state; + my $zip = $cust_main->zip; + if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { + $payinfo = $cust_main->payinfo; + $paycvv = $cust_main->paycvv; + ( $month, $year ) = $cust_main->paydate_monthyear; + $payname = $cust_main->payname if $cust_main->payname; + } +%> + + Card number + + + + + + + + + +
+ Exp. + + / + +
+ + + + CVV2 + + (help) + + + + Exact name on card + + + Card billing address + + + + + Address line 2 + + + + + City + + + + + + + + + +
+ + State + + Zip + +
+ + + +<% } elsif ( $payby eq 'CHEK' ) { + my( $payinfo1, $payinfo2, $payname, $ss ) = ( '', '', '', '' ); + if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { + $cust_main->payinfo =~ /^(\d+)\@(\d+)$/ + or die "unparsable payinfo ". $cust_main->payinfo; + ($payinfo1, $payinfo2) = ($1, $2); + $payname = $cust_main->payname; + $ss = $cust_main->ss; + } +%> + + + + Account number + + + + ABA/Routing number + + + (help) + + + + Bank name + + + + + Account holder
+ Social security or tax ID # + + + + +<% } %> + + + + + Remember this information + + + + NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> + Charge future payments to this <%= $type{$payby} %> automatically + + + +
+ +
+ + -- cgit v1.2.1 From 3bdf0736baab914ce151849b1bc0139f5a554ca2 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Jun 2004 17:26:54 +0000 Subject: set defaults so as to not change the billing type when entering a one time payment --- httemplate/misc/payment.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index bf89a3da7..699b31724 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -197,7 +197,7 @@ function achclose() { - NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> + payby ne 'DCRD' ) || ( $payby eq 'CHEK' && $cust_main->payby eq 'CHEK' ) ) ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> Charge future payments to this <%= $type{$payby} %> automatically -- cgit v1.2.1 From 83ce2076d59c3c27beb78dd5892b2da99fd60ec1 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Jun 2004 17:57:02 +0000 Subject: fix one-time card charging not pulling in exp date? --- httemplate/misc/payment.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 699b31724..cea77fe1a 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -93,7 +93,7 @@ function achclose() { @@ -101,7 +101,7 @@ function achclose() { -- cgit v1.2.1 From 0b227319d33d012890891570891f9d9401ff89ff Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jun 2004 14:33:35 +0000 Subject: forgot october! closes: Bug#880 --- httemplate/misc/payment.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index cea77fe1a..02c6c5428 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -92,7 +92,7 @@ function achclose() { Exp. -- cgit v1.2.1