summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_pay_pending.html
blob: a8cc186e4e72e8536849fef29e3b65b79a3ddfe1 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<% include('/elements/header-popup.html', $title ) %>

% if ( $action eq 'delete' ) {

    <CENTER><FONT SIZE="+1"><B>Are you sure you want to delete this pending payment?</B></FONT></CENTER>

% } elsif (( $action eq 'complete' ) and $authorized) {

    <CENTER><FONT SIZE="+1"><B>Payment was authorized but not captured.  Contact <% $cust_pay_pending->processor || 'the payment gateway' %> to establish the final disposition of this transaction.</B></FONT></CENTER>

% } elsif ( $action eq 'complete' ) {

    <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>

% } elsif ( $action eq 'capture' ) {

    <CENTER><FONT SIZE="+1"><B>Captured payment not recorded in database - check logs for errors.</B></FONT></CENTER>

% }

<BR>

%#false laziness w/view/cust_pay.html
<% include('/elements/small_custview.html',
             $cust_pay_pending->custnum,
             scalar($conf->config('countrydefault')),
             1, #no balance
          )
%>
<BR>

<% ntable("#cccccc", 2) %>

<TR>
  <TD ALIGN="right">Pending payment#</TD>
  <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->paypendingnum %></B></TD>
</TR>

<TR>
  <TD ALIGN="right">Date</TD>
  <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay_pending->_date %></B></TD>
</TR>

<TR>
  <TD ALIGN="right">Amount</TD>
  <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay_pending->paid %></B></TD>
</TR>

<TR>
  <TD ALIGN="right">Payment method</TD>
  <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->payby_name %> #<% $cust_pay_pending->paymask %></B></TD>
</TR>

% #if ( $cust_pay_pending->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay_pending->paybatch ) { 

    <TR>
      <TD ALIGN="right">Processor</TD>
      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->processor %></B></TD>
    </TR>

    <TR>
      <TD ALIGN="right">Authorization#</TD>
      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->authorization %></B></TD>
    </TR>

%   if ( $cust_pay_pending->order_number ) {
      <TR>
        <TD ALIGN="right">Order#</TD>
        <TD BGCOLOR="#FFFFFF"><B><% $cust_pay_pending->order_number %></B></TD>
      </TR>
%   }

% #}

</TABLE>

<BR>

<FORM NAME   = "pendingform"
      METHOD = "POST"
      ACTION = "process/cust_pay_pending.html"
>

<INPUT TYPE="hidden" NAME="paypendingnum" VALUE="<% $paypendingnum %>">

<% itable() %>

% if ( $action eq 'delete' ) {

    <INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">

    <TR>
      <TD ALIGN="center">
        <BUTTON TYPE="button" onClick="document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, delete payment</BUTTON>
      </TD>
      <TD>&nbsp;&nbsp;&nbsp;</TD>
      <TD ALIGN="center">
        <BUTTON TYPE="button" onClick="parent.cClick();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, cancel deletion</BUTTON>
      </TD>
    </TR>

% } else {

    <INPUT TYPE="hidden" NAME="action" VALUE="">

    <TR>
      <TD ALIGN="center">
        <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'insert_cust_pay'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, transaction completed successfully.</BUTTON>
      </TD>

%   if ( $action eq 'complete' ) {
        <TD>&nbsp;&nbsp;&nbsp;</TD>
%     if ($authorized) {
        <TD ALIGN="center">
          <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'reverse'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was reversed</BUTTON>
        </TD>
%     } else {
        <TD ALIGN="center">
          <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON>
        </TD>
%     }
        <TD>&nbsp;&nbsp;&nbsp;</TD>
        <TD ALIGN="center">
          <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>
        </TD>
%   }

    </TR>

    <TR><TD COLSPAN=5></TD></TR>

    <TR>
      <TD COLSPAN=5 ALIGN="center">
        <BUTTON TYPE="button" onClick="parent.cClick();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->Cancel payment completion; transaction status not yet known</BUTTON>
      </TD>
    </TR>

% }

</TABLE>

</FORM>
</BODY>
</HTML>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Edit customer pending payments');

$cgi->param('action') =~ /^(\w+)$/ or die 'illegal action';
my $action = $1;
my $title = ucfirst($action). ' pending payment';

$cgi->param('paypendingnum') =~ /^(\d+)$/ or die 'illegal paypendingnum';
my $paypendingnum = $1;
my $cust_pay_pending =
  qsearchs({
    'select'    => 'cust_pay_pending.*',
    'table'     => 'cust_pay_pending',
    'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
    'hashref'   => { 'paypendingnum' => $paypendingnum },
    'extra_sql' => ' AND '. $curuser->agentnums_sql,
  })
  or die 'unknown paypendingnum';

my $authorized = ($cust_pay_pending->status eq 'authorized') ? 1 : 0;

my $conf = new FS::Conf;

my $money_char = $conf->config('money_char') || '$';

</%init>