mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-02 12:17:38 +08:00
增加查询接口
This commit is contained in:
parent
1ac3d8f188
commit
fb45a0b5e8
@ -45,6 +45,18 @@ interface GatewayInterface
|
||||
*/
|
||||
public function close(array $config_biz);
|
||||
|
||||
/**
|
||||
* 对外接口 - 订单查询
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @version 2017-08-19
|
||||
*
|
||||
* @param string $out_trade_no 商家订单号
|
||||
*
|
||||
* @return array|boolean [description]
|
||||
*/
|
||||
public function find($out_trade_no);
|
||||
|
||||
/**
|
||||
* 验证消息是否官方发出
|
||||
*
|
||||
|
@ -123,6 +123,25 @@ abstract class Alipay implements GatewayInterface
|
||||
return $this->getResult($config_biz, 'alipay.trade.close');
|
||||
}
|
||||
|
||||
/**
|
||||
* 对外接口 - 订单查询
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @version 2017-08-19
|
||||
*
|
||||
* @param string $out_trade_no 商家订单号
|
||||
*
|
||||
* @return array|boolean [description]
|
||||
*/
|
||||
public function find($out_trade_no = '')
|
||||
{
|
||||
$config_biz = [
|
||||
'out_trade_no' => $out_trade_no,
|
||||
];
|
||||
|
||||
return $this->getResult($config_biz, 'alipay.trade.query');
|
||||
}
|
||||
|
||||
/**
|
||||
* 对外接口 - 验证.
|
||||
*
|
||||
|
@ -149,7 +149,7 @@ abstract class Wechat implements GatewayInterface
|
||||
$this->config['total_fee'] = intval($this->config['total_fee'] * 100);
|
||||
$this->config['sign'] = $this->getSign($this->config);
|
||||
|
||||
$data = $this->fromXml($this->post($this->gateway, [], $this->toXml($this->config)));
|
||||
$data = $this->fromXml($this->post($this->gateway, $this->toXml($this->config)));
|
||||
|
||||
if (!isset($data['return_code']) || $data['return_code'] !== 'SUCCESS' || $data['result_code'] !== 'SUCCESS') {
|
||||
$error = 'preOrder error:' . $data['return_msg'];
|
||||
|
@ -41,24 +41,19 @@ trait HasHttpRequest
|
||||
* Make a post request.
|
||||
*
|
||||
* @param string $endpoint
|
||||
* @param array $params
|
||||
* @param string $body
|
||||
* @param mixed $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function post($endpoint, $params = [], $body = null, $headers = [])
|
||||
protected function post($endpoint, $params = [], $headers = [])
|
||||
{
|
||||
$options = [
|
||||
'headers' => $headers,
|
||||
'form_params' => $params,
|
||||
];
|
||||
$options['headers'] = $headers;
|
||||
|
||||
if (!is_null($body)) {
|
||||
$options = [
|
||||
'headers' => $headers,
|
||||
'body' => $body,
|
||||
];
|
||||
if (!is_array($params)) {
|
||||
$options['body'] = $params;
|
||||
} else {
|
||||
$options['form_params'] = $params;
|
||||
}
|
||||
|
||||
return $this->request('post', $endpoint, $options);
|
||||
|
Loading…
Reference in New Issue
Block a user