summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_main/cust_payby.html
blob: a91c42502616180257989f41d906031724367ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
% if ( @cust_payby ) {

    <FONT CLASS="fsinnerbox-title"><% mt('Payment information') |h %></FONT>
    <TABLE CLASS="fsinnerbox">

%   my $num = 0;
%   foreach my $cust_payby ( @cust_payby ) {

%     #one line per piece of info?  maybe, but just getting something working
%     # for now

%     if ( $cust_payby->payby eq 'CARD' || $cust_payby->payby eq 'DCRD' ) { 

%       my $auto = $cust_payby->payby eq 'CARD' ? 'automatic' : 'on-demand';
        <TR>
          <TD COLSPAN=2 ALIGN="center">
            <% mt("Credit card ([_1])",$auto) |h %>
          </TD>
        </TR>
        <TR>
          <TH ALIGN="right"><% mt('Card number') |h %></TH>
          <TD><% $cust_payby->paymask %></TD>
        </TR>

%       my( $mon, $year ) = $cust_payby->paydate_mon_year;
        <TR>
          <TH ALIGN="right"><% mt('Expiration') |h %></TH>
          <TD><% "$mon/$year" %></TD>
        </TR>

%       if ( $cust_payby->paystart_month ) { 
          <TR>
            <TH ALIGN="right"><% mt('Start date') |h %></TH>
            <TD><% $cust_payby->paystart_month. '/'. $cust_payby->paystart_year %>
          </TR>
%       } elsif ( $cust_payby->payissue ) { 
          <TR>
            <TH ALIGN="right"><% mt('Issue #') |h %></TH>
            <TD><% $cust_payby->payissue %>
          </TR>
%       } 

        <TR>
          <TH ALIGN="right"><% mt('Name on card') |h %></TH>
          <TD><% $cust_payby->payname %></TD>
        </TR>

%     } elsif ( $cust_payby->payby eq 'CHEK' || $cust_payby->payby eq 'DCHK') {

%       my $auto = $cust_payby->payby eq 'CHEK' ? 'automatic' : 'on-demand';
%
%       my( $account, $aba ) = split('@', $cust_payby->paymask );
%       my $branch = '';
%       ($branch,$aba) = split('\.',$aba)
%         if $conf->config('echeck-country') eq 'CA';

        <TR>
          <TD COLSPAN=2 ALIGN="center">
            <% mt("Electronic check ([_1])",$auto) |h %>
          </TD>
        </TR>

%       #false laziness w/edit/cust_main/billing.html and misc/payment.cgi
%       my $routing_label = $conf->config('echeck-country') eq 'US'
%                             ? 'ABA/Routing number'
%                             : 'Routing number';
        <TR>
          <TH ALIGN="right"><% mt($routing_label) |h %></TH>
          <TD><% $aba %></TD>
        </TR>

%       if ( $conf->config('echeck-country') eq 'CA' ) {
          <TR>
            <TH ALIGN="right"><% mt('Branch number') |h %></TH>
            <TD><% $branch %></TD>
          </TR>
%       }

        <TR>
          <TH ALIGN="right"><% mt('Account number') |h %></TH>
          <TD><% $account %></TD>
        </TR>
        <TR>
          <TH ALIGN="right"><% mt('Account type') |h %></TH>
          <TD><% $cust_payby->paytype %></TD>
        </TR>
        <TR>
          <TH ALIGN="right"><% mt('Bank name') |h %></TH>
          <TD><% $cust_payby->payname %></TD>
        </TR>

%       if ( $conf->exists('show_bankstate') ) {
          <TR>
            <TH ALIGN="right"><% $paystate_label %></TH>
            <TD><% $cust_payby->paystate || '&nbsp;&nbsp;&nbsp;' %></TD>
          </TR>
%       }

%     } else {
        <TR>
          <TD COLSPAN="2"><FONT COLOR="#FF0000">
            Unknown cust_payby.payby <% $cust_payby->payby %>
          </FONT></TD>
        </TR>
%     }

%     unless ( $num++ == $#cust_payby ) {
        <TR>
          <TD COLSPAN="2"></TD>
        </TR>
        <TR>
          <TD COLSPAN="2" STYLE="border-top: 1px solid black; padding:2px"></TD>
        </TR>
%     }

%   }

    </TABLE>

% }
<%once>

my $paystate_label = FS::Msgcat::_gettext('paystate');
$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;

</%once>
<%init>

my( $cust_main ) = @_;
my $conf = new FS::Conf;
my @cust_payby = $cust_main->cust_payby;

</%init>