From 32dbb868e4ca59093c500537919aa5588fc2cc76 Mon Sep 17 00:00:00 2001 From: wuliangbo Date: Fri, 6 Mar 2020 16:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BD=AC=E8=B4=A6=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Payment/Close/Client.php | 39 ++++++++--------------------------- src/Payment/Fund/Client.php | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/Payment/Close/Client.php b/src/Payment/Close/Client.php index e0cffb2..abe5e0e 100755 --- a/src/Payment/Close/Client.php +++ b/src/Payment/Close/Client.php @@ -4,13 +4,13 @@ namespace EasyAlipay\Payment\Close; use EasyAlipay\Kernel\AppClient; use EasyAlipay\Kernel\AppRequest; -use EasyAlipay\Payment\Model\AlipayFundTransUniTransferContentBuilder; use EasyAlipay\Payment\Model\AlipayTradeCloseContentBuilder; class Client extends AppClient { /** - * @param array $payload + * 关闭订单 + * @param string $out_trade_no * @return \EasyAlipay\Kernel\Support\Collection * @throws \EasyAlipay\Kernel\Exceptions\BadRequestException * @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException @@ -18,37 +18,14 @@ class Client extends AppClient * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException * @throws \GuzzleHttp\Exception\GuzzleException */ - public function transfer(array $payload) + public function close(string $out_trade_no) { //构造查询业务请求参数对象 - $contentBuilder = new AlipayFundTransUniTransferContentBuilder(); - $contentBuilder->setOutBizNo($payload['out_biz_no']); - $contentBuilder->setTransAmount($payload['trans_amount']); - $contentBuilder->setIdentity($payload['identity']); - if (isset($payload['identity_type'])) { - $contentBuilder->setIdentity($payload['identity_type']); - } - if (isset($payload['name'])) { - $contentBuilder->setIdentityName($payload['name']); - } - if (isset($payload['remark'])) { - $contentBuilder->setRemark($payload['remark']); - } - if (isset($payload['biz_scene'])) { - $contentBuilder->setBizScene($payload['biz_scene']); - } - if (isset($payload['order_title'])) { - $contentBuilder->setOrderTitle($payload['order_title']); - } - if (isset($payload['original_order_id'])) { - $contentBuilder->setOriginalOrderId($payload['original_order_id']); - } - if (isset($payload['business_params'])) { - $contentBuilder->setBusinessParams($payload['business_params']); - } + $closeContentBuilder = new AlipayTradeCloseContentBuilder(); + $closeContentBuilder->setOutTradeNo($out_trade_no); $request = new AppRequest (); - $request->setBizContent($contentBuilder->getBizContent()); - $request->setApiMethodName("alipay.fund.trans.uni.transfer"); - return ($this->execute($request)); + $request->setBizContent($closeContentBuilder->getBizContent()); + $request->setApiMethodName("alipay.trade.close"); + return($this->execute($request)) ; } } diff --git a/src/Payment/Fund/Client.php b/src/Payment/Fund/Client.php index 87a6159..ba27ceb 100755 --- a/src/Payment/Fund/Client.php +++ b/src/Payment/Fund/Client.php @@ -4,13 +4,12 @@ namespace EasyAlipay\Payment\Fund; use EasyAlipay\Kernel\AppClient; use EasyAlipay\Kernel\AppRequest; -use EasyAlipay\Payment\Model\AlipayTradeCloseContentBuilder; +use EasyAlipay\Payment\Model\AlipayFundTransUniTransferContentBuilder; class Client extends AppClient { /** - * 关闭订单 - * @param string $out_trade_no + * @param array $payload * @return \EasyAlipay\Kernel\Support\Collection * @throws \EasyAlipay\Kernel\Exceptions\BadRequestException * @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException @@ -18,14 +17,37 @@ class Client extends AppClient * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException * @throws \GuzzleHttp\Exception\GuzzleException */ - public function close(string $out_trade_no) + public function transfer(array $payload) { //构造查询业务请求参数对象 - $closeContentBuilder = new AlipayTradeCloseContentBuilder(); - $closeContentBuilder->setOutTradeNo($out_trade_no); + $contentBuilder = new AlipayFundTransUniTransferContentBuilder(); + $contentBuilder->setOutBizNo($payload['out_biz_no']); + $contentBuilder->setTransAmount($payload['trans_amount']); + $contentBuilder->setIdentity($payload['identity']); + if (isset($payload['identity_type'])) { + $contentBuilder->setIdentity($payload['identity_type']); + } + if (isset($payload['name'])) { + $contentBuilder->setIdentityName($payload['name']); + } + if (isset($payload['remark'])) { + $contentBuilder->setRemark($payload['remark']); + } + if (isset($payload['biz_scene'])) { + $contentBuilder->setBizScene($payload['biz_scene']); + } + if (isset($payload['order_title'])) { + $contentBuilder->setOrderTitle($payload['order_title']); + } + if (isset($payload['original_order_id'])) { + $contentBuilder->setOriginalOrderId($payload['original_order_id']); + } + if (isset($payload['business_params'])) { + $contentBuilder->setBusinessParams($payload['business_params']); + } $request = new AppRequest (); - $request->setBizContent($closeContentBuilder->getBizContent()); - $request->setApiMethodName("alipay.trade.close"); - return($this->execute($request)) ; + $request->setBizContent($contentBuilder->getBizContent()); + $request->setApiMethodName("alipay.fund.trans.uni.transfer"); + return ($this->execute($request)); } }