Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
esec_processor_integration_interface.inc
1 <?php
25 @require_once 'HTTP/Request.php';
26 require_once dirname(__FILE__).'/esec_processor.inc';
27 
41 {
42 
43  var $_url = "https://sec.aba.net.au/cgi-bin/service/authint";
44 
45 
47  {
48  parent::Esec_Processor();
49 
50  $this->set('EPS_REDIRECT', 'false');
51  }//end constructor
52 
53 
60  function process()
61  {
62  $success = FALSE;
63 
64 
65  $response = $this->_sendRequest($errno);
66  if (!$response) {
67  // Log the error
68  $this->response['message'] = '0000 Transaction not successful. Unable get response from the service';
69  log_write($this->response['message'].'. CURL error #'.$errno , SQ_CONF_LOG_FILE_ERROR);
70 
71  return $success;
72  }
73 
74  // Expected contents in the response
75  //
76  // ref-id = referenceID
77  // auth-id = authorisationID
78  // message = message
79  // signature = signature
80  // eft-response = eftResponse
81  // txn-id = bank transaction ID
82  // settlement-date = bank settlement date
83 
84  // Parse the response string
85  $lines = explode("\n", $response);
86  foreach ($lines as $line) {
87  list($name, $value) = explode("=", $line);
88  $this->response[$name] = $value;
89  }
90 
91  // Return success for "200 success" status
92  if (substr($this->response['message'], 0, 3) == '200') {
93  $success = TRUE;
94  }
95 
96  return $success;
97 
98  }//end process()
99 
100 
109  function _sendRequest(&$errno)
110  {
111  $post_params = '';
112  foreach ($this->parameters as $name => $value) {
113  $post_params .= '&'.$name.'='.$value;
114  }
115 
116  $options = array(
117  'POST' => 1,
118  'POSTFIELDS' => $post_params,
119  'RETURNTRANSFER' => 1,
120  'SSL_VERIFYPEER' => 1,
121  'SSL_VERIFYHOST' => 2,
122  );
123  $details = fetch_url($this->_url, $options);
124  $response = $details['response'];
125  $errno = $details['errornumber'];
126 
127  return $response;
128 
129  }//end function _sendRequest()
130 
131 }//end class
132 ?>