RT#41671 Fix double click prevention for all legacy buttons [full-on fixes]
[freeside.git] / ng_selfservice / payment_ach.php
1 <? $title ='Electronic Check Payment'; include('elements/header.php'); ?>
2 <? $current_menu = 'payment_ach.php'; include('elements/menu.php'); ?>
3 <?
4
5 if ( isset($_POST['amount']) && $_POST['amount'] ) {
6
7   $payment_results = $freeside->process_payment(array(
8     'session_id'    => $_COOKIE['session_id'],
9     'payby'         => 'CHEK',
10     'amount'        => $_POST['amount'],
11     'payinfo1'      => $_POST['payinfo1'],
12     'payinfo2'      => $_POST['payinfo2'],
13     'month'         => 12,
14     'year'          => 2037,
15     'payname'       => $_POST['payname'],
16     'paytype'       => $_POST['paytype'],
17     'paystate'      => $_POST['paystate'],
18     'ss'            => $_POST['ss'],
19     'stateid'       => $_POST['stateid'],
20     'stateid_state' => $_POST['stateid_state'],
21     'save'          => $_POST['save'],
22     'auto'          => $_POST['auto'],
23     'paybatch'      => $_POST['paybatch'],
24     //'discount_term' => $discount_term,
25   ));
26
27   if ( $payment_results['error'] ) {
28     $payment_error = $payment_results['error'];
29   } else {
30     $receipt_html = $payment_results['receipt_html'];
31   }
32
33 }
34
35 if ( $receipt_html ) { ?>
36
37   Your payment was processed successfully.  Thank you.<BR><BR>
38   <? echo $receipt_html; ?>
39
40 <? } else {
41
42   $payment_info = $freeside->payment_info( array(
43     'session_id' => $_COOKIE['session_id'],
44     'payment_payby' => 'CHEK',
45   ) );
46
47   if ( isset($payment_info['error']) && $payment_info['error'] ) {
48     $error = $payment_info['error'];
49     header('Location:index.php?error='. urlencode($error));
50     die();
51   }
52
53   extract($payment_info);
54
55   $error = $payment_error;
56
57   ?>
58
59   <? include('elements/error.php'); ?>
60
61   <FORM NAME="OneTrueForm" METHOD="POST" ACTION="payment_ach.php" onSubmit="document.OneTrueForm.process.disabled=true">
62
63   <TABLE>
64   <TR>
65     <TD ALIGN="right">Amount&nbsp;Due</TD>
66     <TD>
67       <TABLE><TR><TD BGCOLOR="#ffffff">
68         $<? echo sprintf("%.2f", $balance) ?>
69       </TD></TR></TABLE>
70     </TD>
71   </TR>
72
73   <TR>
74     <TD ALIGN="right">Payment&nbsp;amount</TD>
75     <TD>
76       <TABLE><TR><TD BGCOLOR="#ffffff">
77         $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<? echo sprintf("%.2f", $balance) ?>">
78       </TD></TR></TABLE>
79     </TD>
80   </TR>
81   <? // include('elements/discount_term.php') ?>
82
83   <? include('elements/check.php') ?>
84
85   <TR>
86     <TD COLSPAN=2>
87       <INPUT TYPE="checkbox" <? if ( ! $save_unchecked ) { echo 'CHECKED'; } ?> NAME="save" VALUE="1">
88       Remember this information
89     </TD>
90   </TR><TR>
91     <TD COLSPAN=2>
92       <INPUT TYPE="checkbox" <? if ( $payby == 'CARD' ) { echo ' CHECKED'; } ?> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
93       Charge future payments to this account automatically
94     </TD>
95   </TR>
96   </TABLE>
97   <BR>
98   <INPUT TYPE="hidden" NAME="paybatch" VALUE="<? echo $paybatch; ?>">
99   <INPUT TYPE="submit" NAME="process" VALUE="Process payment"> <!-- onClick="this.disabled=true"> -->
100   </FORM>
101
102 <? } ?>
103   
104 <? include('elements/menu_footer.php'); ?>
105 <? include('elements/footer.php'); ?>