Default Changelist
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace wchat\wx\V3;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use JetBrains\PhpStorm\ArrayShape;
|
||||||
|
use Kiri\Client;
|
||||||
|
use wchat\wx\SmallProgram;
|
||||||
|
|
||||||
|
class TransferBatches extends SmallProgram
|
||||||
|
{
|
||||||
|
use WxV3PaymentTait;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $orderNo
|
||||||
|
* @param int $total
|
||||||
|
* @param string $openId
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
#[ArrayShape(['code_url' => "string"])]
|
||||||
|
public function request(string $orderNo, int $total, string $openId): array
|
||||||
|
{
|
||||||
|
$body['appid'] = $this->getConfig()->getAppid();
|
||||||
|
$body['out_trade_no'] = $orderNo;
|
||||||
|
$body["batch_name"] = $this->getConfig()->getBody();
|
||||||
|
$body["batch_remark"] = $this->getConfig()->getBody();
|
||||||
|
$body["total_amount"] = $total;
|
||||||
|
$body["total_num"] = 1;
|
||||||
|
$body["transfer_detail_list"] = [
|
||||||
|
[
|
||||||
|
"out_detail_no" => $orderNo,
|
||||||
|
"transfer_amount" => $total,
|
||||||
|
"transfer_remark" => $this->getConfig()->getBody(),
|
||||||
|
"openid" => $openId,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$sign = $this->signature('POST', '/v3/transfer/batches', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
|
$client = new Client('api.mch.weixin.qq.com', 443, TRUE);
|
||||||
|
$client->withAddedHeader('Authorization', $sign)->withContentType('application/json')
|
||||||
|
->withAgent('application/json')->withBody($json)
|
||||||
|
->post('/v3/transfer/batches');
|
||||||
|
$client->close();
|
||||||
|
|
||||||
|
return json_decode($client->getBody(), TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ namespace wchat\wx\V3;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Client;
|
use Kiri\Client;
|
||||||
use Kiri\Message\Stream;
|
|
||||||
use JetBrains\PhpStorm\ArrayShape;
|
use JetBrains\PhpStorm\ArrayShape;
|
||||||
use wchat\wx\SmallProgram;
|
use wchat\wx\SmallProgram;
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ class WxV3NativePayment extends SmallProgram
|
|||||||
|
|
||||||
$client = new Client('api.mch.weixin.qq.com', 443, TRUE);
|
$client = new Client('api.mch.weixin.qq.com', 443, TRUE);
|
||||||
$client->withAddedHeader('Authorization', $sign)->withContentType('application/json')
|
$client->withAddedHeader('Authorization', $sign)->withContentType('application/json')
|
||||||
->withAgent('application/json')->withBody(new Stream($json))
|
->withAgent('application/json')->withBody($json)
|
||||||
->post('/v3/pay/transactions/native');
|
->post('/v3/pay/transactions/native');
|
||||||
$client->close();
|
$client->close();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace wchat\wx\V3;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Client;
|
use Kiri\Client;
|
||||||
use Kiri\Message\Stream;
|
|
||||||
use wchat\wx\SmallProgram;
|
use wchat\wx\SmallProgram;
|
||||||
|
|
||||||
class WxV3Payment extends SmallProgram
|
class WxV3Payment extends SmallProgram
|
||||||
@@ -34,7 +33,7 @@ class WxV3Payment extends SmallProgram
|
|||||||
$client->withAddedHeader('Authorization', $sign)
|
$client->withAddedHeader('Authorization', $sign)
|
||||||
->withContentType('application/json')
|
->withContentType('application/json')
|
||||||
->withAddedHeader('User-Agent', 'application/json')
|
->withAddedHeader('User-Agent', 'application/json')
|
||||||
->withBody(new Stream($json))
|
->withBody($json)
|
||||||
->post('/v3/pay/transactions/jsapi');
|
->post('/v3/pay/transactions/jsapi');
|
||||||
$client->close();
|
$client->close();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class WxV3Withdrawal extends SmallProgram
|
|||||||
$client->withAddedHeader('Authorization', $sign)
|
$client->withAddedHeader('Authorization', $sign)
|
||||||
->withContentType('application/json')
|
->withContentType('application/json')
|
||||||
->withAddedHeader('User-Agent', 'application/json')
|
->withAddedHeader('User-Agent', 'application/json')
|
||||||
->withBody(new Stream($json))
|
->withBody($json)
|
||||||
->post('/v3/pay/transactions/batches');
|
->post('/v3/pay/transactions/batches');
|
||||||
$client->close();
|
$client->close();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user