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