Skip to content

Commit

Permalink
Merge pull request #39 from LinkedDestiny/master
Browse files Browse the repository at this point in the history
add reverse api
  • Loading branch information
kiss291323003 authored Nov 22, 2020
2 parents 7c56c07 + c3bddf7 commit 7a5c450
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/WeChat/RequestBean/Reverse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace EasySwoole\Pay\WeChat\RequestBean;


class Reverse extends Base
{
/**
* 商户订单号
* @var string
*/
protected $out_trade_no;

/**
* 微信订单号
* @var string
*/
protected $transaction_id;

public function getOutTradeNo(): string
{
return $this->out_trade_no;
}

public function setOutTradeNo(string $outTradeNo): void
{
$this->out_trade_no = $outTradeNo;
}

public function setTransactionId(string $transactionId): void
{
$this->transaction_id = $transactionId;
}

public function getTransactionId(): string
{
return $this->transaction_id;
}
}
14 changes: 14 additions & 0 deletions src/WeChat/WeChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use EasySwoole\Pay\WeChat\RequestBean\OrderFind as OrderFindRequest;
use EasySwoole\Pay\WeChat\RequestBean\RefundFind as RefundFindRequest;
use EasySwoole\Pay\WeChat\RequestBean\Close as CloseRequest;
use EasySwoole\Pay\WeChat\RequestBean\Reverse as ReverseRequest;
use EasySwoole\Pay\WeChat\RequestBean\Refund as RefundRequest;
use EasySwoole\Pay\WeChat\RequestBean\Transfer as TransferRequest;
use EasySwoole\Pay\WeChat\RequestBean\Download as DownloadRequest;
Expand Down Expand Up @@ -157,6 +158,19 @@ public function close(CloseRequest $bean): SplArray
return (new Utility($this->config))->requestApi('/pay/closeorder', $bean);
}

/**
* 撤销订单
* @param ReverseRequest $bean
* @return SplArray
* @throws GatewayException
* @throws InvalidSignException
* @throws \EasySwoole\Pay\Exceptions\InvalidArgumentException
*/
public function reverse(ReverseRequest $bean): SplArray
{
return (new Utility($this->config))->requestApi('/secapi/pay/reverse', $bean);
}

/**
* 申请退款
* @param RefundRequest $bean
Expand Down

0 comments on commit 7a5c450

Please sign in to comment.