|
|
@ -4,13 +4,13 @@ namespace EasyAlipay\Payment\Close; |
|
|
|
|
|
|
|
|
|
|
|
use EasyAlipay\Kernel\AppClient; |
|
|
|
use EasyAlipay\Kernel\AppClient; |
|
|
|
use EasyAlipay\Kernel\AppRequest; |
|
|
|
use EasyAlipay\Kernel\AppRequest; |
|
|
|
use EasyAlipay\Payment\Model\AlipayFundTransUniTransferContentBuilder; |
|
|
|
|
|
|
|
use EasyAlipay\Payment\Model\AlipayTradeCloseContentBuilder; |
|
|
|
use EasyAlipay\Payment\Model\AlipayTradeCloseContentBuilder; |
|
|
|
|
|
|
|
|
|
|
|
class Client extends AppClient |
|
|
|
class Client extends AppClient |
|
|
|
{ |
|
|
|
{ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param array $payload |
|
|
|
* 关闭订单 |
|
|
|
|
|
|
|
* @param string $out_trade_no |
|
|
|
* @return \EasyAlipay\Kernel\Support\Collection |
|
|
|
* @return \EasyAlipay\Kernel\Support\Collection |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\BadRequestException |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\BadRequestException |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException |
|
|
@ -18,37 +18,14 @@ class Client extends AppClient |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function transfer(array $payload) |
|
|
|
public function close(string $out_trade_no) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//构造查询业务请求参数对象 |
|
|
|
//构造查询业务请求参数对象 |
|
|
|
$contentBuilder = new AlipayFundTransUniTransferContentBuilder(); |
|
|
|
$closeContentBuilder = new AlipayTradeCloseContentBuilder(); |
|
|
|
$contentBuilder->setOutBizNo($payload['out_biz_no']); |
|
|
|
$closeContentBuilder->setOutTradeNo($out_trade_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 = new AppRequest (); |
|
|
|
$request->setBizContent($contentBuilder->getBizContent()); |
|
|
|
$request->setBizContent($closeContentBuilder->getBizContent()); |
|
|
|
$request->setApiMethodName("alipay.fund.trans.uni.transfer"); |
|
|
|
$request->setApiMethodName("alipay.trade.close"); |
|
|
|
return ($this->execute($request)); |
|
|
|
return($this->execute($request)) ; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|