[freeside-commits] freeside/FS/FS Misc.pm,1.15,1.16
Ivan,,,
ivan at wavetail.420.am
Mon Nov 13 19:16:28 PST 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv14481/FS/FS
Modified Files:
Misc.pm
Log Message:
have signup page use card-types config too
Index: Misc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Misc.pm 25 Aug 2006 19:30:52 -0000 1.15
+++ Misc.pm 14 Nov 2006 03:16:26 -0000 1.16
@@ -7,7 +7,7 @@
use Data::Dumper;
@ISA = qw( Exporter );
- at EXPORT_OK = qw( send_email send_fax states_hash state_label );
+ at EXPORT_OK = qw( send_email send_fax states_hash state_label card_types );
$DEBUG = 0;
@@ -405,6 +405,46 @@
}
+=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
More information about the freeside-commits
mailing list