change: close 的 API 参数只支持 array,不再支持 string (#901)

This commit is contained in:
yansongda 2023-12-22 15:33:02 +08:00 committed by GitHub
parent b2d8e0f7ee
commit 381591c0b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 11 deletions

View File

@ -8,6 +8,7 @@
- change(internal): DirectionInterface 方法由 `parse` 改为 `guide`(#896)
- change: 查询API方法由 `find` 改为 `query`,同时参数只支持 array(#897)
- change: cancel 的 API 参数只支持 array不再支持 string(#890)
- change: close 的 API 参数只支持 array不再支持 string(#891)
## v3.5.3

View File

@ -25,7 +25,7 @@ interface ProviderInterface
public function cancel(array $order): null|array|Collection;
public function close(array|string $order): null|array|Collection;
public function close(array $order): null|array|Collection;
public function refund(array $order): array|Collection;

View File

@ -83,10 +83,8 @@ class Alipay extends AbstractProvider
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function close(array|string $order): null|array|Collection
public function close(array $order): null|array|Collection
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];
Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));
return $this->__call('close', [$order]);

View File

@ -74,7 +74,7 @@ class Unipay extends AbstractProvider
/**
* @throws InvalidParamsException
*/
public function close(array|string $order): null|array|Collection
public function close(array $order): null|array|Collection
{
throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Unipay does not support close api');
}

View File

@ -84,10 +84,8 @@ class Wechat extends AbstractProvider
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function close(array|string $order): null|array|Collection
public function close(array $order): null|array|Collection
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];
Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null));
$this->__call('close', [$order]);

View File

@ -141,7 +141,7 @@ class FooProviderStub extends AbstractProvider
return new Collection();
}
public function close(array|string $order): Collection
public function close(array $order): Collection
{
return new Collection();
}

View File

@ -183,7 +183,7 @@ Q0C300Eo+XOoO4M1WvsRBAF13g9RPSw=\r
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::METHOD_NOT_SUPPORTED);
Pay::unipay()->close('foo');
Pay::unipay()->close(['foo']);
}
public function testRefund()

View File

@ -66,7 +66,7 @@ class WechatTest extends TestCase
$http->shouldReceive('sendRequest')->andReturn($response);
Pay::set(HttpClientInterface::class, $http);
Pay::wechat()->close('foo');
Pay::wechat()->close(['out_trade_no' => '123']);
self::assertTrue(true);
}