have the UI use full country names, and state names outside the US...
[freeside.git] / FS / FS / payby.pm
1 package FS::payby;
2
3 use strict;
4 use vars qw(%hash);
5 use Tie::IxHash;
6
7 =head1 NAME
8
9 FS::payby - Object methods for payment type records
10
11 =head1 SYNOPSIS
12
13   use FS::payby;
14
15   #for now...
16
17   my @payby = FS::payby->payby;
18
19   tie my %payby, 'Tie::IxHash', FS::payby->payby2longname
20
21   my @cust_payby = FS::payby->cust_payby;
22
23   tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname
24
25 =head1 DESCRIPTION
26
27 Payment types.
28
29 =head1 METHODS
30
31 =over 4 
32
33 =item
34
35 =cut
36
37 tie %hash, 'Tie::IxHash',
38   'CARD' => {
39     tinyname  => 'card',
40     shortname => 'Credit card',
41     longname  => 'Credit card (automatic)',
42   },
43   'DCRD' => {
44     tinyname  => 'card',
45     shortname => 'Credit card',
46     longname  => 'Credit card (on-demand)',
47     cust_pay  => 'CARD', #this is a customer type only, payments are CARD...
48   },
49   'CHEK' => {
50     tinyname  => 'check',
51     shortname => 'Electronic check',
52     longname  => 'Electronic check (automatic)',
53   },
54   'DCHK' => {
55     tinyname  => 'check',
56     shortname => 'Electronic check',
57     longname  => 'Electronic check (on-demand)',
58     cust_pay  => 'CHEK', #this is a customer type only, payments are CHEK...
59   },
60   'LECB' => {
61     tinyname  => 'phone bill',
62     shortname => 'Phone bill billing',
63     longname  => 'Phone bill billing',
64   },
65   'BILL' => {
66     tinyname  => 'billing',
67     shortname => 'Billing',
68     longname  => 'Billing',
69   },
70   'CASH' => {
71     tinyname  => 'cash',
72     shortname => 'Cash', # initial payment, then billing
73     longname  => 'Cash',
74     cust_main => 'BILL', #this is a payment type only, customers go to BILL...
75   },
76   'WEST' => {
77     tinyname  => 'western union',
78     shortname => 'Western Union', # initial payment, then billing
79     longname  => 'Western Union',
80     cust_main => 'BILL', #this is a payment type only, customers go to BILL...
81   },
82   'MCRD' => { #not the same as DCRD
83     tinyname  => 'card',
84     shortname => 'Manual credit card', # initial payment, then billing
85     longname  => 'Manual credit card', 
86     cust_main => 'BILL', #this is a payment type only, customers go to BILL...
87   },
88   'COMP' => {
89     tinyname  => 'comp',
90     shortname => 'Complimentary',
91     longname  => 'Complimentary',
92   },
93 ;
94
95 sub payby {
96   keys %hash;
97 }
98
99 sub payby2longname {
100   my $self = shift;
101   map { $_ => $hash{$_}->{longname} } $self->payby;
102 }
103
104 sub cust_payby {
105   my $self = shift;
106   grep { ! exists $hash{$_}->{cust_main} } $self->payby;
107 }
108
109 sub cust_payby2longname {
110   my $self = shift;
111   map { $_ => $hash{$_}->{longname} } $self->cust_payby;
112 }
113
114 =back
115
116 =head1 BUGS
117
118 This should eventually be an actual database table.
119
120 =head1 SEE ALSO
121
122 =cut
123
124 1;
125