From 026505537e38c4ba49760565710871fbfd5e2083 Mon Sep 17 00:00:00 2001 From: yansongda Date: Sat, 30 Mar 2019 12:30:49 +0800 Subject: [PATCH] update --- src/Contracts/GatewayApplicationInterface.php | 17 ++++++++++------- src/Contracts/GatewayInterface.php | 5 ++++- src/Events.php | 5 +++-- src/Exceptions/GatewayException.php | 5 +++-- src/Gateways/Alipay/AppGateway.php | 3 ++- src/Gateways/Alipay/MiniGateway.php | 14 +++++++++----- src/Gateways/Alipay/PosGateway.php | 9 ++++++--- src/Gateways/Alipay/ScanGateway.php | 9 ++++++--- src/Gateways/Alipay/TransferGateway.php | 9 ++++++--- src/Gateways/Alipay/WebGateway.php | 3 ++- src/Gateways/Wechat.php | 18 ++++++++++-------- src/Gateways/Wechat/AppGateway.php | 12 ++++++++---- src/Gateways/Wechat/Gateway.php | 11 +++++++---- src/Gateways/Wechat/GroupRedpackGateway.php | 9 ++++++--- src/Gateways/Wechat/MiniappGateway.php | 9 ++++++--- src/Gateways/Wechat/MpGateway.php | 12 ++++++++---- src/Gateways/Wechat/PosGateway.php | 9 ++++++--- src/Gateways/Wechat/RedpackGateway.php | 9 ++++++--- src/Gateways/Wechat/ScanGateway.php | 9 ++++++--- src/Gateways/Wechat/Support.php | 3 ++- src/Gateways/Wechat/TransferGateway.php | 9 ++++++--- src/Gateways/Wechat/WapGateway.php | 9 ++++++--- src/Pay.php | 7 ++++--- 23 files changed, 132 insertions(+), 73 deletions(-) diff --git a/src/Contracts/GatewayApplicationInterface.php b/src/Contracts/GatewayApplicationInterface.php index 357e276..6fbbe21 100644 --- a/src/Contracts/GatewayApplicationInterface.php +++ b/src/Contracts/GatewayApplicationInterface.php @@ -2,6 +2,9 @@ namespace Yansongda\Pay\Contracts; +use Symfony\Component\HttpFoundation\Response; +use Yansongda\Supports\Collection; + interface GatewayApplicationInterface { /** @@ -12,7 +15,7 @@ interface GatewayApplicationInterface * @param string $gateway * @param array $params * - * @return \Yansongda\Supports\Collection|\Symfony\Component\HttpFoundation\Response + * @return Collection|Response */ public function pay($gateway, $params); @@ -24,7 +27,7 @@ interface GatewayApplicationInterface * @param string|array $order * @param bool $refund * - * @return \Yansongda\Supports\Collection + * @return Collection */ public function find($order, $refund); @@ -35,7 +38,7 @@ interface GatewayApplicationInterface * * @param array $order * - * @return \Yansongda\Supports\Collection + * @return Collection */ public function refund($order); @@ -46,7 +49,7 @@ interface GatewayApplicationInterface * * @param string|array $order * - * @return \Yansongda\Supports\Collection + * @return Collection */ public function cancel($order); @@ -57,7 +60,7 @@ interface GatewayApplicationInterface * * @param string|array $order * - * @return \Yansongda\Supports\Collection + * @return Collection */ public function close($order); @@ -69,7 +72,7 @@ interface GatewayApplicationInterface * @param string|null $content * @param bool $refund * - * @return \Yansongda\Supports\Collection + * @return Collection */ public function verify($content, $refund); @@ -78,7 +81,7 @@ interface GatewayApplicationInterface * * @author yansongda * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function success(); } diff --git a/src/Contracts/GatewayInterface.php b/src/Contracts/GatewayInterface.php index 1ead7b1..fb165ab 100644 --- a/src/Contracts/GatewayInterface.php +++ b/src/Contracts/GatewayInterface.php @@ -2,6 +2,9 @@ namespace Yansongda\Pay\Contracts; +use Symfony\Component\HttpFoundation\Response; +use Yansongda\Supports\Collection; + interface GatewayInterface { /** @@ -12,7 +15,7 @@ interface GatewayInterface * @param string $endpoint * @param array $payload * - * @return \Yansongda\Supports\Collection|\Symfony\Component\HttpFoundation\Response + * @return Collection|Response */ public function pay($endpoint, array $payload); } diff --git a/src/Events.php b/src/Events.php index b491ec2..f7170cf 100644 --- a/src/Events.php +++ b/src/Events.php @@ -2,6 +2,7 @@ namespace Yansongda\Pay; +use Exception; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -84,7 +85,7 @@ class Events * @param string $method * @param array $args * - * @throws \Exception + * @throws Exception * * @return mixed */ @@ -101,7 +102,7 @@ class Events * @param string $method * @param array $args * - * @throws \Exception + * @throws Exception * * @return mixed */ diff --git a/src/Exceptions/GatewayException.php b/src/Exceptions/GatewayException.php index 2bdbe27..e844801 100644 --- a/src/Exceptions/GatewayException.php +++ b/src/Exceptions/GatewayException.php @@ -11,9 +11,10 @@ class GatewayException extends Exception * * @param string $message * @param array|string $raw + * @param int $code */ - public function __construct($message, $raw = []) + public function __construct($message, $raw = [], $code = self::ERROR_GATEWAY) { - parent::__construct('ERROR_GATEWAY: '.$message, $raw, self::ERROR_GATEWAY); + parent::__construct('ERROR_GATEWAY: '.$message, $raw, $code); } } diff --git a/src/Gateways/Alipay/AppGateway.php b/src/Gateways/Alipay/AppGateway.php index b1c2ab5..f414632 100644 --- a/src/Gateways/Alipay/AppGateway.php +++ b/src/Gateways/Alipay/AppGateway.php @@ -5,6 +5,7 @@ namespace Yansongda\Pay\Gateways\Alipay; use Symfony\Component\HttpFoundation\Response; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\InvalidConfigException; class AppGateway implements GatewayInterface { @@ -16,7 +17,7 @@ class AppGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException + * @throws InvalidConfigException * * @return Response */ diff --git a/src/Gateways/Alipay/MiniGateway.php b/src/Gateways/Alipay/MiniGateway.php index e9d1237..1fd0938 100644 --- a/src/Gateways/Alipay/MiniGateway.php +++ b/src/Gateways/Alipay/MiniGateway.php @@ -4,6 +4,10 @@ namespace Yansongda\Pay\Gateways\Alipay; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidConfigException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class MiniGateway implements GatewayInterface @@ -16,10 +20,10 @@ class MiniGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidConfigException + * @throws InvalidSignException * * @link https://docs.alipay.com/mini/introduce/pay * @@ -28,7 +32,7 @@ class MiniGateway implements GatewayInterface public function pay($endpoint, array $payload): Collection { if (empty(json_decode($payload['biz_content'], true)['buyer_id'])) { - throw new \Yansongda\Pay\Exceptions\InvalidArgumentException('buyer_id required'); + throw new InvalidArgumentException('buyer_id required'); } $payload['method'] = 'alipay.trade.create'; diff --git a/src/Gateways/Alipay/PosGateway.php b/src/Gateways/Alipay/PosGateway.php index 99630d6..c6bce8d 100644 --- a/src/Gateways/Alipay/PosGateway.php +++ b/src/Gateways/Alipay/PosGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Alipay; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidConfigException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class PosGateway implements GatewayInterface @@ -16,9 +19,9 @@ class PosGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidConfigException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Alipay/ScanGateway.php b/src/Gateways/Alipay/ScanGateway.php index 4511bc4..cf3b10d 100644 --- a/src/Gateways/Alipay/ScanGateway.php +++ b/src/Gateways/Alipay/ScanGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Alipay; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidConfigException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class ScanGateway implements GatewayInterface @@ -16,9 +19,9 @@ class ScanGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidConfigException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Alipay/TransferGateway.php b/src/Gateways/Alipay/TransferGateway.php index 7ae5ef9..56f4f97 100644 --- a/src/Gateways/Alipay/TransferGateway.php +++ b/src/Gateways/Alipay/TransferGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Alipay; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidConfigException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class TransferGateway implements GatewayInterface @@ -16,9 +19,9 @@ class TransferGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidConfigException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Alipay/WebGateway.php b/src/Gateways/Alipay/WebGateway.php index 71aa0d6..e3180dd 100644 --- a/src/Gateways/Alipay/WebGateway.php +++ b/src/Gateways/Alipay/WebGateway.php @@ -6,6 +6,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Response; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\InvalidConfigException; class WebGateway implements GatewayInterface { @@ -17,7 +18,7 @@ class WebGateway implements GatewayInterface * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\InvalidConfigException + * @throws InvalidConfigException * * @return Response */ diff --git a/src/Gateways/Wechat.php b/src/Gateways/Wechat.php index 8ef58d8..32b2ae6 100644 --- a/src/Gateways/Wechat.php +++ b/src/Gateways/Wechat.php @@ -2,6 +2,7 @@ namespace Yansongda\Pay\Gateways; +use Exception; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -9,6 +10,7 @@ use Yansongda\Pay\Contracts\GatewayApplicationInterface; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; use Yansongda\Pay\Exceptions\InvalidGatewayException; use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat\Support; @@ -87,7 +89,7 @@ class Wechat implements GatewayApplicationInterface * * @param Config $config * - * @throws \Exception + * @throws Exception */ public function __construct(Config $config) { @@ -163,7 +165,7 @@ class Wechat implements GatewayApplicationInterface * @param bool $refund * * @throws InvalidSignException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Collection */ @@ -200,7 +202,7 @@ class Wechat implements GatewayApplicationInterface * * @throws GatewayException * @throws InvalidSignException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Collection */ @@ -229,7 +231,7 @@ class Wechat implements GatewayApplicationInterface * * @throws GatewayException * @throws InvalidSignException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Collection */ @@ -255,7 +257,7 @@ class Wechat implements GatewayApplicationInterface * * @throws GatewayException * @throws InvalidSignException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Collection */ @@ -283,7 +285,7 @@ class Wechat implements GatewayApplicationInterface * * @throws GatewayException * @throws InvalidSignException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Collection */ @@ -303,7 +305,7 @@ class Wechat implements GatewayApplicationInterface * * @author yansongda * - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return Response */ @@ -326,7 +328,7 @@ class Wechat implements GatewayApplicationInterface * @param array $params * * @throws GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException * * @return string */ diff --git a/src/Gateways/Wechat/AppGateway.php b/src/Gateways/Wechat/AppGateway.php index 625a88e..cd02dba 100644 --- a/src/Gateways/Wechat/AppGateway.php +++ b/src/Gateways/Wechat/AppGateway.php @@ -2,9 +2,13 @@ namespace Yansongda\Pay\Gateways\Wechat; +use Exception; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat; use Yansongda\Supports\Str; @@ -18,10 +22,10 @@ class AppGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException - * @throws \Exception + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException + * @throws Exception * * @return Response */ diff --git a/src/Gateways/Wechat/Gateway.php b/src/Gateways/Wechat/Gateway.php index df03aec..5c092d8 100644 --- a/src/Gateways/Wechat/Gateway.php +++ b/src/Gateways/Wechat/Gateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Yansongda\Pay\Contracts\GatewayInterface; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; abstract class Gateway implements GatewayInterface @@ -20,7 +23,7 @@ abstract class Gateway implements GatewayInterface * * @author yansongda * - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct() { @@ -55,9 +58,9 @@ abstract class Gateway implements GatewayInterface * * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/GroupRedpackGateway.php b/src/Gateways/Wechat/GroupRedpackGateway.php index 077f48e..80c34da 100644 --- a/src/Gateways/Wechat/GroupRedpackGateway.php +++ b/src/Gateways/Wechat/GroupRedpackGateway.php @@ -3,6 +3,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat; use Yansongda\Supports\Collection; @@ -16,9 +19,9 @@ class GroupRedpackGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/MiniappGateway.php b/src/Gateways/Wechat/MiniappGateway.php index 376fc89..9bdff06 100644 --- a/src/Gateways/Wechat/MiniappGateway.php +++ b/src/Gateways/Wechat/MiniappGateway.php @@ -2,6 +2,9 @@ namespace Yansongda\Pay\Gateways\Wechat; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat; use Yansongda\Supports\Collection; @@ -15,9 +18,9 @@ class MiniappGateway extends MpGateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/MpGateway.php b/src/Gateways/Wechat/MpGateway.php index dd65281..e587635 100644 --- a/src/Gateways/Wechat/MpGateway.php +++ b/src/Gateways/Wechat/MpGateway.php @@ -2,7 +2,11 @@ namespace Yansongda\Pay\Gateways\Wechat; +use Exception; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; use Yansongda\Supports\Str; @@ -21,10 +25,10 @@ class MpGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException - * @throws \Exception + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException + * @throws Exception * * @return Collection */ diff --git a/src/Gateways/Wechat/PosGateway.php b/src/Gateways/Wechat/PosGateway.php index b36968d..1c3c26e 100644 --- a/src/Gateways/Wechat/PosGateway.php +++ b/src/Gateways/Wechat/PosGateway.php @@ -3,6 +3,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class PosGateway extends Gateway @@ -15,9 +18,9 @@ class PosGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/RedpackGateway.php b/src/Gateways/Wechat/RedpackGateway.php index 5c9ce43..9dc256d 100644 --- a/src/Gateways/Wechat/RedpackGateway.php +++ b/src/Gateways/Wechat/RedpackGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Symfony\Component\HttpFoundation\Request; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat; use Yansongda\Supports\Collection; @@ -17,9 +20,9 @@ class RedpackGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/ScanGateway.php b/src/Gateways/Wechat/ScanGateway.php index 301348e..a259c11 100644 --- a/src/Gateways/Wechat/ScanGateway.php +++ b/src/Gateways/Wechat/ScanGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Symfony\Component\HttpFoundation\Request; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Supports\Collection; class ScanGateway extends Gateway @@ -16,9 +19,9 @@ class ScanGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/Support.php b/src/Gateways/Wechat/Support.php index c48d1c9..2db4a92 100644 --- a/src/Gateways/Wechat/Support.php +++ b/src/Gateways/Wechat/Support.php @@ -2,6 +2,7 @@ namespace Yansongda\Pay\Gateways\Wechat; +use Exception; use Yansongda\Pay\Events; use Yansongda\Pay\Exceptions\BusinessException; use Yansongda\Pay\Exceptions\GatewayException; @@ -439,7 +440,7 @@ class Support * @throws GatewayException * @throws InvalidArgumentException * @throws InvalidSignException - * @throws \Exception + * @throws Exception * * @return Support */ diff --git a/src/Gateways/Wechat/TransferGateway.php b/src/Gateways/Wechat/TransferGateway.php index af9c34c..b733dc3 100644 --- a/src/Gateways/Wechat/TransferGateway.php +++ b/src/Gateways/Wechat/TransferGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Symfony\Component\HttpFoundation\Request; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; use Yansongda\Pay\Gateways\Wechat; use Yansongda\Supports\Collection; @@ -17,9 +20,9 @@ class TransferGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return Collection */ diff --git a/src/Gateways/Wechat/WapGateway.php b/src/Gateways/Wechat/WapGateway.php index f1be4d8..cb88b5c 100644 --- a/src/Gateways/Wechat/WapGateway.php +++ b/src/Gateways/Wechat/WapGateway.php @@ -4,6 +4,9 @@ namespace Yansongda\Pay\Gateways\Wechat; use Symfony\Component\HttpFoundation\RedirectResponse; use Yansongda\Pay\Events; +use Yansongda\Pay\Exceptions\GatewayException; +use Yansongda\Pay\Exceptions\InvalidArgumentException; +use Yansongda\Pay\Exceptions\InvalidSignException; class WapGateway extends Gateway { @@ -15,9 +18,9 @@ class WapGateway extends Gateway * @param string $endpoint * @param array $payload * - * @throws \Yansongda\Pay\Exceptions\GatewayException - * @throws \Yansongda\Pay\Exceptions\InvalidArgumentException - * @throws \Yansongda\Pay\Exceptions\InvalidSignException + * @throws GatewayException + * @throws InvalidArgumentException + * @throws InvalidSignException * * @return RedirectResponse */ diff --git a/src/Pay.php b/src/Pay.php index 7dd2bbd..aa4accb 100644 --- a/src/Pay.php +++ b/src/Pay.php @@ -2,6 +2,7 @@ namespace Yansongda\Pay; +use Exception; use Yansongda\Pay\Contracts\GatewayApplicationInterface; use Yansongda\Pay\Exceptions\InvalidGatewayException; use Yansongda\Pay\Gateways\Alipay; @@ -31,7 +32,7 @@ class Pay * * @param array $config * - * @throws \Exception + * @throws Exception */ public function __construct(array $config) { @@ -50,7 +51,7 @@ class Pay * @param array $params * * @throws InvalidGatewayException - * @throws \Exception + * @throws Exception * * @return GatewayApplicationInterface */ @@ -110,7 +111,7 @@ class Pay * * @author yansongda * - * @throws \Exception + * @throws Exception */ protected function registerLogService() {