| Server IP : 104.21.37.246 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/taladonnuch.com/cart/ |
Upload File : |
<?php
$detailproduct_mpay = 'hom' . $detailproduct_mpay;
$from_w = 'homhuan';
$orderId_mpay = '01'.$Oid_id;
$datetime = date("Y-m-d H:i:s");
$list = array(
'table'=>'requestpayment',
'id_order'=>"'".$Oid_id."'",
'id_order_mapy'=>"'".$orderId_mpay."'",
'Pmid'=>"'".$pmid."'",
'amount'=>"'".$amount."'",
'detail'=>"'".$detailproduct_mpay."'",
'createdate'=>"'".$datetime."'"
);
$addrequestpayment = $actiondata_db->add_db($list);
$orderId = trim('01'.$Oid_id);
$purchaseAmt = trim($amount);
$productDesc = trim($detailproduct_mpay);
$redirectUrl = 'http://homhuan.com';
$projectCode = 'TEPS';
$command = 'RequestOrderTepsApi';
$sid = 'BYNdPdnQCrkEohIFZhrePQ%3D%3D'; //'tVxUW8P%2F5bcEohIFZhrePQ%3D%3D';
$merchantId= '9708';//'7545';
//$redirectUrl = 'http://pay.onnud20.com/payment/test_resmpay.php';
$currency = 'THB';
$smsFlag = 'N';
$smsMobile = 'N';
$orderId = trim($orderId_mpay);
$purchaseAmt = trim($amount);
$productDesc = trim($detailproduct_mpay);
$integrityStr = hash('SHA256', $sid.$merchantId.$orderId.$purchaseAmt.'SaltTEPS');
$list = array(
'table'=>'request_mpay',
'orderId'=>"'".$orderId."'",
'purchaseAmt'=>"'".$purchaseAmt."'",
'productDesc'=>"'".$productDesc."'",
'projectCode'=>"'".$projectCode."'",
'command'=>"'".$command."'",
'sid'=>"'".$sid."'",
'merchantId'=>"'".$merchantId."'",
'currency'=>"'".$currency."'",
'paymentMethod'=>"'".$paymentMethod."'",
'integrityStr'=>"'".$integrityStr."'",
'smsFlag'=>"'".$smsFlag."'",
'smsMobile'=>"'".$smsMobile."'",
'redirectUrl'=>"'".$redirectUrl."'",
'from_w'=>"'".$from_w."'",
'datetime'=>"'".$datetime."'"
);
$add = $actiondata_db->add_db2($list);
$postfields = array(
'projectCode' => $projectCode,
'command' => $command,
'sid' => $sid,
'redirectUrl' => $redirectUrl,
'merchantId' => $merchantId,
'orderId' => $orderId,
'currency' => $currency,
'purchaseAmt' => $purchaseAmt,
'paymentMethod' => '',
'productDesc' => $productDesc,
'integrityStr' => $integrityStr,
'smsFlag' => $smsFlag,
'smsMobile' => $smsMobile
);
foreach($postfields as $key=>$value)
{
$fields_string .= $key.'='.$value.'&';
}
$fields_string = rtrim($fields_string,'&');
//$url = "https://saichon-beauty.ais.co.th:8002/AISMPAYPartnerInterface/InterfaceService?";
$url = "https://www.mpay.co.th/AISMPAYPartnerInterface/InterfaceService";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
//curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.23 (Windows NT 5.1; U; en)');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded; charset=UTF-8'));
$result = curl_exec($ch);
$err = curl_error($result);
curl_close($curl);
//echo $result;
$xml = simplexml_load_string($result);
$list = array(
'table'=>'response_mpay',
'status'=>"'".$xml->status."'",
'respCode'=>"'".$xml->respCode."'",
'respDesc'=>"'".$xml->respDesc."'",
'saleId'=>"'".$xml->saleId."'",
'endPointUrl'=>"'".$xml->endPointUrl."'",
'datetime'=>"'".date("Y-m-d H:i:s")."'"
);
$add = $actiondata_db->add_db2($list);
//print_r($add);
if($xml->status == 'S' && $xml->respCode == '0000')
{
echo $url = urldecode($xml->endPointUrl);
/*?><meta http-equiv="refresh" content="0;URL=<?php echo $url; ?>"> <?php exit;*/
}
else
{
echo '../error/index.php';
/*?><meta http-equiv="refresh" content="0;URL=http://homhuan.com"> <?php exit;*/
}
?>