eee
This commit is contained in:
@@ -4,6 +4,7 @@ namespace wchat\wx\V3;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Client;
|
use Kiri\Client;
|
||||||
|
use wchat\common\AppConfig;
|
||||||
use wchat\common\Help;
|
use wchat\common\Help;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,6 +64,29 @@ trait WxV3PaymentTait
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $orderNo
|
||||||
|
* @param AppConfig $config
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function searchByOutTradeNo(string $orderNo, AppConfig $config): array
|
||||||
|
{
|
||||||
|
$sign = $this->signature('POST', '/v3/pay/transactions/out-trade-no/' . $orderNo . '?mchid=' . $config->pay->wx->mchId, null);
|
||||||
|
|
||||||
|
$client = $this->createClient($sign, null);
|
||||||
|
$client->get('/v3/pay/transactions/out-trade-no/' . $orderNo, ['mchid' => $config->pay->wx->mchId]);
|
||||||
|
$client->close();
|
||||||
|
|
||||||
|
$json = json_decode($client->getBody(), TRUE);
|
||||||
|
if (!isset($json['prepay_id'])) {
|
||||||
|
throw new Exception('微信支付调用失败: ' . $client->getBody());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->createResponse($json, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $http_method
|
* @param string $http_method
|
||||||
* @param string $canonical_url
|
* @param string $canonical_url
|
||||||
|
|||||||
Reference in New Issue
Block a user