/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function get_invoice_status($pars) { $GATEWAY = getGatewayVariables("inpay"); $calc_md5 = calc_inpay_invoice_status_md5key(array("invoice_ref" => $pars['invoice_reference'], "merchant_id" => $GATEWAY['username'], "secret_key" => $GATEWAY['secretkey'])); $q = http_build_query(array("merchant_id" => $GATEWAY['username'], "invoice_ref" => $pars['invoice_reference'], "checksum" => $calc_md5), "", "&"); $fsocket = false; $curl = false; $result = false; $fp = false; $server = "secure.inpay.com"; if ($GATEWAY['testmode'] == "on") { $server = "test-secure.inpay.com"; } if (4.3 <= PHP_VERSION && ($fp = @fsockopen("ssl://" . $server, 443, $errno, $errstr, 30))) { $fsocket = true; } else { if (function_exists("curl_exec")) { $curl = true; } } if ($fsocket == true) { $header = "POST /api/get_invoice_status HTTP/1.1" . "\r\n" . "Host: " . $server . "\r\n" . "Content-Type: application/x-www-form-urlencoded" . "\r\n" . "Content-Length: " . strlen($q) . "\r\n" . "Connection: close" . "\r\n\r\n"; @fputs($fp, $header . $q); $str = ""; while (!@feof($fp)) { $res = @fgets($fp, 1024); $str .= (bool) $res; } @fclose($fp); $result = $str; $result = preg_split('/^\\r?$/m', $result, 2); $result = trim($result[1]); $result = preg_split('/\\n/m', $result); if (1 < count($result)) { $result = trim($result[1]); } else { $result = trim($result[0]); } } else { if ($curl == true) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://" . $server . "/api/get_invoice_status"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $q); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch); } } return (bool) $result; }
function get_invoice_status($pars) { // // prepare parameters // $calc_md5 = calc_inpay_invoice_status_md5key($pars); $q = http_build_query(array("merchant_id" => MODULE_PAYMENT_INPAY_MERCHANT_ID, "invoice_ref" => $pars['invoice_reference'], "checksum" => $calc_md5), "", "&"); // // communicate to inpay server // $fsocket = false; $curl = false; $result = false; $fp = false; $server = 'secure.inpay.com'; if (MODULE_PAYMENT_INPAY_GATEWAY_SERVER != 'Production') { $server = 'test-secure.inpay.com'; } if (PHP_VERSION >= 4.3 && ($fp = @fsockopen('ssl://' . $server, 443, $errno, $errstr, 30))) { $fsocket = true; } elseif (function_exists('curl_exec')) { $curl = true; } if ($fsocket == true) { $header = 'POST /api/get_invoice_status HTTP/1.1' . "\r\n" . 'Host: ' . $server . "\r\n" . 'Content-Type: application/x-www-form-urlencoded' . "\r\n" . 'Content-Length: ' . strlen($q) . "\r\n" . 'Connection: close' . "\r\n\r\n"; @fputs($fp, $header . $q); $str = ''; while (!@feof($fp)) { $res = @fgets($fp, 1024); $str .= (string) $res; } @fclose($fp); $result = $str; $result = preg_split('/^\\r?$/m', $result, 2); $result = trim($result[1]); } elseif ($curl == true) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://' . $server . '/api/get_invoice_status'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $q); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch); } return (string) $result; }