summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2006-11-14 03:16:26 +0000
committerivan <ivan>2006-11-14 03:16:26 +0000
commitfed0c6bf093ae154d17a4075e254a69be68f3d22 (patch)
tree7ab74f945bbfc06f64134de4ac509c46a4fff3f6
parent085d6dcbe3a137d8d8ad0b04b6d9c0af1516ee5e (diff)
have signup page use card-types config too
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm35
-rw-r--r--FS/FS/ClientAPI/Signup.pm3
-rw-r--r--FS/FS/Misc.pm42
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/signup.html12
4 files changed, 49 insertions, 43 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index c0fb46b4f..16b207132 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -11,6 +11,7 @@ use FS::CGI qw(small_custview); #doh
use FS::Conf;
use FS::Record qw(qsearch qsearchs);
use FS::Msgcat qw(gettext);
+use FS::Misc qw(card_types);
use FS::ClientAPI_SessionCache;
use FS::svc_acct;
use FS::svc_domain;
@@ -213,31 +214,6 @@ sub payment_info {
'country' => $conf->config('countrydefault') || 'US'
} );
- my %card_types = (
- #displayname #value (Business::CreditCard)
- "VISA" => "VISA card",
- "MasterCard" => "MasterCard",
- "Discover" => "Discover card",
- "American Express" => "American Express card",
- "Diner's Club/Carte Blanche" => "Diner's Club/Carte Blanche",
- "enRoute" => "enRoute",
- "JCB" => "JCB",
- "BankCard" => "BankCard",
- "Switch" => "Switch",
- "Solo" => "Solo",
- );
- my @conf_card_types = grep { ! /^\s*$/ } $conf->config('card-types');
- if ( @conf_card_types ) {
- #perhaps the hash is backwards for this, but this way works better for
- #usage in selfservice
- %card_types = map { $_ => $card_types{$_} }
- grep {
- my $d = $_;
- grep { $card_types{$d} eq $_ } @conf_card_types
- }
- keys %card_types;
- }
-
$payment_info = {
#list all counties/states/countries
@@ -248,14 +224,7 @@ sub payment_info {
'states' =>
[ sort { $a cmp $b } keys %states ],
- 'card_types' => {
- 'VISA' => 'VISA card',
- 'MasterCard' => 'MasterCard',
- 'Discover' => 'Discover card',
- 'American Express' => 'American Express card',
- 'Switch' => 'Switch',
- 'Solo' => 'Solo',
- },
+ 'card_types' => card_types(),
};
diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index 2af770c75..3daab9d81 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -5,6 +5,7 @@ use Tie::RefHash;
use FS::Conf;
use FS::Record qw(qsearch qsearchs dbdef);
use FS::Msgcat qw(gettext);
+use FS::Misc qw(card_types);
use FS::ClientAPI_SessionCache;
use FS::agent;
use FS::cust_main_county;
@@ -70,6 +71,8 @@ sub signup_info {
'payby' => [ $conf->config('signup_server-payby') ],
+ 'card_types' => card_types(),
+
'cvv_enabled' => defined dbdef->table('cust_main')->column('paycvv'),
'ship_enabled' => defined dbdef->table('cust_main')->column('ship_last'),
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm
index 06fa51f54..6024b832a 100644
--- a/FS/FS/Misc.pm
+++ b/FS/FS/Misc.pm
@@ -7,7 +7,7 @@ use Carp;
use Data::Dumper;
@ISA = qw( Exporter );
-@EXPORT_OK = qw( send_email send_fax states_hash state_label );
+@EXPORT_OK = qw( send_email send_fax states_hash state_label card_types );
$DEBUG = 0;
@@ -405,6 +405,46 @@ sub state_label {
}
+=item card_types
+
+Returns a hash reference of the accepted credit card types.
+
+=cut
+
+#$conf from above
+use Tie::IxHash;
+
+sub card_types {
+ my $conf = new FS::Conf;
+
+ tie my %card_types, 'Tie::IxHash',
+ #displayname #value (Business::CreditCard)
+ "VISA" => "VISA card",
+ "MasterCard" => "MasterCard",
+ "Discover" => "Discover card",
+ "American Express" => "American Express card",
+ "Diner's Club/Carte Blanche" => "Diner's Club/Carte Blanche",
+ "enRoute" => "enRoute",
+ "JCB" => "JCB",
+ "BankCard" => "BankCard",
+ "Switch" => "Switch",
+ "Solo" => "Solo",
+ ;
+ my @conf_card_types = grep { ! /^\s*$/ } $conf->config('card-types');
+ if ( @conf_card_types ) {
+ #perhaps the hash is backwards for this, but this way works better for
+ #usage in selfservice
+ %card_types = map { $_ => $card_types{$_} }
+ grep {
+ my $d = $_;
+ grep { $card_types{$d} eq $_ } @conf_card_types
+ }
+ keys %card_types;
+ }
+
+ \%card_types;
+}
+
=back
=head1 BUGS
diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html
index 6cce7806b..c2c5d700a 100755
--- a/fs_selfservice/FS-SelfService/cgi/signup.html
+++ b/fs_selfservice/FS-SelfService/cgi/signup.html
@@ -120,15 +120,9 @@ Contact Information
<%=
my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
- my %types = (
- 'VISA' => 'VISA card',
- 'MasterCard' => 'MasterCard',
- 'Discover' => 'Discover card',
- 'American Express' => 'American Express card',
- );
- foreach ( keys %types ) {
- $selected = $CARD_type eq $types{$_} ? 'SELECTED' : '';
- $cardselect .= qq!<OPTION $selected VALUE="$types{$_}">$_</OPTION>!;
+ foreach ( keys %card_types ) {
+ $selected = $CARD_type eq $card_types{$_} ? 'SELECTED' : '';
+ $cardselect .= qq!<OPTION $selected VALUE="$card_types{$_}">$_</OPTION>!;
}
$cardselect .= '</SELECT>';