diff options
author | ivan <ivan> | 2009-05-25 01:49:34 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-05-25 01:49:34 +0000 |
commit | d6b6f81e383f9d876e67e9704914e887a331012e (patch) | |
tree | 5385587c8c736ae27a4fa411e58fc49482eb25b9 /fs_selfservice | |
parent | aa6c509c76c647d05d7bc94ca58effa845cac245 (diff) |
international self-service payments, RT#1592
Diffstat (limited to 'fs_selfservice')
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 55 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/card.html | 50 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/make_payment.html | 16 | ||||
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/misc/counties.cgi | 18 | ||||
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/misc/states.cgi | 18 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 2 |
6 files changed, 110 insertions, 49 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index 47f312ac0..058955037 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -86,8 +86,9 @@ $socket .= '.'.$tag if defined $tag && length($tag); ); @EXPORT_OK = ( keys(%autoload), - qw( regionselector regionselector_hashref - expselect popselector domainselector didselector ) + qw( regionselector regionselector_hashref location_form + expselect popselector domainselector didselector + ) ); $ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin'; @@ -550,6 +551,10 @@ State Zip or postal code +=item country + +Two-letter country code + =item payinfo Card number @@ -1436,6 +1441,52 @@ sub regionselector_hashref { }; } +=item location_form HASHREF | LIST + +Takes as input a hashref or list of key/value pairs with the following keys: + +=over 4 + +=item session_id + +Current customer session_id + +=item no_asterisks + +Omit red asterisks from required fields. + +=item address1_label + +Label for first address line. + +=back + +Returns an HTML fragment for a location form (address, city, state, zip, +country) + +=cut + +sub location_form { + my $param; + if ( ref($_[0]) ) { + $param = shift; + } else { + $param = { @_ }; + } + + my $session_id = delete $param->{'session_id'}; + + my $rv = mason_comp( 'session_id' => $session_id, + 'comp' => '/elements/location.html', + 'args' => [ %$param ], + ); + + #hmm. + $rv->{'error'} || $rv->{'output'}; + +} + + #=item expselect HASHREF | LIST # #Takes as input a hashref or list of key/value pairs with the following keys: diff --git a/fs_selfservice/FS-SelfService/cgi/card.html b/fs_selfservice/FS-SelfService/cgi/card.html index cf6d20d8d..c7db2b398 100644 --- a/fs_selfservice/FS-SelfService/cgi/card.html +++ b/fs_selfservice/FS-SelfService/cgi/card.html @@ -1,11 +1,11 @@ <TR> - <TD ALIGN="right">Card number</TD> - <TD> + <TH ALIGN="right">Card number</TH> + <TD COLSPAN=6> <TABLE> <TR> <TD> <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%=$payinfo%>"> </TD> - <TD>Exp.</TD> + <TH>Exp.</TH> <TD> <SELECT NAME="month"> <%= for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) { @@ -35,39 +35,13 @@ ''; %> <TR> - <TD ALIGN="right">Exact name on card</TD> - <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%=$payname%>"></TD> -</TR><TR> - <TD ALIGN="right">Card billing address</TD> - <TD> - <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address1" VALUE="<%=$address1%>"> - </TD> -</TR><TR> - <TD ALIGN="right">Address line 2</TD> - <TD> - <INPUT TYPE="text" SIZE=40 MAXLENGTH=80 NAME="address2" VALUE="<%=$address2%>"> - </TD> -</TR><TR> - <TD ALIGN="right">City</TD> - <TD> - <TABLE> - <TR> - <TD> - <INPUT TYPE="text" NAME="city" SIZE="12" MAXLENGTH=80 VALUE="<%=$city%>"> - </TD> - <TD>State</TD> - <TD> - <SELECT NAME="state"> - <%= for ( @states ) { - $OUT .= '<OPTION'. ($_ eq $state ? ' SELECTED' : '' ). ">$_\n"; - } %> - </SELECT> - </TD> - <TD>Zip</TD> - <TD> - <INPUT TYPE="text" NAME="zip" SIZE=11 MAXLENGTH=10 VALUE="<%=$zip%>"> - </TD> - </TR> - </TABLE> - </TD> + <TH ALIGN="right">Exact name on card</TH> + <TD COLSPAN=6><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%=$payname%>"></TD> </TR> + +<%= location_form( 'session_id' => $session_id, + 'no_asterisks' => 1, + #'address1_label' => 'Card billing address', + 'address1_label' => 'Card billing address', + ) +%> diff --git a/fs_selfservice/FS-SelfService/cgi/make_payment.html b/fs_selfservice/FS-SelfService/cgi/make_payment.html index a468d998a..da6e67ed2 100644 --- a/fs_selfservice/FS-SelfService/cgi/make_payment.html +++ b/fs_selfservice/FS-SelfService/cgi/make_payment.html @@ -22,23 +22,23 @@ <INPUT TYPE="hidden" NAME="action" VALUE="payment_results"> <TABLE BGCOLOR="#cccccc"> <TR> - <TD ALIGN="right">Amount Due</TD> - <TD> + <TH ALIGN="right">Amount Due</TH> + <TD COLSPAN=7> <TABLE><TR><TD BGCOLOR="#ffffff"> $<%=sprintf("%.2f",$balance)%> </TD></TR></TABLE> </TD> </TR> <TR> - <TD ALIGN="right">Payment amount</TD> - <TD> + <TH ALIGN="right">Payment amount</TH> + <TD COLSPAN=7> <TABLE><TR><TD BGCOLOR="#ffffff"> $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f",$balance)%>"> </TD></TR></TABLE> </TD> </TR><TR> - <TD ALIGN="right">Card type</TD> - <TD> + <TH ALIGN="right">Card type</TH> + <TD COLSPAN=7> <SELECT NAME="card_type"><OPTION></OPTION> <%= foreach ( keys %card_types ) { $selected = $card_type eq $card_types{$_} ? ' SELECTED' : ''; @@ -49,12 +49,12 @@ </TR> <%= include('card') %> <TR> - <TD COLSPAN=2> + <TD COLSPAN=8> <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1"> Remember this information </TD> </TR><TR> - <TD COLSPAN=2> + <TD COLSPAN=8> <INPUT TYPE="checkbox"<%= $payby eq 'CARD' ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> Charge future payments to this card automatically </TD> diff --git a/fs_selfservice/FS-SelfService/cgi/misc/counties.cgi b/fs_selfservice/FS-SelfService/cgi/misc/counties.cgi new file mode 100755 index 000000000..476fe09a4 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/counties.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/counties.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/misc/states.cgi b/fs_selfservice/FS-SelfService/cgi/misc/states.cgi new file mode 100755 index 000000000..f75f2ae1d --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/states.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/states.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index ecf2553a3..4c7b1d86a 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -664,7 +664,7 @@ package FS::SelfService::_selfservicecgi; #use FS::SelfService qw(regionselector expselect popselector); use HTML::Entities; -use FS::SelfService qw(regionselector popselector domainselector); +use FS::SelfService qw(regionselector popselector domainselector location_form); #false laziness w/agent.cgi sub include { |