|
@@ -74,7 +74,7 @@ class API extends AbstractAPI
|
|
|
const API_QUERY_REFUND = '/pay/refundquery';
|
|
const API_QUERY_REFUND = '/pay/refundquery';
|
|
|
const API_DOWNLOAD_BILL = '/pay/downloadbill';
|
|
const API_DOWNLOAD_BILL = '/pay/downloadbill';
|
|
|
const API_REPORT = '/payitil/report';
|
|
const API_REPORT = '/payitil/report';
|
|
|
- const api_batches = '/v3/transfer/batches';
|
|
|
|
|
|
|
+ const api_batches = '/mmpaymkttransfers/promotion/transfers';
|
|
|
|
|
|
|
|
const API_URL_SHORTEN = 'https://api.mch.weixin.qq.com/tools/shorturl';
|
|
const API_URL_SHORTEN = 'https://api.mch.weixin.qq.com/tools/shorturl';
|
|
|
const API_AUTH_CODE_TO_OPENID = 'https://api.mch.weixin.qq.com/tools/authcodetoopenid';
|
|
const API_AUTH_CODE_TO_OPENID = 'https://api.mch.weixin.qq.com/tools/authcodetoopenid';
|
|
@@ -95,7 +95,7 @@ class API extends AbstractAPI
|
|
|
/**
|
|
/**
|
|
|
* API constructor.
|
|
* API constructor.
|
|
|
*
|
|
*
|
|
|
- * @param \EasyWeChat\Payment\Merchant $merchant
|
|
|
|
|
|
|
+ * @param \EasyWeChat\Payment\Merchant $merchant
|
|
|
* @param \Doctrine\Common\Cache\Cache|null $cache
|
|
* @param \Doctrine\Common\Cache\Cache|null $cache
|
|
|
*/
|
|
*/
|
|
|
public function __construct(Merchant $merchant, Cache $cache = null)
|
|
public function __construct(Merchant $merchant, Cache $cache = null)
|
|
@@ -212,8 +212,8 @@ class API extends AbstractAPI
|
|
|
*
|
|
*
|
|
|
* @param string $orderNo
|
|
* @param string $orderNo
|
|
|
* @param string $refundNo
|
|
* @param string $refundNo
|
|
|
- * @param float $totalFee
|
|
|
|
|
- * @param float $refundFee
|
|
|
|
|
|
|
+ * @param float $totalFee
|
|
|
|
|
+ * @param float $refundFee
|
|
|
* @param string $opUserId
|
|
* @param string $opUserId
|
|
|
* @param string $type
|
|
* @param string $type
|
|
|
* @param string $refundAccount
|
|
* @param string $refundAccount
|
|
@@ -230,7 +230,8 @@ class API extends AbstractAPI
|
|
|
$type = self::OUT_TRADE_NO,
|
|
$type = self::OUT_TRADE_NO,
|
|
|
$refundAccount = 'REFUND_SOURCE_UNSETTLED_FUNDS',
|
|
$refundAccount = 'REFUND_SOURCE_UNSETTLED_FUNDS',
|
|
|
$refundReason = ''
|
|
$refundReason = ''
|
|
|
- ) {
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ {
|
|
|
$params = [
|
|
$params = [
|
|
|
$type => $orderNo,
|
|
$type => $orderNo,
|
|
|
'out_refund_no' => $refundNo,
|
|
'out_refund_no' => $refundNo,
|
|
@@ -250,8 +251,8 @@ class API extends AbstractAPI
|
|
|
*
|
|
*
|
|
|
* @param string $orderNo
|
|
* @param string $orderNo
|
|
|
* @param string $refundNo
|
|
* @param string $refundNo
|
|
|
- * @param float $totalFee
|
|
|
|
|
- * @param float $refundFee
|
|
|
|
|
|
|
+ * @param float $totalFee
|
|
|
|
|
+ * @param float $refundFee
|
|
|
* @param string $opUserId
|
|
* @param string $opUserId
|
|
|
* @param string $refundAccount
|
|
* @param string $refundAccount
|
|
|
* @param string $refundReason
|
|
* @param string $refundReason
|
|
@@ -266,7 +267,8 @@ class API extends AbstractAPI
|
|
|
$opUserId = null,
|
|
$opUserId = null,
|
|
|
$refundAccount = 'REFUND_SOURCE_UNSETTLED_FUNDS',
|
|
$refundAccount = 'REFUND_SOURCE_UNSETTLED_FUNDS',
|
|
|
$refundReason = ''
|
|
$refundReason = ''
|
|
|
- ) {
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ {
|
|
|
return $this->refund($orderNo, $refundNo, $totalFee, $refundFee, $opUserId, self::TRANSACTION_ID, $refundAccount, $refundReason);
|
|
return $this->refund($orderNo, $refundNo, $totalFee, $refundFee, $opUserId, self::TRANSACTION_ID, $refundAccount, $refundReason);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -357,10 +359,10 @@ class API extends AbstractAPI
|
|
|
* Report API status to WeChat.
|
|
* Report API status to WeChat.
|
|
|
*
|
|
*
|
|
|
* @param string $api
|
|
* @param string $api
|
|
|
- * @param int $timeConsuming
|
|
|
|
|
|
|
+ * @param int $timeConsuming
|
|
|
* @param string $resultCode
|
|
* @param string $resultCode
|
|
|
* @param string $returnCode
|
|
* @param string $returnCode
|
|
|
- * @param array $other ex: err_code,err_code_des,out_trade_no,user_ip...
|
|
|
|
|
|
|
+ * @param array $other ex: err_code,err_code_des,out_trade_no,user_ip...
|
|
|
*
|
|
*
|
|
|
* @return \EasyWeChat\Support\Collection
|
|
* @return \EasyWeChat\Support\Collection
|
|
|
*/
|
|
*/
|
|
@@ -431,10 +433,10 @@ class API extends AbstractAPI
|
|
|
* Make a API request.
|
|
* Make a API request.
|
|
|
*
|
|
*
|
|
|
* @param string $api
|
|
* @param string $api
|
|
|
- * @param array $params
|
|
|
|
|
|
|
+ * @param array $params
|
|
|
* @param string $method
|
|
* @param string $method
|
|
|
- * @param array $options
|
|
|
|
|
- * @param bool $returnResponse
|
|
|
|
|
|
|
+ * @param array $options
|
|
|
|
|
+ * @param bool $returnResponse
|
|
|
*
|
|
*
|
|
|
* @return \EasyWeChat\Support\Collection|\Psr\Http\Message\ResponseInterface
|
|
* @return \EasyWeChat\Support\Collection|\Psr\Http\Message\ResponseInterface
|
|
|
*/
|
|
*/
|
|
@@ -475,7 +477,7 @@ class API extends AbstractAPI
|
|
|
* Request with SSL.
|
|
* Request with SSL.
|
|
|
*
|
|
*
|
|
|
* @param string $api
|
|
* @param string $api
|
|
|
- * @param array $params
|
|
|
|
|
|
|
+ * @param array $params
|
|
|
* @param string $method
|
|
* @param string $method
|
|
|
*
|
|
*
|
|
|
* @return \EasyWeChat\Support\Collection
|
|
* @return \EasyWeChat\Support\Collection
|
|
@@ -503,7 +505,7 @@ class API extends AbstractAPI
|
|
|
$response = $response->getBody();
|
|
$response = $response->getBody();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return new Collection((array) XML::parse($response));
|
|
|
|
|
|
|
+ return new Collection((array)XML::parse($response));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -515,7 +517,7 @@ class API extends AbstractAPI
|
|
|
*/
|
|
*/
|
|
|
protected function wrapApi($resource)
|
|
protected function wrapApi($resource)
|
|
|
{
|
|
{
|
|
|
- return self::API_HOST.($this->sandboxEnabled ? '/sandboxnew' : '').$resource;
|
|
|
|
|
|
|
+ return self::API_HOST . ($this->sandboxEnabled ? '/sandboxnew' : '') . $resource;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -530,7 +532,7 @@ class API extends AbstractAPI
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Try to get sandbox_signkey from cache
|
|
// Try to get sandbox_signkey from cache
|
|
|
- $cacheKey = 'sandbox_signkey.'.$this->merchant->merchant_id.$this->merchant->sub_merchant_id;
|
|
|
|
|
|
|
+ $cacheKey = 'sandbox_signkey.' . $this->merchant->merchant_id . $this->merchant->sub_merchant_id;
|
|
|
|
|
|
|
|
/** @var \Doctrine\Common\Cache\Cache $cache */
|
|
/** @var \Doctrine\Common\Cache\Cache $cache */
|
|
|
$cache = $this->getCache();
|
|
$cache = $this->getCache();
|
|
@@ -565,19 +567,17 @@ class API extends AbstractAPI
|
|
|
|
|
|
|
|
public function batches(
|
|
public function batches(
|
|
|
$out_batch_no,
|
|
$out_batch_no,
|
|
|
- $batch_name,
|
|
|
|
|
- $batch_remark,
|
|
|
|
|
- $total_amount,
|
|
|
|
|
|
|
+ $open_id,
|
|
|
$total_num,
|
|
$total_num,
|
|
|
- $transfer_detail_list
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ $mark
|
|
|
|
|
+ )
|
|
|
|
|
+ {
|
|
|
$params = [
|
|
$params = [
|
|
|
- 'out_batch_no' => $out_batch_no,
|
|
|
|
|
- 'batch_name' => $batch_name,
|
|
|
|
|
- 'batch_remark' => $batch_remark,
|
|
|
|
|
- 'total_amount' => $total_amount,
|
|
|
|
|
- 'total_num' => $total_num,
|
|
|
|
|
- 'transfer_detail_list' => $transfer_detail_list,
|
|
|
|
|
|
|
+ 'partnet_trade_no' => $out_batch_no,
|
|
|
|
|
+ 'open_id' => $open_id,
|
|
|
|
|
+ 'check_name' => 'NO_CHECK',
|
|
|
|
|
+ 'amount' => $total_num,
|
|
|
|
|
+ 'desc' => $mark
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
return $this->safeRequest($this->wrapApi(self::api_batches), $params);
|
|
return $this->safeRequest($this->wrapApi(self::api_batches), $params);
|