diff --git a/wchat/wx/V3/TransferBatches.php b/wchat/wx/V3/TransferBatches.php index 17910f6..3c6d4fd 100644 --- a/wchat/wx/V3/TransferBatches.php +++ b/wchat/wx/V3/TransferBatches.php @@ -13,29 +13,20 @@ class TransferBatches extends SmallProgram /** - * @param string $orderNo - * @param int $total - * @param string $openId + * @param TransferDetail $detail * @return array * @throws Exception */ #[ArrayShape(['code_url' => "string"])] - public function request(string $orderNo, int $total, string $openId): array + public function request(TransferDetail $detail): array { $body['appid'] = $this->getConfig()->getAppid(); - $body['out_trade_no'] = $orderNo; + $body['out_trade_no'] = $detail->out_detail_no; $body["batch_name"] = $this->getConfig()->getBody(); $body["batch_remark"] = $this->getConfig()->getBody(); - $body["total_amount"] = $total; + $body["total_amount"] = $detail->transfer_amount; $body["total_num"] = 1; - $body["transfer_detail_list"] = [ - [ - "out_detail_no" => $orderNo, - "transfer_amount" => $total, - "transfer_remark" => $this->getConfig()->getBody(), - "openid" => $openId, - ] - ]; + $body["transfer_detail_list"] = $detail->toArray(); $sign = $this->signature('POST', '/v3/transfer/batches', $json = json_encode($body, JSON_UNESCAPED_UNICODE));