public function CreateOrder($msgBody, $authorId, $payType) { $now = time(); $logger = Logger::getLogger('mobilerecharge'); $logger->debug("开始创建手机充值订单({$now})"); $arrPayCard = GetPayCalcuInfo::readpaycardid($msgBody['paycardid'], $authorId); // ****** $logger->debug("正在创建手机充值订单({$now}) : paycardid(" . $msgBody['paycardid'] . "),authorId({$authorId} ),arrPayCard(" . print_r($arrPayCard, true) . ")"); $payCardId = $arrPayCard['paycardid']; // 刷卡器ID $cusId = $arrPayCard['cusid']; // 代理商ID $payfee = 0; // 利润 = 用户支付给通付宝的钱 - 通付宝从向上的进货价- 支付通道的费率 $query = "SELECT (fd_recham_paymoney - fd_recham_costmoney) AS payfee \n\t\t\t\tFROM tb_mobilerechamoney WHERE fd_recham_money = '" . $msgBody['rechargeMoney'] . "'"; $db = new DB_test(); $dataInDB = $db->get_all($query); if (is_array($dataInDB) && count($dataInDB) == 1) { $payfee = $dataInDB[0]['payfee']; $logger->debug("正在创建手机充值订单({$now}) : 用户支付给通付宝的钱 - 通付宝从向上的进货价 = ({$payfee})"); } else { $logger->error("正在创建手机充值订单({$now}) : 无法获取面额" . $msgBody['rechargeMoney'] . "元所对应的利润值"); } $payTypeFee = 0; // 转账费率 switch ($payType) { case "YiBao": $payTypeFee = YiBaoPay::GetPayFee($msgBody['payMoney']); break; case "upmp": $payTypeFee = BankPayInfoV3::GetPayFee($msgBody['payMoney']); break; } // ******** $cusfeeResult = getcusfenrun::get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], 0, $payfee, 0, date("Y-m-d"), null, null); //$cusfeeResult = getcusfenrun :: get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], $payTypeFee, $payfee, 0, date("Y-m-d"), null, null); $logger->debug("正在创建手机充值订单({$now}) : cusId({$cusId} ),cusfeeResult(" . print_r($cusfeeResult, true) . ")"); $cusfee = $cusfeeResult["cusfee"]; $cusfee = $cusfee > 0 ? $cusfee : 0; $logger->debug("正在创建手机充值订单({$now}) : 通付宝的利润({$payfee}), 代理商的利润({$cusfee})"); $orderNumber = "tfbmrc" . date("YmdHiss") . mt_rand(1000, 9999); // 创建通付宝订单号 $listno = makeorderno("mobilerechargelist", "mrclist", "mrc"); // ****** $sql = "INSERT INTO tb_mobilerechargelist(fd_mrclist_no, fd_mrclist_paycardid, fd_mrclist_cusid, \n\t\t\t\tfd_mrclist_cusfee, fd_mrclist_authorid, fd_mrclist_paydate, \n\t\t\t\tfd_mrclist_bkordernumber, fd_mrclist_sdcrid, fd_mrclist_payrq, fd_mrclist_paytypeid, \n\t\t\t\tfd_mrclist_paytype, fd_mrclist_rechamoney, fd_mrclist_bkmoney, fd_mrclist_rechaphone, \n\t\t\t\tfd_mrclist_paymoney, fd_mrclist_payfee, fd_mrclist_mobileprov, fd_mrclist_bankcardno, \n\t\t\t\tfd_mrclist_state, fd_mrclist_date, fd_mrclist_datetime) VALUES \n\t\t\t\t('{$listno}', '{$payCardId}', '{$cusId}', \n\t\t\t\t'{$cusfee}', '{$authorId}', NOW(), \n\t\t\t\t'{$orderNumber}', 3, '01', '1', \n\t\t\t\t'mobilerecharge', '" . $msgBody['rechargeMoney'] . "', '" . $msgBody['payMoney'] . "', '" . $msgBody['rechargePhone'] . "', \n\t\t\t\t'" . $msgBody['payMoney'] . "', '{$payfee}', '" . $msgBody['mobileProvince'] . "', '" . $msgBody['bankCardId'] . "', \n\t\t\t\t'0', NOW(), NOW());"; $logger->debug("正在创建手机充值订单({$now}) : ({$sql})"); $sql = auto_charset($sql, 'utf-8', 'gbk'); $db->query($sql); return $orderNumber; }
public function CreateOrder($requestBody, $authorId, $payChannel) { $logger = Logger::getLogger("transfermoney"); $logger->debug("开始创建转账付款订单"); // 调用外部函数****** $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo::readpaycardid,传入参数(" . $requestBody["cardReaderId"] . ", " . $authorId . ")"); $agentInfo = GetPayCalcuInfo::readpaycardid($requestBody["cardReaderId"], $authorId); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo::readpaycardid,返回的结果" . print_r($agentInfo, true)); // ******调用外部函数 $cardReaderId = $agentInfo["paycardid"]; // 刷卡器ID $agentId = $agentInfo["cusid"]; // 代理商ID $payChannelFee = 0; switch ($payChannel) { case "YiBao": $payChannelFee = YiBaoPay::GetPayFee($requestBody['payMoney']); break; } $orderId = "tfbtfs" . date("YmdHiss") . mt_rand(1000, 9999); // 调用外部函数****** $orderListNumber = makeorderno("transfermoneyglist", "tfmglist", "tfs"); // ******调用外部函数 $payDate = date("Y-m-d H:i:s"); $feeMoney = 0; // 调用外部函数****** $logger->debug("正在创建转账付款订单 : 调用函数getbankid,传入参数(" . $requestBody["receiveBankName"] . ")"); $receiveBankId = getbankid(u2g($requestBody["receiveBankName"])); if ($receiveBankId == "") { ErrorReponse::reponError(array("retcode" => "200", "retmsg" => "不支持的银行")); } $logger->debug("正在创建转账付款订单 : 调用函数getbankid,返回的结果" . $receiveBankId); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: readPayFee,传入参数({$authorId}, {$receiveBankId}, " . $requestBody['transferMoney'] . ", " . $requestBody['arriveId'] . ", 2, " . $requestBody["payType"] . ")"); $payChannelFeeInfo = GetPayCalcuInfo::readPayFee($authorId, $receiveBankId, $requestBody['transferMoney'], $requestBody['arriveId'], 2, $requestBody["payType"]); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: readPayFee,返回的结果" . print_r($payChannelFeeInfo, true)); if (is_array($payChannelFeeInfo)) { $feeMoney = $payChannelFeeInfo["feemoney"]; } $arriveDate = GetPayCalcuInfo::getfeedate($payDate, $payChannelFeeInfo['addday']); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: getfeedate,返回的结果" . $arriveDate); // ******调用外部函数 $query = "INSERT INTO tb_transfermoneyglist (fd_tfmglist_no, fd_tfmglist_bkordernumber, fd_tfmglist_payrq, fd_tfmglist_paycardid, fd_tfmglist_authorid, fd_tfmglist_sdcrid, fd_tfmglist_sdcrpayfeemoney, fd_tfmglist_sdcragentfeemoney, fd_tfmglist_paytype, fd_tfmglist_paydate, fd_tfmglist_payfeedirct, fd_tfmglist_fucardno, fd_tfmglist_fucardbank, \n\t\tfd_tfmglist_fucardmobile, fd_tfmglist_fucardman, \n\t\tfd_tfmglist_shoucardno, fd_tfmglist_shoucardbank, \n\t\tfd_tfmglist_shoucardman, fd_tfmglist_shoucardmobile, fd_tfmglist_sendsms, fd_tfmglist_shoucardmemo, fd_tfmglist_current, fd_tfmglist_paymoney, fd_tfmglist_payfee, fd_tfmglist_money, fd_tfmglist_feebankid, fd_tfmglist_arrivedate, fd_tfmglist_arriveid, fd_tfmglist_state) VALUES \n\t\t('{$orderListNumber}', '{$orderId}', '01', \n\t\t'{$cardReaderId}', {$authorId}, 3, {$payChannelFee}, \n\t\t0.00, '" . $requestBody["payType"] . "', '{$payDate}', 'f', \n\t\t'" . $requestBody["sendBankCardId"] . "', '" . $requestBody["sendBankName"] . "', \n\t\t'" . $requestBody["sendPhone"] . "', '" . $requestBody["sendPersonName"] . "', \n\t\t'" . $requestBody["receiveBankCardId"] . "', '" . $requestBody["receiveBankName"] . "', \n\t\t'" . $requestBody["receivePersonName"] . "', '" . $requestBody["receivePhone"] . "', 0, '', \n\t\t'RMB', " . $requestBody["transferMoney"] . ", {$feeMoney}, " . $requestBody["payMoney"] . ", {$receiveBankId}, \n\t\t'{$arriveDate}', '" . $requestBody['arriveId'] . "', '0')"; $logger->debug("新增数据进 tb_transfermoneyglist 的sql" . $query); $db = new DB_test(); $db->query(u2g($query)); return $orderId; }
function RechaMoneyRq() { global $weburl; $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $paytype = 'qqrecharge'; $paycardid = trim($arr_body['paycardid']); $paytypeid = trim($arr_body['rechapaytypeid']); //支付类型id $rechamoney = trim($arr_body['rechamoney']); //充值金额 $rechapaymoney = trim(u2g($arr_body['rechapaymoney'])); //实际支付金额 $rechaqq = trim(u2g($arr_body['rechaqq'])); //充值手机号码 $qqhasrechamoney = $this->readQQhasRechamoney($rechaqq); $allqqremoney = $qqhasrechamoney + $rechamoney; if ($allqqremoney > 5000) { $retcode = "200"; $arr_msg['msgbody']['result'] = "failure"; $arr_msg['msgbody']['message'] = "对不起,每个QQ号码每天累计充值Q币数不能大于5000!"; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; } $rechaqqprov = trim($arr_body['rechaqqprov']); //手机所属地区 $rechabkcardno = trim(u2g($arr_body['rechabkcardno'])); //银行卡号 $rechabkcardid = trim($arr_body['rechabkcardid']); //银行卡关联id tb_banckcard.fd_bankcard_id $merReserved = trim(u2g($arr_body['merReserved'])); //认证信息 // $current = trim($arr_body['current']); //币种 // $paycardid = trim(GetPayCalcuInfo::readpaycardid($paycardid)); //刷卡器设备号 $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardid'], $authorid); //刷卡器设备号 $paycardid = $arr_paycard['paycardid']; //刷卡器id $cusid = trim($arr_paycard['cusid']); //代理商 $paycardkey = trim($arr_paycard['paycardkey']); //刷卡器key //$feebankid = getbankid($shoucardbank); //获得银行id返回string $onepayfee = $this->readRechacostmoney($rechamoney); $payfee = $onepayfee * $rechamoney; //金额也就是数量 $bkmoney = $rechapaymoney; $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $bkmoney, $rechabkcardno); $bkntno = trim($arr_bkinfo['bkntno']); $sdcrid = trim($arr_bkinfo['sdcrid']); $sdcrpayfee = substr($arr_bkinfo['sdcrpayfee'], 0, -1); //银联收取明盛浮动费率 $sdcrpayfeemoney = $bkmoney * $sdcrpayfee / 100 > $arr_bkinfo['minsdcrpayfee'] ? $bkmoney * $sdcrpayfee / 100 : $arr_bkinfo['minsdcrpayfee']; $paydate = date("Y-m-d H:i:s"); $today = date("Ymd"); //$bkmoney = $bkorderNumber = trim($arr_bkinfo['bkorderNumber']); $listno = makeorderno("qqrechargelist", "mrclist", "mrc"); $datadetailArray['fd_mrclist_no'] = $listno; $datadetailArray['fd_mrclist_paycardid'] = $paycardid; $datadetailArray['fd_mrclist_authorid'] = $authorid; $datadetailArray['fd_mrclist_bkntno'] = $bkntno; $datadetailArray['fd_mrclist_paydate'] = $paydate; $datadetailArray['fd_mrclist_payrq'] = '01'; //刚请求的交易码状态为01 $datadetailArray['fd_mrclist_paytypeid'] = $paytypeid; //手机充值支付类型 跟paytype 无任何关系 $datadetailArray['fd_mrclist_paytype'] = $paytype; //业务类型 $datadetailArray['fd_mrclist_bkordernumber'] = $bkorderNumber; $datadetailArray['fd_mrclist_sdcrpayfeemoney'] = $sdcrpayfeemoney; $datadetailArray['fd_mrclist_sdcrid'] = $sdcrid; $datadetailArray['fd_mrclist_rechamoney'] = $rechamoney; $datadetailArray['fd_mrclist_bkmoney'] = $bkmoney; $datadetailArray['fd_mrclist_qq'] = $rechaqq; $datadetailArray['fd_mrclist_paymoney'] = $rechapaymoney; $datadetailArray['fd_mrclist_payfee'] = $payfee; $datadetailArray['fd_mrclist_qqprov'] = u2g($rechaqqprov); $datadetailArray['fd_mrclist_bankcardno'] = $rechabkcardno; $datadetailArray['fd_mrclist_bankcardid'] = $rechabkcardid; $datadetailArray['fd_mrclist_bankcardbank'] = $rechabkcardname; $datadetailArray['fd_mrclist_date'] = $today; $datadetailArray['fd_mrclist_datetime'] = $paydate; $datadetailArray['fd_mrclist_cusid'] = $cusid; $db->insert("tb_qqrechargelist", $datadetailArray); $listid = $db->insert_id(); //$listid = $db->insert_id(); // $method = 'in'; // $method = u2g($method); //$gettrue = AgentPayglist :: insertPayglist($this->reqxmlcontext, $bkntno, $listid, $ccgno, $paytype, $method, $arr_feeinfo); $arr_message = array("result" => "success", "message" => "请求交易码成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = $bkntno; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function createOrder() { $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $authorid = trim($this->arr_channelinfo['authorid']); $arr_body = $this->arr_body; $gameId = trim($arr_body['gameId']); $gameName = trim($arr_body['gameName']); $gameName = auto_charset($gameName, 'utf-8', 'gbk'); $area = trim($arr_body['area']); $area = auto_charset($area, 'utf-8', 'gbk'); $server = trim($arr_body['server']); $server = auto_charset($server, 'utf-8', 'gbk'); $price = trim($arr_body['price']); $cost = trim($arr_body['cost']); $quantity = trim($arr_body['quantity']); $userCount = trim($arr_body['userCount']); $paycardid = trim($arr_body['paycardid']); $rechabkcardno = trim($arr_body['rechabkcardno']); if ($authorid == "" || $gameId == "" || $gameName == "" || $price == "" || $cost == "" || $quantity == "" || $userCount == "" || $rechabkcardno == "") { $arr_message = array("result" => "fail", "message" => "输入信息不完整"); } else { $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $price, $rechabkcardno); $bkntno = trim($arr_bkinfo['bkntno']); $bkorderNumber = trim($arr_bkinfo['bkorderNumber']); $sdcrid = trim($arr_bkinfo['sdcrid']); $arr_paycard = GetPayCalcuInfo::readpaycardid($paycardid, $authorid); $paycardid = $arr_paycard['paycardid']; $cusid = trim($arr_paycard['cusid']); $paycardkey = trim($arr_paycard['paycardkey']); $payfee = $price - $cost - $price * 0.008; $datadetailArray['fd_grclist_payfee'] = $payfee; $datadetailArray['fd_grclist_cusid'] = $cusid; $datadetailArray['fd_grclist_paycardid'] = $paycardid; $datadetailArray['fd_grclist_authorid'] = $authorid; $datadetailArray['fd_grclist_paydate'] = date("Ymd"); $datadetailArray['fd_grclist_bkntno'] = $bkntno; $datadetailArray['fd_grclist_bkordernumber'] = $bkorderNumber; $datadetailArray['fd_grclist_sdcrid'] = $sdcrid; $datadetailArray['fd_grclist_rechamoney'] = $price; $datadetailArray['fd_grclist_bkmoney'] = $price; $datadetailArray['fd_grclist_paymoney'] = $price; $datadetailArray['fd_grclist_gamecardid'] = $gameId; $datadetailArray['fd_grclist_gamename'] = $gameName; $datadetailArray['fd_grclist_gamecardnum'] = $quantity; $datadetailArray['fd_grclist_gameuserid'] = $userCount; $datadetailArray['fd_grclist_gamearea'] = $area; $datadetailArray['fd_grclist_gamesrv'] = $server; $datadetailArray['fd_grclist_bankcardno'] = $rechabkcardno; $datadetailArray['fd_grclist_state'] = 0; $datadetailArray['fd_grclist_datetime'] = date("Y-m-d H:i:s"); $db = new DB_test(); $db->insert("tb_gamerechargelist", $datadetailArray); $arr_message = array("result" => "success", "message" => "订单建立成功"); $retcode = "0"; $arr_msg['msgbody']['bkntno'] = $bkntno; $arr_msg['msgbody']['totalPrice'] = $price; } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function payCardCheck() { global $arr_limitauthorid; $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $paycardkey = $arr_body['paycardkey']; $authorid = $arr_channelinfo['authorid']; /*2014-06-18 取消商户对刷卡器的限制 */ $paycardkey = strtolower($paycardkey); $paycardkey = str_replace("fff", "", $paycardkey); //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardkey'])); //刷卡器设备号 $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardkey'], $authorid); //刷卡器设备号 $paycardid = $arr_paycard['paycardid']; //刷卡器id $cusid = trim($arr_paycard['cusid']); //代理商 $paycardkey = trim($arr_paycard['paycardkey']); //刷卡器key AgentPayglist::savePayCardinfo($paycardid); //保存最新刷卡时间 $arr_message = array("result" => "success", "message" => "刷卡器检验成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); /*---end --- */ $query = "select fd_paycard_authorid as pauthorid from tb_paycard where fd_paycard_key = '{$paycardkey}' "; $arr_authid = $db->get_one($query); // if(in_array($authorid, $arr_limitauthorid)) // { // if($arr_authid['pauthorid']!=$authorid && $arr_authid['pauthorid']>0) // { // $Error = array ( // 'result' => 'failure', // 'retcode' => '200', // 'retmsg' => '该刷卡器已被其他商户使用,您不允许使用!' // ); // $this->ErrorReponse->reponError($Error); //出错反馈 // exit; // // } // } $query = "select fd_paycard_id,fd_paycard_active,fd_paycard_posstate from tb_paycard where fd_paycard_key = '{$paycardkey}' "; $db->query($query); //echo $query; if ($db->nf()) { $db->next_record(); $paycardid = $db->f(fd_paycard_id); $posstate = $db->f(fd_paycard_posstate); //0 停用 1 警告 2启用 3 冻结 $paycardactive = $db->f(fd_paycard_active); //0 停用 1 警告 2启用 3 冻结 if ($paycardactive == 0) { $arr_message = array("result" => "failure", "message" => "请先激活刷卡器!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } else { $arr_message = array("result" => "success", "message" => "刷卡器检验成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } if ($posstate == '3' || $posstate == '0') { $arr_message = array("result" => "failure", "message" => "该刷卡器被冻结或者停用!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } } else { $arr_message = array("result" => "failure", "message" => "刷卡失败,请先激活刷卡器!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 if (!in_array($authorid, $arr_limitauthorid)) { $arr_message = array("result" => "success", "message" => "刷卡器验证通过!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function couponSale() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = $arr_channelinfo['authorid']; $couponid = trim($arr_body['couponid']); $paymoney = trim($arr_body['couponmoney']); //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid'])); $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardid'], $authorid); //刷卡器设备号 $paycardid = $arr_paycard['paycardid']; //刷卡器id $cusid = trim($arr_paycard['cusid']); //代理商 $paycardkey = trim($arr_paycard['paycardkey']); //刷卡器key $fucardno = trim($arr_body['creditcardno']); $fubank = trim(u2g($arr_body['creditbank'])); $fucardman = trim(u2g($arr_body['creditcardman'])); $fucardphone = trim(u2g($arr_body['creditcardphone'])); $paytype = 'coupon'; $req_appenv = trim($arr_header['req_appenv']); // echo "fdf"; $checkbankinfo = $this->checkshoubankinfo($authorid, $req_appenv); //检测我的银行卡信息有没填写 $arr_feeinfo = GetPayCalcuInfo::readPayFee($authorid, "", $paymoney, "", 5); //获取手续费信息返回array if (is_array($arr_feeinfo)) { $feemoney = $arr_feeinfo['feemoney']; } $allmoney = round($paymoney + $feemoney, 2); $arr_arrive = GetPayCalcuInfo::readarrive($arr_feeinfo['arriveid']); $paydate = date("Y-m-d H:i:s"); $arrivedate = GetPayCalcuInfo::getfeedate($paydate, $arr_feeinfo['addday']); $payfeedirct = $arr_feeinfo['defeedirct']; if ($arr_feeinfo['defeedirct'] == 's') { $bkmoney = $paymoney; } else { $bkmoney = $allmoney; } $arr_feeinfo['arrivedate'] = $arrivedate; $arr_feeinfo['paydate'] = $paydate; $arr_feeinfo['bkmoney'] = $bkmoney; $arr_feeinfo['payfeedirct'] = $payfeedirct; $payfee = $feemoney; $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $paymoney, $fucardno); $arr_authorinfo = AuToken::getauthorusername($authorid); $arr_feeinfo['shoucardno'] = $shoucardno = $arr_authorinfo['shoucardno']; $arr_feeinfo['shoucardmobile'] = $shoucardmobile = $arr_authorinfo['shoucardmobile']; $arr_feeinfo['shoucardbank'] = $shoucardbank = $arr_authorinfo['shoucardbank']; $arr_feeinfo['shoucardman'] = $shoucardman = $arr_authorinfo['shoucardman']; $bkntno = trim($arr_bkinfo['bkntno']); $arr_feeinfo['bkordernumber'] = $bkordernumber = $arr_bkinfo['bkorderNumber']; $arr_feeinfo['bkmoney'] = $bkmoney = $paymoney; $arr_feeinfo['sdcrid'] = $sdcrid = trim($arr_bkinfo['sdcrid']); $sdcrpayfee = substr($arr_bkinfo['sdcrpayfee'], 0, -1); //银联收取明盛浮动费率 $arr_feeinfo['sdcrpayfeemoney'] = $sdcrpayfeemoney = $bkmoney * $sdcrpayfee / 100 > $arr_bkinfo['minsdcrpayfee'] ? $bkmoney * $sdcrpayfee / 100 : $arr_bkinfo['minsdcrpayfee']; $ccgno = makeorderno("couponsale", "couponsale", "cps"); $query = "insert into tb_couponsale\n\t\t\t\t\t(fd_couponsale_no\t,\tfd_couponsale_bkntno\t,\tfd_couponsale_couponno\t,\n\t\t\t\t\tfd_couponsale_paycardid,fd_couponsale_authorid ,\tfd_couponsale_money,\n\t\t\t\t\tfd_couponsale_rebuy,\tfd_couponsale_state,\t\tfd_couponsale_datetime,\n\t\t fd_couponsale_couponid,\tfd_couponsale_payrq,\t\tfd_couponsale_creditcardno,\n\t\t fd_couponsale_creditcardbank,fd_couponsale_creditcardman,fd_couponsale_creditcardphone," . "fd_couponsale_bkordernumber,fd_couponsale_sdcrid, fd_couponsale_sdcrpayfeemoney," . "fd_couponsale_paymoney , fd_couponsale_payfee , fd_couponsale_bkmoney ," . "fd_couponsale_shoucardno,fd_couponsale_shoucardman,fd_couponsale_shoucardbank," . "fd_couponsale_shoucardmobile\n\t\t )values\n\t\t\t\t\t('{$ccgno}'\t\t\t,\t'{$bkntno}'\t\t\t\t,\t'{$bkorderNumber}',\n\t\t\t\t\t'{$paycardid}'\t\t,\t'{$authorid}'\t\t\t\t,\t'{$paymoney}',\n\t\t\t\t\t'0'\t\t\t\t\t,\t'0'\t\t\t\t\t\t,\t now()\t\t ,\n\t\t\t\t\t'{$couponid}'\t\t\t,\t'01' \t\t\t\t\t, '{$fucardno}',\n\t\t\t\t\t'{$fubank}' , '{$fucardman}' , '{$fucardphone}' , " . "'{$bkordernumber}' , '{$sdcrid}' , '{$sdcrpayfeemoney}'," . "'{$paymoney}' , '{$payfee}' , '{$bkmoney}' ," . "'{$shoucardno}' , '{$shoucardman}' , '{$shoucardbank}' ," . "'{$shoucardmobile}' ) "; $db->query($query); $listid = $db->insert_id(); $method = 'in'; $method = u2g($method); $gettrue = AgentPayglist::insertPayglist($this->reqxmlcontext, $bkntno, $listid, $ccgno, $paytype, $method, $arr_feeinfo); $arr_message = array("result" => "success", "message" => "获取交易码成功,可以去刷卡支付了!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = trim($bkntno); $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public static function getfeedate($now, $n) { $diff = strtotime($now) + $n * 86400; $dayweek = date("w", $diff); if ($dayweek == "6") { $res = date("Y-m-d", $diff + 172800); } elseif ($dayweek == "0") { $res = date("Y-m-d", $diff + 86400); } else { $res = date("Y-m-d", $diff); $computeWeek = GetPayCalcuInfo::computeWeek($now, $res); if ($computeWeek > 0) { $res = strtotime($res) + $computeWeek * 172800; $dayweek2 = date("w", $res); if ($dayweek2 == "6") { $res = date("Y-m-d", $res + 172800); } elseif ($dayweek2 == "0") { $res = date("Y-m-d", $res + 86400); } else { $res = date("Y-m-d", $res); } } else { $res = date("Y-m-d", $diff); } } //echo $res; return $res; }
function payagentOrderRq() { global $weburl; $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $agentid = trim($arr_channelinfo['agentid']); $paytype = 'agentbuy'; $orderprodureid = trim($arr_body['orderprodureid']); //支付类型id $ordernum = trim($arr_body['ordernum']); //充值金额 $orderprice = trim(u2g($arr_body['orderprice'])); //实际支付金额 $ordermoney = trim(u2g($arr_body['ordermoney'])); //订单金额 $orderfucardno = trim(u2g($arr_body['orderfucardno'])); //认证信息 $orderfucardbank = trim(u2g($arr_body['orderfucardbank'])); //认证信息 $ordermemo = trim(u2g($arr_body['ordermemo'])); //认证信息 $agentno = trim(u2g($arr_body['agentno'])); //认证信息 $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardid'], $authorid); //刷卡器设备号 $paycardid = $arr_paycard['paycardid']; //刷卡器id $cusid = trim($arr_paycard['cusid']); //代理商 $ordermemo = "自订刷卡器" . $ordernum; $bkmoney = $ordermoney; //promoney+yunmoney $paymoney = $ordermoney; $listno = makeorderno("salelist", "selt", "xs"); $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $bkmoney, $orderfucardno); $bkntno = trim($arr_bkinfo['bkntno']); $sdcrid = trim($arr_bkinfo['sdcrid']); $datetime = date("Y-m-d H:i:s"); $date = date("Y-m-d"); $bkorderNumber = trim($arr_bkinfo['bkorderNumber']); $type = "app"; //自订 $datadetailArray['fd_selt_paytype'] = $paytype; $datadetailArray['fd_selt_no'] = $listno; $datadetailArray['fd_selt_authorid'] = $authorid; $datadetailArray['fd_selt_bkntno'] = $bkntno; $datadetailArray['fd_selt_date'] = $date; $datadetailArray['fd_selt_payrq'] = '01'; //刚请求的交易码状态为01 $datadetailArray['fd_selt_bkordernumber'] = $bkorderNumber; $datadetailArray['fd_selt_sdcrid'] = $sdcrid; $datadetailArray['fd_selt_produreid'] = $orderprodureid; $datadetailArray['fd_selt_allquantity'] = $ordernum; $datadetailArray['fd_selt_saleprice'] = $orderprice; $datadetailArray['fd_selt_fucardno'] = $orderfucardno; $datadetailArray['fd_selt_fucardbank'] = $orderfucardbank; $datadetailArray['fd_selt_memo'] = u2g($ordermemo); $datadetailArray['fd_selt_datetime'] = $datetime; $datadetailArray['fd_selt_cusid'] = $agentid; //代理商id $datadetailArray['fd_selt_paymoney'] = $paymoney; //代理商id $datadetailArray['fd_selt_authorid'] = $authorid; //代理商id $datadetailArray['fd_selt_type'] = $type; $datadetailArray['fd_selt_skfs'] = '5'; //在线支付 $db->insert("tb_salelist", $datadetailArray); $listid = $db->insert_id(); $arr_message = array("result" => "success", "message" => "请求交易码成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = $bkntno; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function SuptransferMoneyRq() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $paymoney = trim($arr_body['paymoney']); $shoucardno = trim($arr_body['shoucardno']); //收款卡号 $shoucardmobile = trim($arr_body['shoucardmobile']); //收款人手机 $shoucardman = trim(u2g($arr_body['shoucardman'])); //收款人姓名 $shoucardbank = trim(u2g($arr_body['shoucardbank'])); //收款银行 $fucardno = trim($arr_body['fucardno']); //付款卡号 $fucardbank = trim(u2g($arr_body['fucardbank'])); //付款银行 $fucardmobile = trim($arr_body['fucardmobile']); //付款人手机 $fucardman = trim(u2g($arr_body['fucardman'])); //付款人姓名 $current = trim($arr_body['current']); //币种 //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid'])); //刷卡器设备号 $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardid'], $authorid); //刷卡器设备号 $paycardid = $arr_paycard['paycardid']; //刷卡器id $cusid = trim($arr_paycard['cusid']); //代理商 $paycardkey = trim($arr_paycard['paycardkey']); //刷卡器key $payfee = trim($arr_body['payfee']); //authorid $money = trim($arr_body['money']); //币种 $shoucardmemo = trim(u2g($arr_body['shoucardmemo'])); //刷卡器设备号 $sendsms = trim($arr_body['sendsms']); //authorid $arriveid = trim($arr_body['arriveid']); //币种 $paytype = 'suptfmg'; $feebankid = getbankid($shoucardbank); //获得银行id返回string CheckPayQuota::readPayQuota($authorid, $paycardid, $paytype, $paymoney); //调用判断额度使用情况 $arr_feeinfo = GetPayCalcuInfo::readPayFee($authorid, $feebankid, $paymoney, $arriveid, 2, $paytype); //获取手续费信息返回array if (is_array($arr_feeinfo)) { $feemoney = $arr_feeinfo['feemoney']; } $paydate = date("Y-m-d H:i:s"); $arrivedate = GetPayCalcuInfo::getfeedate($paydate, $arr_feeinfo['addday']); $allmoney = round($paymoney + $feemoney, 2); $payfeedirct = $arr_feeinfo['defeedirct']; if ($arr_feeinfo['defeedirct'] == 's') { $bkmoney = $paymoney; } else { $bkmoney = $allmoney; } $arr_feeinfo['arrivedate'] = $arrivedate; $arr_feeinfo['paydate'] = $paydate; $arr_feeinfo['bkmoney'] = $bkmoney; $arr_feeinfo['payfeedirct'] = $payfeedirct; $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $bkmoney, $fucardno); $bkntno = trim($arr_bkinfo['bkntno']); $arr_feeinfo['sdcrid'] = $sdcrid = trim($arr_bkinfo['sdcrid']); $sdcrpayfee = substr($arr_bkinfo['sdcrpayfee'], 0, -1); //银联收取明盛浮动费率 $arr_feeinfo['sdcrpayfeemoney'] = $sdcrpayfeemoney = $bkmoney * $sdcrpayfee / 100 > $arr_bkinfo['minsdcrpayfee'] ? $bkmoney * $sdcrpayfee / 100 : $arr_bkinfo['minsdcrpayfee']; $arr_feeinfo['bkordernumber'] = $bkorderNumber = $arr_bkinfo['bkorderNumber']; $ccgno = makeorderno("transfermoneyglist", "tfmglist", "tfs"); $query = "insert into tb_transfermoneyglist(\n\t\t\t\t\t\t\tfd_tfmglist_no\t\t\t,fd_tfmglist_paycardid\t\t,fd_tfmglist_authorid\t,\n\t\t\t\t fd_tfmglist_paydate\t\t,fd_tfmglist_shoucardno\t\t,fd_tfmglist_fucardno\t,\n\t\t\t\t fd_tfmglist_bkntno\t\t,fd_tfmglist_payrq ,fd_tfmglist_paytype ,\n\t\t\t\t fd_tfmglist_current\t\t,fd_tfmglist_paymoney\t\t,fd_tfmglist_payfee\t\t ,\n\t\t\t\t fd_tfmglist_money\t\t,fd_tfmglist_shoucardbank ,fd_tfmglist_shoucardman ,\n\t\t\t\t fd_tfmglist_shoucardmobile,fd_tfmglist_fucardbank\t,fd_tfmglist_fucardmobile,\n\t\t\t\t fd_tfmglist_fucardman ,fd_tfmglist_feebankid ,fd_tfmglist_state ,\t\n\t\t\t\t fd_tfmglist_shoucardmemo,fd_tfmglist_sendsms ,fd_tfmglist_arriveid , \t\n\t\t\t\t fd_tfmglist_arrivedate ,fd_tfmglist_payfeedirct ,fd_tfmglist_bkordernumber," . "fd_tfmglist_sdcrid,fd_tfmglist_sdcrpayfeemoney)values\n\t\t\t\t\t\t ('{$ccgno}'\t\t,'{$paycardid}'\t,'{$authorid}'\t\t,\n\t\t\t\t\t\t '{$paydate}'\t\t,'{$shoucardno}'\t,'{$fucardno}'\t\t,\n\t\t\t\t\t\t '{$bkntno}'\t\t,'01'\t\t\t,'{$paytype}'\t\t\t,\n\t\t\t\t\t\t '{$current}'\t\t,'{$paymoney}'\t,'{$feemoney}'\t\t\t,\n\t\t\t\t\t\t '{$allmoney}'\t\t\t,'{$shoucardbank}','{$shoucardman}'\t\t,\n\t\t\t\t\t\t '{$shoucardmobile}','{$fucardbank}'\t,'{$fucardmobile}'\t,\n\t\t\t\t\t\t '{$fucardman}'\t\t,'{$feebankid}'\t,'0'\t\t\t\t,\n\t\t\t\t\t\t '{$shoucardmemo}'\t,'{$feebankid}' ,'{$arriveid}' , " . "'{$arrivedate}' ,'{$payfeedirct}' ,'{$bkorderNumber}' ,'{$sdcrid}' ,'{$sdcrpayfeemoney}' )"; $db->query($query); $listid = $db->insert_id(); //$listid = $db->insert_id(); $method = 'in'; $method = u2g($method); $gettrue = AgentPayglist::insertPayglist($this->reqxmlcontext, $bkntno, $listid, $ccgno, $paytype, $method, $arr_feeinfo); $arr_message = array("result" => "success", "message" => "获取成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = $bkntno; $arr_msg['msgbody']['feemoney'] = $feemoney; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function submitOrder() { $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $logger = Logger::getLogger('utility'); $logger->debug("start submitOrder"); $authorid = trim($this->arr_channelinfo['authorid']); $arr_body = $this->arr_body; $orderid = trim($arr_body['orderid']); $paycardid = trim($arr_body['paycardid']); $rechabkcardno = trim($arr_body['rechabkcardno']); $logger->info("process submitOrder : authorid : (" . $authorid . "), orderid : (" . $orderid . "), paycardid : (" . $paycardid . "), rechabkcardno : (" . $rechabkcardno . ")"); if ($orderid != "" && $rechabkcardno != "" && $authorid != "") { $query = "SELECT fd_product_price, fd_total_price FROM tb_utility_order \n\t\t\t\t\tWHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}"; $db = new DB_test(); $result = $db->get_all($query); if ($result != 0 && count($result) > 0) { $logger->debug("process submitOrder : executing sql (" . $query . ") to get count (" . count($result) . ")"); $logger->info("process submitOrder : the bill is " . $result[0]["fd_total_bill"] / 100); $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $result[0]["fd_total_bill"] / 100, $rechabkcardno); $logger->debug("process submitOrder : get data from bankpay" . print_r($arr_bkinfo, true)); $bkntno = trim($arr_bkinfo['bkntno']); $bkorderNumber = trim($arr_bkinfo['bkorderNumber']); $arr_paycard = GetPayCalcuInfo::readpaycardid($paycardid, $authorid); $logger->debug("process submitOrder : get data from paycalcul" . print_r($arr_paycard, true)); $paycardid = $arr_paycard['paycardid']; $cusid = trim($arr_paycard['cusid']); $paycardkey = trim($arr_paycard['paycardkey']); $query = "UPDATE tb_utility_order SET fd_order_state = 2, fd_bkordernumber = '{$bkorderNumber}', fd_union_pay_number = {$bkntno}, fd_submit_time = NOW(), fd_complete_time = NOW(), fd_utility_cusid = {$cusid} WHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}"; $logger->debug("process submitOrder : executing sql (" . $query . ")"); $db->query($query); $arr_msg['msgbody']['bkntno'] = $bkntno; $retcode = "0"; $arr_message = array("result" => "success", "message" => "提交成功"); } else { $logger->error("process submitOrder : can not get any date from executing sql (" . $query . ")"); $arr_message = array("result" => "fail", "message" => "订单号异常!"); } } else { $arr_message = array("result" => "fail", "message" => "数据不完整"); } $logger->info("complete submitOrder : (" . print_r($arr_msg['msgbody'], true) . ")"); $arr_msg['msgbody']['result'] = $arr_message["result"]; $arr_msg['msgbody']['message'] = $arr_message["message"]; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }