Source of file epaysoap.php
Size: 4,132 Bytes - Last Modified: 2021-12-23T10:42:31+00:00
/var/www/docs.ssmods.com/process/src/code/codesamples/epaysoap.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 | <?php class epaysoap { public function capture($marchantnumber, $transactionid, $amount) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['transactionid'] = $transactionid; $epay_params['amount'] = intval($amount); $result = $this->_soapcall('capture', $epay_params); return $result; } public function credit($marchantnumber, $transactionid, $amount) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['transactionid'] = $transactionid; $epay_params['amount'] = intval($amount); $result = $this->_soapcall('credit', $epay_params); return $result; } public function delete($marchantnumber, $transactionid) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['transactionid'] = $transactionid; $result = $this->_soapcall('delete', $epay_params); return $result; } public function getEpayError($marchantnumber, $epay_response_code) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['language'] = 2; $epay_params['epayresponsecode'] = $epay_response_code; $result = $this->_soapcall('getEpayError', $epay_params); $result = $result['epayresponsestring']; return $result; } public function getPbsError($marchantnumber, $pbs_response_code) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['language'] = 2; $epay_params['pbsresponsecode'] = $pbs_response_code; $result = $this->_soapcall('getPbsError', $epay_params); $result = $result['pbsresponsestring']; return $result; } public function gettransaction($marchantnumber, $transactionid) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['transactionid'] = $transactionid; $result = $this->_soapcall('gettransaction', $epay_params); return $result; } public function gettransactionInformation($marchantnumber, $transactionid) { $epay_params = array(); $epay_params['merchantnumber'] = $marchantnumber; $epay_params['transactionid'] = $transactionid; $result = $this->_soapcall('gettransaction', $epay_params); if ($result['gettransactionResult'] == true) { return $result['transactionInformation']; } else { return false; } } private function _soapcall($call, $params) { require_once(dirname(__FILE__).'/lib/nusoap.php'); $soapclient = new nusoap_client('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL', 'wsdl'); $result = $soapclient->call($call, array('parameters' => $params)); /* Debug */ //echo '<h2>Request</h2><pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>'; //echo '<h2>Response</h2><pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>'; //echo '<h2>Debug</h2><pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>'; //echo '<pre>'; print_r($result); echo '</pre>'; // Check for a fault if ($soapclient->fault) { echo '<div class="alert error"><h2>Fault</h2><pre>'; print_r($result); echo '</pre></div>'; } else { // Check for errors $err = $soapclient->getError(); if ($err) { // Display the error echo '<div class="alert error"><h2>Error</h2><pre>' . $err . '</pre></div>'; } else { return $result; } } return false; } }; |