From 26119738eaf2b519d91c855c23986f873303887f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Mar 2009 07:14:29 +0000 Subject: allow country selection on credit card entry, RT#4997 --- httemplate/misc/payment.cgi | 59 ++++++++++----------------------------------- 1 file changed, 13 insertions(+), 46 deletions(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 004700488..45aeacad4 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -12,7 +12,7 @@ <% ntable('#cccccc') %> - Payment amount + Payment amount - - +
$"> @@ -24,11 +24,6 @@ % % 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->paymask; % $paycvv = $cust_main->paycvv; @@ -37,13 +32,13 @@ % }
Card number + Card number - + - + - + - - - - - - - - - + <% include( '/elements/location.html', + 'object' => $cust_main, #XXX errors??? + 'no_asterisks' => 1, + 'address1_label' => 'Card billing address', + ) + %> + % } elsif ( $payby eq 'CHEK' ) { % % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate, -- cgit v1.2.1 From 8800e519dc0e4b8eee4ab2cddc74d52c205bc536 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Sep 2009 12:29:16 +0000 Subject: processing fee on credit card recharges, RT#5889 --- httemplate/misc/payment.cgi | 73 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 5 deletions(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 45aeacad4..472763b2d 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -10,16 +10,66 @@ % #include( '/elements/table.html', '#cccccc' ) +% my $amount = $balance > 0 ? sprintf("%.2f", $balance) : ''; + <% ntable('#cccccc') %> - +% if ( $fee ) { + + + +% } + + % if ( $payby eq 'CARD' ) { % % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); @@ -237,16 +287,29 @@ my $balance = $cust_main->balance; my $payinfo = ''; -#false laziness w/selfservice make_payment.html shortcut for one-country my $conf = new FS::Conf; + +my $money_char = $conf->config('money_char') || '$'; + +#false laziness w/selfservice make_payment.html shortcut for one-country my %states = map { $_->state => 1 } qsearch('cust_main_county', { 'country' => $conf->config('countrydefault') || 'US' } ); my @states = sort { $a cmp $b } keys %states; -my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; +my $fee = ''; +my $fee_pkg = ''; +if ( $conf->config('manual_process-pkgpart') ) { + $fee_pkg = + qsearchs('part_pkg', { pkgpart=>$conf->config('manual_process-pkgpart') } ); - + #well ->unit_setup or ->calc_setup both call for a $cust_pkg + # (though ->unit_setup doesn't use it...) + $fee = $fee_pkg->option('setup_fee') + if $fee_pkg; #in case.. better than dying with a perl traceback +} +my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; + -- cgit v1.2.1 From 0c2679eee18b3b073bc91657fcf85c5dd2e5efc0 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:16:46 +0000 Subject: add manual_process-display config to subtract fee from amount instead of adding, RT#5889 --- httemplate/misc/payment.cgi | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 472763b2d..d35e73f14 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -10,8 +10,6 @@ % #include( '/elements/table.html', '#cccccc' ) -% my $amount = $balance > 0 ? sprintf("%.2f", $balance) : ''; - <% ntable('#cccccc') %> @@ -32,14 +30,14 @@
Exp.Exp.
CVV2CVV2 (help)
Exact name on cardExact name on card
Card billing address - -
Address line 2 - -
City - - - - - - - - -
- - State - - Zip - -
-
Payment amount +
- $"> + <% $money_char %> + +% if ( $fee ) { + + + + + <% $money_char . $fee %> + + <% $fee_pkg->pkg |h %> + = + + <% length($amount) ? $money_char. sprintf('%.2f', $amount + $fee ) : '' %> TOTAL + +% }
Payment amount % if ( $fee ) { - - + + + <% $fee_op %> <% $money_char . $fee %> <% $fee_pkg->pkg |h %> = - <% length($amount) ? $money_char. sprintf('%.2f', $amount + $fee ) : '' %> TOTAL + <% length($amount) ? $money_char. sprintf('%.2f', ($fee_display eq 'add') ? $amount + $fee : $amount - $fee ) : '' %> <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %> % }
@@ -55,13 +53,13 @@ var total = ''; if ( what.value.length ) { - total = parseFloat(what.value) + <% $fee %>; + total = parseFloat(what.value) <% $fee_op %> <% $fee %>; /* total = Math.round(total*100)/100; */ total = '<% $money_char %>' + total.toFixed(2); } var total_cell = document.getElementById('ajax_total_cell'); - total_cell.innerHTML = '' + total + ' TOTAL'; + total_cell.innerHTML = '' + total + ' <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %>'; } @@ -300,7 +298,13 @@ my @states = sort { $a cmp $b } keys %states; my $fee = ''; my $fee_pkg = ''; +my $fee_display = ''; +my $fee_op = ''; if ( $conf->config('manual_process-pkgpart') ) { + + $fee_display = $conf->config('manual_process-display') || 'add'; + $fee_op = $fee_display eq 'add' ? '+' : '-'; + $fee_pkg = qsearchs('part_pkg', { pkgpart=>$conf->config('manual_process-pkgpart') } ); @@ -308,6 +312,15 @@ if ( $conf->config('manual_process-pkgpart') ) { # (though ->unit_setup doesn't use it...) $fee = $fee_pkg->option('setup_fee') if $fee_pkg; #in case.. better than dying with a perl traceback + +} + +my $amount = ''; +if ( $balance > 0 ) { + $amount = $balance; + $amount += $fee + if $fee && $fee_display eq 'subtract'; + $amount = sprintf("%.2f", $amount); } my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; -- cgit v1.2.1 From 357b4e26965895666685590d59f72de331fecb08 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:36:03 +0000 Subject: add manual_process-skip_first option, RT#5889 --- httemplate/misc/payment.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index d35e73f14..ada925c55 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -302,6 +302,8 @@ my $fee_display = ''; my $fee_op = ''; if ( $conf->config('manual_process-pkgpart') ) { + last if $conf->exists('manual_process-skip_first') && ! $cust_main->cust_pay; + $fee_display = $conf->config('manual_process-display') || 'add'; $fee_op = $fee_display eq 'add' ? '+' : '-'; -- cgit v1.2.1 From 331e3441a2eb49396ed3234da33022ce25244974 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:40:28 +0000 Subject: add manual_process-skip_first option, RT#5889 --- httemplate/misc/payment.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index ada925c55..8d7baa5da 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -300,9 +300,10 @@ my $fee = ''; my $fee_pkg = ''; my $fee_display = ''; my $fee_op = ''; -if ( $conf->config('manual_process-pkgpart') ) { - - last if $conf->exists('manual_process-skip_first') && ! $cust_main->cust_pay; +if ( $conf->config('manual_process-pkgpart') + and ! $conf->exists('manual_process-skip_first') || $cust_main->cust_pay + ) +{ $fee_display = $conf->config('manual_process-display') || 'add'; $fee_op = $fee_display eq 'add' ? '+' : '-'; -- cgit v1.2.1 From 2caddb16574bf73c3687b959656b7ee2f851937f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 18:17:55 +0000 Subject: oops, handle old cust_main.pm properly (should we be bothering?) :/ RT#5889 --- httemplate/misc/payment.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/payment.cgi') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 8d7baa5da..813b560bd 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -300,8 +300,12 @@ my $fee = ''; my $fee_pkg = ''; my $fee_display = ''; my $fee_op = ''; +my $num_payments = scalar($cust_main->cust_pay); +#handle old cust_main.pm (remove...) +$num_payments = scalar( @{ [ $cust_main->cust_pay ] } ) + unless defined $num_payments; if ( $conf->config('manual_process-pkgpart') - and ! $conf->exists('manual_process-skip_first') || $cust_main->cust_pay + and ! $conf->exists('manual_process-skip_first') || $num_payments ) { -- cgit v1.2.1