Changeset 42 for trunk/lib/MCVE.inc.php
- Timestamp:
- Dec 18, 2005 12:16:03 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/MCVE.inc.php
r41 r42 19 19 var $connected = false; 20 20 var $conn; 21 21 22 22 function MCVE($username, $password) 23 23 { … … 28 28 } 29 29 if ('' == $username || '' == $password) { 30 30 App::logMsg(sprintf('Empty username or password provided.', null), LOG_ERR, __FILE__, __LINE__); 31 31 } 32 32 $this->username = $username; … … 39 39 return true; 40 40 } 41 41 42 42 // Initialize SSL structures and definitions. 43 43 MCVE_InitEngine($ca_bundle_file); 44 44 45 45 // Allocate Connection Structures 46 46 $this->conn = MCVE_InitConn(); 47 47 48 48 // Set Connection Method and Locations 49 49 switch ($this->connect_method) { … … 69 69 App::logMsg('Connection method not defined.', LOG_ERR, __FILE__, __LINE__); 70 70 } 71 71 72 72 // Put connection into non-blocking mode, meaning that the client must 73 73 // loop waiting for the transaction to complete. You should always specify … … 78 78 return false; 79 79 } 80 80 81 81 // Maximum of 30s per transaction allowed. Timeout occurs on server-end, not client-end 82 82 if (!MCVE_SetTimeout($this->conn, $this->timeout)) { … … 84 84 return false; 85 85 } 86 86 87 87 // Connect to MCVE, if there's an error, print the exact reason for connection failure 88 88 if (!MCVE_Connect($this->conn)) { … … 91 91 return false; 92 92 } 93 93 94 94 $this->connected = true; 95 95 } 96 96 97 97 function beginTrans() 98 98 { … … 103 103 return $tid; 104 104 } 105 105 106 106 function transParam($tid, $key, $var1, $var2=null) 107 107 { … … 111 111 return MCVE_TransParam($this->conn, $tid, $key, $var1, $var2); 112 112 } 113 113 114 114 } 115 115 116 116 function sendTrans($tid, $type='', $hide_msg=false) 117 117 { … … 121 121 return false; 122 122 } 123 124 // Perform actual communication with MCVE engine. 123 124 // Perform actual communication with MCVE engine. 125 125 // If blocking method is used, loop until transaction is complete 126 126 if ($this->blocking != 1) { … … 130 130 } 131 131 } 132 132 133 133 $ret_status = MCVE_ReturnStatus($this->conn, $tid); 134 134 $ret_code = MCVE_ReturnCode($this->conn, $tid); 135 135 $ret_text = mcve_text_code($ret_code); 136 136 $verbiage = MCVE_TransactionText($this->conn, $tid); 137 137 138 138 // Check to see if transaction was successful or not using a strict success/fail function 139 139 if ($ret_status == MCVE_FAIL) { … … 144 144 App::raiseMsg(sprintf(_("MCVE %s success: %s %s"), $type, $ret_text, ('' == $verbiage ? '' : '(' . trim($verbiage) . ')')), MSG_SUCCESS, __FILE__, __LINE__); 145 145 } 146 App::logMsg(sprintf(_("MCVE success details. Auth: %s; Batch: %s; Item: %s; TTID: %s; AVS: %s; CV: %s."), 146 App::logMsg(sprintf(_("MCVE success details. Auth: %s; Batch: %s; Item: %s; TTID: %s; AVS: %s; CV: %s."), 147 147 MCVE_TransactionAuth($this->conn, $tid), 148 148 MCVE_TransactionBatch($this->conn, $tid), … … 158 158 } 159 159 } 160 160 161 161 function disconnect($tid) 162 162 { … … 165 165 // MCVE_DestroyConn though 166 166 MCVE_DeleteTrans($this->conn, $tid); 167 167 168 168 // Clean up and close MCVE. 169 169 MCVE_DestroyConn($this->conn); 170 170 MCVE_DestroyEngine(); 171 171 172 172 $this->connected = false; 173 173 }
Note: See TracChangeset
for help on using the changeset viewer.