function response($request, $class_act) { //print_r($request); exit; $pMerCode = $request["pMerCode"]; $pErrCode = $request["pErrCode"]; $pErrMsg = $request["pErrMsg"]; $p3DesXmlPara = $request["p3DesXmlPara"]; $pSign = $request["pSign"]; $signPlainText = $pMerCode . $pErrCode . $pErrMsg . $p3DesXmlPara . $this->cert_md5; $localSign = md5($signPlainText); if ($localSign == $pSign) { //echo "<br/>验签通过";exit; $Crypt3Des = new Crypt3Des(); //new 3des class $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara); //3des解密 require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($str3XmlParaInfo); $str3Req = $str3ParaInfo['pReq']; // if ($class_act == 'CreateNewAcct') { require_once APP_ROOT_PATH . 'system/collocation/ips/CreateNewAcct.php'; $user_type = CreateNewAcctCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); if ($pErrCode == 'MG00000F') { if ($user_type == 0) { showSuccess($pErrMsg, 0, url("index", "uc_center")); } else { showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } } else { showErr($pErrMsg, 0, SITE_DOMAIN . APP_ROOT, 30); } } else { if ($class_act == 'RegisterSubject') { require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterSubject.php'; RegisterSubjectCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'RegisterCreditor') { require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCreditor.php'; $ipsdata = RegisterCreditorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); if ($ipsdata) { showSuccess($pErrMsg, 0, url("index", "deal", array("id" => $ipsdata['deal_id']))); } else { showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } } else { if ($class_act == 'RegisterCretansfer') { require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCretansfer.php'; RegisterCretansferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'GuaranteeUnfreeze') { require_once APP_ROOT_PATH . 'system/collocation/ips/GuaranteeUnfreeze.php'; GuaranteeUnfreezeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'DoDpTrade') { require_once APP_ROOT_PATH . 'system/collocation/ips/DoDpTrade.php'; DoDpTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'DoDwTrade') { require_once APP_ROOT_PATH . 'system/collocation/ips/DoDwTrade.php'; DoDwTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'RegisterGuarantor') { require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterGuarantor.php'; RegisterGuarantorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } else { if ($class_act == 'RepaymentNewTrade') { require_once APP_ROOT_PATH . 'system/collocation/ips/RepaymentNewTrade.php'; $ipsdata = RepaymentNewTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); if ($ipsdata) { showSuccess($pErrMsg, 0, url("index", "uc_deal#quick_refund", array("id" => $ipsdata['deal_id']))); } else { showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } } else { if ($class_act == 'Transfer') { require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php'; $result = TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); if (intval($str3Req["pTransferType"]) == 4) { showSuccess($pErrMsg, 0, url("index", "transfer#detail", array("id" => $result['id']))); } else { showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT); } } } } } } } } } } } } else { echo "<br/>验签不通过:{$localSign}"; exit; } }
function notify($request, $class_act) { //print_r($_POST); //print_r($_GET); //print_r($_REQUEST); //print_r($request); /* if ($class_act == 'DoLoans'){ require_once(APP_ROOT_PATH.'system/collocation/baofoo/DoLoans.php'); $str3Req = array(); $str3Req['order_id'] = 17022; $str3Req['code'] = 'CSD000'; print_r(DoLoansCallBack($str3Req)); exit; }*/ $merchant_id = $this->cfg['merchant_id']; $terminal_id = $this->cfg['terminal_id']; $key = $this->cfg['key']; $iv = $this->cfg['iv']; $baofoo_log = array(); $baofoo_log['code'] = 'notify'; $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $baofoo_log['strxml'] = $class_act; $baofoo_log['html'] = print_r($_POST, true); $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log); //exit; $Md5sign = ""; if ($class_act == 'CreateNewAcct' || $class_act == 'DoDpTrade' || $class_act == 'DoDwTrade') { //Md5sign = Md5(result + ~|~ + "商户密钥") $result = $_POST["result"]; $sign = $_POST["sign"]; $Md5sign = Md5($result . '~|~' . $key); require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($result); $str3Req = $str3ParaInfo['crs']; } else { if ($class_act == 'RegisterCreditor' || $class_act == 'DoBids' || $class_act == 'DoLoans') { require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $result = $_POST["result"]; $str3ParaInfo = @XML_unserialize($result); $str3Req = $str3ParaInfo['crs']; //print_r($str3ParaInfo);exit; //Sign = MD5 ( code + ~|~ + msg + ~|~ + orderId + ~|~+商户秘钥 ); $Md5sign = Md5($str3Req['code'] . '~|~' . $str3Req['msg'] . '~|~' . $str3Req['order_id'] . '~|~' . $key); $sign = $str3Req["sign"]; } } if ($Md5sign == $sign) { //echo "<br/>验签通过";exit; // $pErrMsg = $str3Req['msg']; if ($class_act == 'CreateNewAcct') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/CreateNewAcct.php'; $user_type = CreateNewAcctCallBack($str3Req); } else { if ($class_act == 'DoDpTrade') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDpTrade.php'; DoDpTradeCallBack($str3Req); } else { if ($class_act == 'DoDwTrade') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDwTrade.php'; DoDwTradeCallBack($str3Req); } else { if ($class_act == 'RegisterCreditor') { //投资,登记债权人 require_once APP_ROOT_PATH . 'system/collocation/baofoo/RegisterCreditor.php'; $ipsdata = RegisterCreditorCallBack($str3Req); } else { if ($class_act == 'DoLoans') { //满标放款 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoLoans.php'; DoLoansCallBack($str3Req); } else { if ($class_act == 'DoBids') { //流标 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoBids.php'; DoBidsCallBack($str3Req); } } } } } } } else { echo "<br/>验签不通过"; exit; } }
function notify($request, $class_act) { $yeepay_log = array(); $yeepay_log['code'] = 'notify'; $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $yeepay_log['strxml'] = $_POST["notify"]; $yeepay_log['html'] = $_POST["sign"]; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); $resp = $_POST["resp"]; $sign = $_POST["sign"]; $localSign = $sign; //正式版本,需要加上验证; if ($localSign == $sign) { //echo "<br/>验签通过"; $Crypt3Des = new Crypt3Des(); //new 3des class $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara); //3des解密 require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($str3XmlParaInfo); $str3Req = $str3ParaInfo['pReq']; // if ($class_act == 'CreateNewAcct') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/CreateNewAcct.php'; CreateNewAcctCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); } else { if ($class_act == 'DoDpTrade') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoDpTrade.php'; DoDpTradeCallBack($str3Req); } else { if ($class_act == 'BindBankCard') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/BindBankCard.php'; BindBankCardCallBack($str3Req); } else { if ($class_act == 'DoDwTrade') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoDwTrade.php'; DoDwTradeCallBack($str3Req); } else { if ($class_act == 'DoBids') { // require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoBids.php'; DoBidsCallBack($str3Req); } else { if ($class_act == 'RegisterSubject') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterSubject.php'; RegisterSubjectCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT); } else { if ($class_act == 'RegisterCreditor') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCreditor.php'; RegisterCreditorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT); } else { if ($class_act == 'DoLoans') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/DoLoans.php'; $ipsdata = RepaymentNewTradeCallBack($str3Req); } else { if ($class_act == 'RegisterCretansfer') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCretansfer.php'; RegisterCretansferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT); } else { if ($class_act == 'RepaymentNewTrade') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RepaymentNewTrade.php'; RepaymentNewTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT); } else { if ($class_act == 'RepaymentRepayCallBack') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RepaymentNewTrade.php'; $ipsdata = RepaymentRepayCallBack($str3Req); } else { if ($class_act == 'RegisterCretansferBack') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/RegisterCretansfer.php'; RegisterCretansferBack($str3Req); } else { if ($class_act == 'Transfer') { require_once APP_ROOT_PATH . 'system/collocation/yeepay/Transfer.php'; TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req); //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT); } } } } } } } } } } } } } } else { echo "<br/>验签不通过:{$localSign}<br/>"; $Crypt3Des = new Crypt3Des(); //new 3des class $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara); //3des解密 print_r($str3XmlParaInfo); require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($str3XmlParaInfo); print_r($str3ParaInfo); exit; } }