optimize CDR rating after timed rate perf regression, RT#15739
[freeside.git] / httemplate / edit / cust_pay_pending.html
1 <% include('/elements/header-popup.html', $title ) %>
2
3 % if ( $action eq 'delete' ) {
4
5     <CENTER><FONT SIZE="+1"><B>Are you sure you want to delete this pending payment?</B></FONT></CENTER>
6
7 % } elsif ( $action eq 'complete' ) {
8
9     <CENTER><FONT SIZE="+1"><B>No response was received from <% $cust_pay_pending->processor || 'the payment gateway' %> for this transaction.  Check <% $cust_pay_pending->processor || 'the payment gateway' %>'s reporting and determine if this transaction completed successfully.</B></FONT></CENTER>
10
11 % } elsif ( $action eq 'capture' ) {
12
13     <CENTER><FONT SIZE="+1"><B>Captured payment not recorded in database - check logs for errors.</B></FONT></CENTER>
14
15 % }
16
17 <BR>
18
19 %#false laziness w/view/cust_pay.html
20 <% include('/elements/small_custview.html',
21              $cust_pay_pending->custnum,
22              scalar($conf->config('countrydefault')),
23              1, #no balance
24           )
25 %>
26 <BR>
27
28 <% ntable("#cccccc", 2) %>
29
30 <TR>
31   <TD ALIGN="right">Pending payment#</TD>
32   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->paypendingnum %></B></TD>
33 </TR>
34
35 <TR>
36   <TD ALIGN="right">Date</TD>
37   <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay_pending->_date %></B></TD>
38 </TR>
39
40 <TR>
41   <TD ALIGN="right">Amount</TD>
42   <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay_pending->paid %></B></TD>
43 </TR>
44
45 <TR>
46   <TD ALIGN="right">Payment method</TD>
47   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->payby_name %> #<% $cust_pay_pending->paymask %></B></TD>
48 </TR>
49
50 % #if ( $cust_pay_pending->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay_pending->paybatch ) { 
51
52     <TR>
53       <TD ALIGN="right">Processor</TD>
54       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->processor %></B></TD>
55     </TR>
56
57     <TR>
58       <TD ALIGN="right">Authorization#</TD>
59       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->authorization %></B></TD>
60     </TR>
61
62 %   if ( $cust_pay_pending->order_number ) {
63       <TR>
64         <TD ALIGN="right">Order#</TD>
65         <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->order_number %></B></TD>
66       </TR>
67 %   }
68
69 % #}
70
71 </TABLE>
72
73 <BR>
74
75 <FORM NAME   = "pendingform"
76       METHOD = "POST"
77       ACTION = "process/cust_pay_pending.html"
78 >
79
80 <INPUT TYPE="hidden" NAME="paypendingnum" VALUE="<% $paypendingnum %>">
81
82 <% itable() %>
83
84 % if ( $action eq 'delete' ) {
85
86     <INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">
87
88     <TR>
89       <TD ALIGN="center">
90         <BUTTON TYPE="button" onClick="document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, delete payment</BUTTON>
91       </TD>
92       <TD>&nbsp;&nbsp;&nbsp;</TD>
93       <TD ALIGN="center">
94         <BUTTON TYPE="button" onClick="parent.cClick();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, cancel deletion</BUTTON>
95       </TD>
96     </TR>
97
98 % } else {
99
100 %#   if ( $action eq 'complete' ) {
101
102     <INPUT TYPE="hidden" NAME="action" VALUE="">
103
104     <TR>
105       <TD ALIGN="center">
106         <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'insert_cust_pay'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, transaction completed sucessfully.</BUTTON>
107       </TD>
108
109 %     if ( $action eq 'complete' ) {
110         <TD>&nbsp;&nbsp;&nbsp;</TD>
111         <TD ALIGN="center">
112           <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON>
113         </TD>
114         <TD>&nbsp;&nbsp;&nbsp;</TD>
115         <TD ALIGN="center">
116           <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'delete'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was not received</BUTTON>
117         </TD>
118       </TR>
119 %   }
120
121     <TR><TD COLSPAN=5></TD></TR>
122
123     <TR>
124       <TD COLSPAN=5 ALIGN="center">
125         <BUTTON TYPE="button" onClick="parent.cClick();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->Cancel payment completion; transaction status not yet known</BUTTON>
126       </TD>
127     </TR>
128
129 % }
130
131 </TABLE>
132
133 </FORM>
134 </BODY>
135 </HTML>
136 <%init>
137
138 my $curuser = $FS::CurrentUser::CurrentUser;
139
140 die "access denied"
141   unless $curuser->access_right('Edit customer pending payments');
142
143 $cgi->param('action') =~ /^(\w+)$/ or die 'illegal action';
144 my $action = $1;
145 my $title = ucfirst($action). ' pending payment';
146
147 $cgi->param('paypendingnum') =~ /^(\d+)$/ or die 'illegal paypendingnum';
148 my $paypendingnum = $1;
149 my $cust_pay_pending =
150   qsearchs({
151     'select'    => 'cust_pay_pending.*',
152     'table'     => 'cust_pay_pending',
153     'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
154     'hashref'   => { 'paypendingnum' => $paypendingnum },
155     'extra_sql' => ' AND '. $curuser->agentnums_sql,
156   })
157   or die 'unknown paypendingnum';
158
159 my $conf = new FS::Conf;
160
161 my $money_char = $conf->config('money_char') || '$';
162
163 </%init>