public function request($timeOut = 6) { //检测必填参数 if (!$this->IsOut_refund_noSet() && !$this->IsOut_trade_noSet() && !$this->IsTransaction_idSet() && !$this->IsRefund_idSet()) { throw new WxPayException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!"); } $this->SetAppid($this->wxpay->appid); //公众账号ID $this->SetMch_id($this->wxpay->mchid); //商户号 $this->SetNonce_str($this->getNonceStr()); //随机字符串 $this->SetSign(); //签名 $xml = $this->ToXml(); $startTimeStamp = self::getMillisecond(); //请求开始时间 $response = self::postXmlCurl($xml, $this->url, false, $timeOut); $result = WxPayResults::Init($this->wxpay, $response); $this->reportCostTime($this->url, $startTimeStamp, $result); //上报请求花费时间 return $result; }
public function request($timeOut = 6) { if (!$this->IsLong_urlSet()) { throw new WxPayException("需要转换的URL,签名用原串,传输需URL encode!"); } $this->SetAppid($this->wxpay->appid); //公众账号ID $this->SetMch_id($this->wxpay->mchid); //商户号 $this->SetNonce_str($this->getNonceStr()); //随机字符串 $this->SetSign(); //签名 $xml = $this->ToXml(); $startTimeStamp = self::getMillisecond(); //请求开始时间 $response = self::postXmlCurl($xml, $this->url, false, $timeOut); $result = WxPayResults::Init($this->wxpay, $response); $this->reportCostTime($this->url, $startTimeStamp, $result); //上报请求花费时间 return $result; }
public function request($timeOut = 6) { //检测必填参数 if (!$this->IsOut_trade_noSet()) { throw new WxPayException("缺少统一支付接口必填参数out_trade_no!"); } else { if (!$this->IsBodySet()) { throw new WxPayException("缺少统一支付接口必填参数body!"); } else { if (!$this->IsTotal_feeSet()) { throw new WxPayException("缺少统一支付接口必填参数total_fee!"); } else { if (!$this->IsTrade_typeSet()) { throw new WxPayException("缺少统一支付接口必填参数trade_type!"); } } } } //关联参数 if ($this->GetTrade_type() == "JSAPI" && !$this->IsOpenidSet()) { throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!"); } if ($this->GetTrade_type() == "NATIVE" && !$this->IsProduct_idSet()) { throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!"); } //异步通知url未设置,则使用配置文件中的url if (!$this->IsNotify_urlSet()) { $this->SetNotify_url($this->wxpay->notifyUrl); //异步通知url } $this->SetAppid($this->wxpay->appid); //公众账号ID $this->SetMch_id($this->wxpay->mchid); //商户号 if (!$this->IsSpbill_create_ipSet()) { $this->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']); //终端ip } $this->SetNonce_str($this->getNonceStr()); //随机字符串 //签名 $this->SetSign(); $xml = $this->ToXml(); $startTimeStamp = self::getMillisecond(); //请求开始时间 $response = self::postXmlCurl($xml, $this->url, false, $timeOut); $result = WxPayResults::Init($this->wxpay, $response); $this->reportCostTime($this->url, $startTimeStamp, $result); //上报请求花费时间 if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS') { return false; } return $result; }
public function request($timeOut = 6) { //检测必填参数 if (!$this->IsBodySet()) { throw new WxPayException("提交被扫支付API接口中,缺少必填参数body!"); } else { if (!$this->IsOut_trade_noSet()) { throw new WxPayException("提交被扫支付API接口中,缺少必填参数out_trade_no!"); } else { if (!$this->IsTotal_feeSet()) { throw new WxPayException("提交被扫支付API接口中,缺少必填参数total_fee!"); } else { if (!$this->IsAuth_codeSet()) { throw new WxPayException("提交被扫支付API接口中,缺少必填参数auth_code!"); } } } } if (!$this->IsSpbill_create_ipSet()) { $this->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']); //终端ip } $this->SetAppid($this->wxpay->appid); //公众账号ID $this->SetMch_id($this->wxpay->mchid); //商户号 $this->SetNonce_str($this->getNonceStr()); //随机字符串 $this->SetSign(); //签名 $xml = $this->ToXml(); $startTimeStamp = self::getMillisecond(); //请求开始时间 $response = self::postXmlCurl($xml, $this->url, false, $timeOut); $result = WxPayResults::Init($this->wxpay, $response); $this->reportCostTime($this->url, $startTimeStamp, $result); //上报请求花费时间 return $result; }