本文整理匯總了PHP中WxPayOrderQuery類的典型用法代碼示例。如果您正苦於以下問題:PHP WxPayOrderQuery類的具體用法?PHP WxPayOrderQuery怎麽用?PHP WxPayOrderQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了WxPayOrderQuery類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: query
/**
*
* 查詢訂單情況
* @param string $out_trade_no 商戶訂單號
* @param int $succCode 查詢訂單結果
* @return 0 訂單不成功,1表示訂單成功,2表示繼續等待
*/
public function query($out_trade_no, &$succCode)
{
$queryOrderInput = new WxPayOrderQuery();
$queryOrderInput->SetOut_trade_no($out_trade_no);
$result = WxPayApi::orderQuery($queryOrderInput);
if ($result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
//支付成功
if ($result["trade_state"] == "SUCCESS") {
$succCode = 1;
return $result;
} else {
if ($result["trade_state"] == "USERPAYING") {
$succCode = 2;
return false;
}
}
}
//如果返回錯誤碼為“此交易訂單號不存在”則直接認定失敗
if ($result["err_code"] == "ORDERNOTEXIST") {
$succCode = 0;
} else {
//如果是係統錯誤,則後續繼續
$succCode = 2;
}
return false;
}
示例2: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
// Log::DEBUG("query:" . json_encode($result));
ilog(iLOG_INFO, 'Queryorder:' . json_encode($result), __LINE__);
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
$user_trade_no = $result['out_trade_no'];
$transaction_id = $result['transaction_id'];
$info1 = 'wxapp/interface/appnotify.php,operator success,session == trade_no,ordernum:' . $user_trade_no . ',wxno:' . $transaction_id;
ilog(iLOG_INFO, $info1, __LINE__);
$body_arr['order_no'] = $user_trade_no;
$body_arr['pay_result'] = 2;
//支付成功
$body_arr['alipay_no'] = $transaction_id;
//微信流水號
$body_arr['channel'] = 'wxapp';
//
$ret = exec_procedure($body_arr, 'p_order_pay_result');
if ($ret['status'] == 0 || $ret['status'] == 1040) {
//成功,返回success
return true;
} else {
//返回錯誤碼,非success
$info = 'wxapp/interface/appnotify.php,p_order_pay_result failed';
ilog(iLOG_INFO, $info, __LINE__);
return false;
}
}
$info = 'wxapp/interface/appnotify.php,operator failed';
ilog(iLOG_INFO, $info, __LINE__);
//驗證失敗
return false;
}
示例3: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
\Log::info("query:" . json_encode($result));
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
// 處理訂單
$pay = \App\Pay::find($result['out_trade_no']);
$pay->pay($result['transaction_id']);
if ($pay->state < 2) {
$pay->state = '2';
$pay->bak_id = '0';
$pay->other_id = $result['transaction_id'];
$pay->save();
} else {
if ($pay->state == 2) {
$pay->bak_id++;
$pay->save();
}
}
return true;
}
return false;
}
示例4: queryByOutTradeNo
/**
* 查詢訂單根據out_trade_no
*/
public function queryByOutTradeNo($out_trade_no)
{
$input = new WxPayOrderQuery();
$input->setConfig($this->config);
$input->SetOut_trade_no($out_trade_no);
\Common\Api\Wxpay\WxPayApi::setConfig($this->config);
return \Common\Api\Wxpay\WxPayApi::orderQuery($input);
}
示例5: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
return true;
}
return false;
}
示例6: Queryorder
public function Queryorder($mpid, $transaction_id)
{
//\TMS_APP::M('log')->log('debug', 'pay-Queryorder', '0');
$input = new \WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = \WxPayApi::orderQuery($mpid, $input);
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
return true;
}
//\TMS_APP::M('log')->log('debug', 'pay-Queryorder', 'ok');
return false;
}
示例7: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
return true;
}
$log = Log::factory(NT_LOGS_PATH . 'wxpay_saoma/');
$log->write('wxpay_saoma_notify_orderQuery', "訂單查詢失敗\n" . json_encode($result) . "\n");
return false;
}
示例8: Queryorder
public function Queryorder($data)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($data['transaction_id']);
$input->SetTradeType($data['trade_type']);
$result = WxPayApi::orderQuery($input, Config::API_TIMEOUT);
$this->query_data = $result;
Log::DEBUG("query:" . json_encode($result));
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
return true;
}
return false;
}
示例9: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
Log::DEBUG("query:" . json_encode($result));
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
return true;
// echo "OK";
}
return false;
// echo "Fail";
}
示例10: queryOrder
private function queryOrder($out_trade_no, $inStatus = '')
{
if (isset($out_trade_no) && $out_trade_no != "") {
$input = new WxPayOrderQuery();
$input->SetOut_trade_no($out_trade_no);
$info = WxPayApi::orderQuery($input);
if ($inStatus == 'code') {
return $info['trade_state'];
}
$status = orderState($info['trade_state']);
}
return $status;
}
示例11: queryOrder
public function queryOrder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
Log::DEBUG("query:" . Tools::jsonEncode($result));
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
if (!$this->changeOrderStatus($result['out_trade_no'])) {
Log::DEBUG("change:5.更改定單狀態失敗");
}
return true;
}
return false;
}
示例12: Queryorder
public function Queryorder($transaction_id)
{
$input = new \WxPayOrderQuery();
$input->setWxPayApi($this->wxPayApi);
$input->SetTransaction_id($transaction_id);
$result = $this->wxPayApi->orderQuery($input);
// if ($this->logger) {
// $logContent = static::log_tag . " query:" . json_encode($result);
// $this->logger->log($logContent);
// }
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && array_key_exists('trade_state', $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS" && $result['trade_state'] == "SUCCESS") {
return true;
}
return false;
}
示例13: Queryorder
public function Queryorder($transaction_id)
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = WxPayApi::orderQuery($input);
Log::DEBUG("query:" . json_encode($result));
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
//支付成功後 開通相關的操作方法
require_once dirname(__FILE__) . '/../common.inc.php';
$url = $_CFG['site_domain'] . $_CFG['site_dir'] . "include/payment/respond_weixinpay.php";
$return_oid = $this->curl_file_get_contents($url, $result);
@unlink(QISHI_ROOT_PATH . 'data/wxpay/' . $return_oid . '.tmp');
return true;
}
return false;
}
示例14: orderQuery
/**
*
* 查詢訂單,WxPayOrderQuery中out_trade_no、transaction_id至少填一個
* appid、mchid、spbill_create_ip、nonce_str不需要填入
* @param WxPayOrderQuery $inputObj
* @param int $timeOut
* @throws WxPayException
* @return 成功時返回,其他拋異常
*/
public static function orderQuery($mpid, $inputObj, $timeOut = 6)
{
$wxPayConfig = new \WxPayConfig($mpid);
$url = "https://api.mch.weixin.qq.com/pay/orderquery";
//檢測必填參數
if (!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
throw new WxPayException("訂單查詢接口中,out_trade_no、transaction_id至少填一個!");
}
$inputObj->SetAppid($wxPayConfig->APPID);
//公眾賬號ID
$inputObj->SetMch_id($wxPayConfig->MCHID);
//商戶號
$inputObj->SetNonce_str(self::getNonceStr());
//隨機字符串
$inputObj->SetSign($mpid);
//簽名
$xml = $inputObj->ToXml();
$startTimeStamp = self::getMillisecond();
//請求開始時間
$response = self::postXmlCurl($xml, $url, false, $timeOut);
$result = WxPayResults::Init($mpid, $response);
self::reportCostTime($url, $startTimeStamp, $result);
//上報請求花費時間
return $result;
}
示例15: queryOrder
public function queryOrder($out_trade_no)
{
$input = new \WxPayOrderQuery();
$input->setWxPayApi($this->wxPayApi);
$input->SetOut_trade_no($out_trade_no);
$result = \WxPayApi::orderQuery($input);
/*
if(array_key_exists("return_code", $result)
&& array_key_exists("result_code", $result)
&& $result["return_code"] == "SUCCESS"
&& $result["result_code"] == "SUCCESS")
{
return true;
}
*/
return $result;
}