addParam("parentMerchantNo", $parentMerchantNo); $request->addParam("merchantNo", $merchantNo); $request->addParam("orderId", $data['orderId']); $request->addParam("orderAmount", $data['orderAmount']); $request->addParam("timeoutExpress", $data['timeoutExpress'] ?? ''); $request->addParam("requestDate", $data['requestDate'] ?? date('Y-m-d H:i:s')); $request->addParam("redirectUrl", $data['redirectUrl'] ?? ''); $request->addParam("notifyUrl", $data['notifyUrl']); $request->addParam("goodsParamExt", $data['goodsParamExt']); $request->addParam("paymentParamExt", $data['paymentParamExt']); $request->addParam("industryParamExt", $data['industryParamExt'] ?? ''); $request->addParam("memo", $data['memo'] ?? ''); $request->addParam("riskParamExt", $data['riskParamExt'] ?? ''); $request->addParam("csUrl", $data['csUrl'] ?? ''); $request->addParam("fundProcessType", $data['fundProcessType'] ?? 'REAL_TIME'); $request->addParam("divideDetail", $data['divideDetail'] ?? ''); $request->addParam("divideNotifyUrl", $data['divideNotifyUrl'] ?? ''); $response = \YopClient3::post("/rest/v1.0/std/trade/order", $request); if($response->validSign != 1){ echo "签名验证失败!\n"; return -1; // 签名验证失败 } //取得返回结果 $ret = $this->object_array($response); $token= $ret['result']['token']; $cashter = array( "merchantNo" => $merchantNo , "token" => $token, "timestamp" => time(), "directPayType" => $data['directPayType'] ?? 'YJZF', "cardType" => $data['cardType'] ?? '', "userNo" => $data['userNo'] ?? '', "userType" => $data['userType'] ?? '', "ext" => $data['ext'] ?? '', ); // var_dump($data, $cashter); $getUrl = $this->getUrl($cashter, $privateKey); $getUrl=str_replace("×tamp","&timestamp",$getUrl); $url = "https://cash.yeepay.com/cashier/std?" . $getUrl; // echo $url; return array('url' => $url, 'data' => $ret); } public function orderQuery($data) { include 'conf.php'; $appKey = $data['appKey']; $privateKey = $data['privateKey']; $parentMerchantNo = $data['parentMerchantNo']; $merchantNo = $data['merchantNo']; $request = new \YopRequest($appKey, $privateKey); $request->addParam("parentMerchantNo", $parentMerchantNo); $request->addParam("merchantNo", $merchantNo); $request->addParam("orderId", $data['orderId']); $response = \YopClient3::post("/rest/v1.0/std/trade/orderquery", $request); if($response->validSign != 1){ return -1; // 签名验证失败 } //取得返回结果 $ret = $this->object_array($response); return $ret; } private function getString($response){ $str=""; foreach ($response as $key => $value) { $str .= $key . "=" . $value . "&"; } $getSign = substr($str, 0, strlen($str) - 1); return $getSign; } private function getUrl($response,$private_key) { $content= $this->getString($response); $sign = \YopSignUtils::signRsa($content,$private_key); $url=$content."&sign=".$sign; return $url; } private function object_array($array) { if(is_object($array)) { $array = (array)$array; } if(is_array($array)) { foreach($array as $key=>$value) { $array[$key] = $this->object_array($value); } } return $array; } public function getBank($data) { if (!$data['bankCardNo']) { return -2; // 必传参数有误 } include 'conf.php'; $request = new \YopRequest($appKey, $private_key); $request->addParam("bankCardNo", $data['bankCardNo']); $response = \YopClient3::post("/rest/v1.0/sys/merchant/query-bank-card-bin-info", $request); if($response->validSign != 1){ echo "签名验证失败!\n"; return -1; // 签名验证失败 } //取得返回结果 $data = $this->object_array($response); var_dump($data);die; $token=$data['result']['token']; $cashter = array( "merchantNo" => $merchantNo , "token" => $token, "timestamp" => time(), "directPayType" => $data['directPayType'] ?? '', "cardType" => $data['cardType'] ?? '', "userNo" => $data['userNo'] ?? '', "userType" => $data['userType'] ?? '', "ext" => $data['ext'] ?? '', ); // var_dump($data); $getUrl = $this->getUrl($cashter, $private_key); $getUrl=str_replace("×tamp","&timestamp",$getUrl); $url = "https://cash.yeepay.com/cashier/std?" . $getUrl; echo $url; return array('url' => $url, 'data' => $data); } }