summaryrefslogtreecommitdiff
path: root/fs_selfservice/php/process_payment_order_renew.php
blob: 20594624b6c1ea3003cd54b7fae2b1b36db13960 (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
<?php

require('freeside.class.php');
$freeside = new FreesideSelfService();

$response = $freeside->process_payment_order_renew( array( 
    'session_id' => $_POST['session_id'],
    'payby'      => 'CARD',
    'amount'     => $_POST['amount'],
    'payinfo'    => $_POST['payinfo'],
    'paycvv'     => $_POST['paycvv'],
    'month'      => $_POST['month'],
    'year'       => $_POST['year'],
    'payname'    => $_POST['payname'],
    'address1'   => $_POST['address1'],
    'address2'   => $_POST['address2'],
    'city'       => $_POST['city'],
    'state'      => $_POST['state'],
    'zip'        => $_POST['zip'],
    'save'       => $_POST['save'],
    'auto'       => $_POST['auto'],
    'paybatch'   => $_POST['paybatch'],
) );

error_log("[process_payment_order_renew] received response from freeside: $response");

$error = $response['error'];

if ( $error ) {

  error_log("[process_payment_order_renew] response error: $error");

  header('Location:order_renew.php'.
           '?session_id='. urlencode($_POST['session_id']).
           '?error='.      urlencode($error).
           '&payby=CARD'.
           '&amount='.     urlencode($_POST['amount']).
           '&payinfo='.    urlencode($_POST['payinfo']).
           '&paycvv='.     urlencode($_POST['paycvv']).
           '&month='.      urlencode($_POST['month']).
           '&year='.       urlencode($_POST['year']).
           '&payname='.    urlencode($_POST['payname']).
           '&address1='.   urlencode($_POST['address1']).
           '&address2='.   urlencode($_POST['address2']).
           '&city='.       urlencode($_POST['city']).
           '&state='.      urlencode($_POST['state']).
           '&zip='.        urlencode($_POST['zip']).
           '&save='.       urlencode($_POST['save']).
           '&auto='.       urlencode($_POST['auto']).
           '&paybatch='.   urlencode($_POST['paybatch'])
        );
  die();

}

// sucessful renewal.

$session_id = $response['session_id'];

// now what?

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <TITLE>Renew Early</TITLE>
  </HEAD>
  <BODY>
    <H1>Renew Early</H1>

    Renewal processed sucessfully.

  </BODY>
</HTML>