function MCVE_ReturnStatus(&$conn, $id)
 {
     return M_ReturnStatus($conn, $id);
 }
Exemple #2
0
/* Transaction Type */
M_TransKeyVal($conn, $identifier, "action", "admin");
M_TransKeyVal($conn, $identifier, "admin", "GUT");
echo "Sending Unsettled report request...\r\n";
/* Additional Auditing parameters may be specified
 * Please consult the Monetra Client Interface Protocol */
if (!M_TransSend($conn, $identifier)) {
    echo "Communication Error: " . M_ConnectionError($conn) . "\r\n";
    /* Free memory associated with conn */
    M_DestroyConn($conn);
    return;
}
echo "Response received\r\n";
/* We do not have to perform the M_Monitor() loop
 * because we are in blocking mode */
if (M_ReturnStatus($conn, $identifier) != M_SUCCESS) {
    echo "Audit failed\r\n";
    M_DestroyConn($conn);
    return;
}
if (!M_IsCommaDelimited($conn, $identifier)) {
    echo "Not a comma delimited response!\r\n";
    M_DestroyConn($conn);
    return;
}
/* Print the raw, unparsed data */
echo "Raw Data:\r\n" . M_GetCommaDelimited($conn, $identifier) . "\r\n";
/* Tell the API to parse the Data */
if (!M_ParseCommaDelimited($conn, $identifier)) {
    echo "Parsing comma delimited data failed";
    M_DestroyConn($conn);
 private function executeRequest($identifier)
 {
     if (!M_TransSend($this->conn, $identifier)) {
         throw new MonetraException(__('Transaction improperly structured.'));
     }
     if (M_ReturnStatus($this->conn, $identifier) === M_SUCCESS) {
         if (M_IsCommaDelimited($this->conn, $identifier)) {
             $csv_string = M_GetCommaDelimited($this->conn, $identifier);
             if ($csv_string === false) {
                 throw new MonetraException(__('Transaction does not exist or is incomplete.'));
             }
             $response = $this->parseCSVResponse($csv_string);
         } else {
             $response = $this->parseKeyValueResponse($identifier);
         }
     } else {
         $response = $this->parseKeyValueResponse($identifier);
     }
     M_DeleteTrans($this->conn, $identifier);
     return $response;
 }