From 9b2550967e1f0dea993b4856d79cf03e9dd77fc5 Mon Sep 17 00:00:00 2001 From: yansongda Date: Fri, 22 Dec 2023 15:53:02 +0800 Subject: [PATCH] =?UTF-8?q?change(internal):=20=E9=94=99=E8=AF=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=20const=20=E5=91=BD=E5=90=8D=E8=A7=84=E5=88=99?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=20(#902)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 +- src/Direction/CollectionDirection.php | 2 +- src/Direction/OriginResponseDirection.php | 2 +- src/Event.php | 2 +- src/Exception/Exception.php | 46 +++++++++---------- src/Exception/ServiceNotFoundException.php | 2 +- src/Functions.php | 28 +++++------ src/Logger.php | 2 +- src/Plugin/Alipay/AddSignaturePlugin.php | 2 +- src/Plugin/Alipay/CallbackPlugin.php | 2 +- src/Plugin/Alipay/StartPlugin.php | 8 ++-- src/Plugin/Alipay/VerifySignaturePlugin.php | 2 +- src/Plugin/ParserPlugin.php | 2 +- src/Plugin/Unipay/CallbackPlugin.php | 2 +- src/Plugin/Unipay/Shortcut/CancelShortcut.php | 2 +- src/Plugin/Unipay/Shortcut/PosShortcut.php | 2 +- src/Plugin/Unipay/Shortcut/QueryShortcut.php | 2 +- src/Plugin/Unipay/Shortcut/RefundShortcut.php | 2 +- src/Plugin/Unipay/Shortcut/ScanShortcut.php | 2 +- src/Plugin/Wechat/CallbackPlugin.php | 2 +- .../Wechat/Ecommerce/Refund/ApplyPlugin.php | 2 +- .../Wechat/Ecommerce/Refund/QueryPlugin.php | 4 +- .../Refund/QueryReturnAdvancePlugin.php | 4 +- .../Ecommerce/Refund/ReturnAdvancePlugin.php | 4 +- .../Wechat/Fund/Balance/QueryDayEndPlugin.php | 2 +- .../Wechat/Fund/Balance/QueryPlugin.php | 2 +- .../Fund/Profitsharing/DownloadBillPlugin.php | 2 +- .../Fund/Profitsharing/QueryAmountsPlugin.php | 2 +- .../Wechat/Fund/Profitsharing/QueryPlugin.php | 2 +- .../Fund/Profitsharing/QueryReturnPlugin.php | 2 +- .../Fund/Transfer/CreateBillReceiptPlugin.php | 2 +- .../Transfer/CreateDetailReceiptPlugin.php | 2 +- .../Fund/Transfer/DownloadReceiptPlugin.php | 2 +- .../Transfer/QueryBatchDetailIdPlugin.php | 4 +- .../Fund/Transfer/QueryBatchIdPlugin.php | 4 +- .../Fund/Transfer/QueryBillReceiptPlugin.php | 2 +- .../Transfer/QueryDetailReceiptPlugin.php | 2 +- .../Transfer/QueryOutBatchDetailNoPlugin.php | 4 +- .../Fund/Transfer/QueryOutBatchNoPlugin.php | 4 +- src/Plugin/Wechat/LaunchPlugin.php | 2 +- .../Wechat/Marketing/Coupon/PausePlugin.php | 2 +- .../Coupon/QueryCouponDetailPlugin.php | 2 +- .../Coupon/QueryStockDetailPlugin.php | 2 +- .../Coupon/QueryStockItemsPlugin.php | 2 +- .../Coupon/QueryStockMerchantsPlugin.php | 2 +- .../Coupon/QueryStockRefundFlowPlugin.php | 2 +- .../Coupon/QueryStockUseFlowPlugin.php | 2 +- .../Coupon/QueryUserCouponsPlugin.php | 2 +- .../Wechat/Marketing/Coupon/RestartPlugin.php | 2 +- .../Wechat/Marketing/Coupon/SendPlugin.php | 2 +- .../Wechat/Marketing/Coupon/StartPlugin.php | 2 +- src/Plugin/Wechat/Pay/Combine/ClosePlugin.php | 2 +- src/Plugin/Wechat/Pay/Combine/QueryPlugin.php | 2 +- src/Plugin/Wechat/Pay/Common/ClosePlugin.php | 4 +- .../Wechat/Pay/Common/DownloadBillPlugin.php | 2 +- src/Plugin/Wechat/Pay/Common/QueryPlugin.php | 4 +- .../Wechat/Pay/Common/QueryRefundPlugin.php | 2 +- src/Plugin/Wechat/RadarSignPlugin.php | 6 +-- .../Complaints/CompleteComplaintPlugin.php | 2 +- .../Risk/Complaints/DownloadMediaPlugin.php | 2 +- .../Complaints/QueryComplaintDetailPlugin.php | 2 +- .../QueryComplaintNegotiationPlugin.php | 2 +- .../Complaints/ResponseComplaintPlugin.php | 2 +- .../Risk/Complaints/UpdateRefundPlugin.php | 2 +- src/Plugin/Wechat/Shortcut/CloseShortcut.php | 2 +- src/Plugin/Wechat/Shortcut/PapayShortcut.php | 2 +- src/Plugin/Wechat/Shortcut/QueryShortcut.php | 2 +- src/Provider/AbstractProvider.php | 4 +- src/Shortcut/Alipay/CancelShortcut.php | 2 +- src/Shortcut/Alipay/CloseShortcut.php | 2 +- src/Shortcut/Alipay/QueryShortcut.php | 2 +- src/Shortcut/Alipay/RefundShortcut.php | 2 +- src/Traits/GetUnipayCerts.php | 6 +-- src/Traits/HasWechatEncryption.php | 2 +- tests/Direction/CollectionDirectionTest.php | 2 +- .../Direction/OriginResponseDirectionTest.php | 2 +- tests/FunctionTest.php | 12 ++--- tests/Plugin/Alipay/StartPluginTest.php | 8 ++-- .../Alipay/VerifySignaturePluginTest.php | 2 +- tests/Plugin/ParserPluginTest.php | 4 +- .../Unipay/Shortcut/CancelShortcutTest.php | 2 +- .../Unipay/Shortcut/PosShortcutTest.php | 2 +- .../Unipay/Shortcut/QueryShortcutTest.php | 2 +- .../Unipay/Shortcut/ScanShortcutTest.php | 2 +- .../Ecommerce/Refund/ApplyPluginTest.php | 2 +- .../Ecommerce/Refund/QueryPluginTest.php | 4 +- .../Refund/QueryReturnAdvancePluginTest.php | 4 +- .../Refund/ReturnAdvancePluginTest.php | 4 +- .../Fund/Balance/QueryDayEndPluginTest.php | 4 +- .../Wechat/Fund/Balance/QueryPluginTest.php | 2 +- .../Profitsharing/DownloadBillPluginTest.php | 2 +- .../Fund/Profitsharing/QueryPluginTest.php | 4 +- .../Profitsharing/QueryReturnPluginTest.php | 4 +- .../Transfer/CreateBillReceiptPluginTest.php | 2 +- .../CreateDetailReceiptPluginTest.php | 4 +- .../Transfer/DownloadReceiptPluginTest.php | 2 +- .../Transfer/QueryBatchDetailIdPluginTest.php | 8 ++-- .../Fund/Transfer/QueryBatchIdPluginTest.php | 8 ++-- .../Transfer/QueryBillReceiptPluginTest.php | 4 +- .../Transfer/QueryDetailReceiptPluginTest.php | 4 +- .../QueryOutBatchDetailNoPluginTest.php | 8 ++-- .../Transfer/QueryOutBatchNoPluginTest.php | 8 ++-- tests/Plugin/Wechat/LaunchPluginTest.php | 2 +- .../Coupon/QueryCouponDetailPluginTest.php | 2 +- .../Coupon/QueryStockDetailPluginTest.php | 2 +- .../Coupon/QueryStockItemsPluginTest.php | 2 +- .../Coupon/QueryStockMerchantsPluginTest.php | 2 +- .../Coupon/QueryStockRefundFlowPluginTest.php | 2 +- .../Coupon/QueryStockUseFlowPluginTest.php | 2 +- .../Coupon/QueryUserCouponsPluginTest.php | 2 +- .../Marketing/Coupon/RestartPluginTest.php | 2 +- .../Marketing/Coupon/SendPluginTest.php | 2 +- .../Marketing/Coupon/StartPluginTest.php | 2 +- .../Wechat/Pay/Common/ClosePluginTest.php | 2 +- .../Pay/Common/DownloadBillPluginTest.php | 2 +- tests/Plugin/Wechat/RadarSignPluginTest.php | 4 +- .../CompleteComplaintPluginTest.php | 2 +- .../Complaints/DownloadMediaPluginTest.php | 2 +- .../QueryComplaintDetailPluginTest.php | 2 +- .../QueryComplaintNegotiationPluginTest.php | 2 +- .../ResponseComplaintPluginTest.php | 2 +- .../Complaints/UpdateRefundPluginTest.php | 2 +- .../Wechat/Shortcut/CloseShortcutTest.php | 2 +- .../Wechat/Shortcut/PapayShortcutTest.php | 2 +- .../Wechat/Shortcut/QueryShortcutTest.php | 2 +- tests/Provider/AbstractProviderTest.php | 2 +- tests/Shortcut/Alipay/CancelShortcutTest.php | 2 +- tests/Shortcut/Alipay/CloseShortcutTest.php | 2 +- tests/Shortcut/Alipay/QueryShortcutTest.php | 2 +- tests/Shortcut/Alipay/RefundShortcutTest.php | 2 +- tests/Traits/GetUnipayCertsTest.php | 6 +-- tests/Traits/HasWechatEncryptionTest.php | 2 +- 132 files changed, 217 insertions(+), 220 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a071db588..0d885e8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,9 @@ - change(internal): 支付宝 shortcut 从 plugin 文件夹独立出来(#895) - change(internal): DirectionInterface 方法由 `parse` 改为 `guide`(#896) - change: 查询API方法由 `find` 改为 `query`,同时参数只支持 array(#897) -- change: cancel 的 API 参数只支持 array,不再支持 string(#890) -- change: close 的 API 参数只支持 array,不再支持 string(#891) +- change: cancel 的 API 参数只支持 array,不再支持 string(#900) +- change: close 的 API 参数只支持 array,不再支持 string(#901) +- change(internal): 错误代码 const 命名规则统一(#902) ## v3.5.3 diff --git a/src/Direction/CollectionDirection.php b/src/Direction/CollectionDirection.php index 781904246..953203c31 100644 --- a/src/Direction/CollectionDirection.php +++ b/src/Direction/CollectionDirection.php @@ -19,7 +19,7 @@ class CollectionDirection implements DirectionInterface public function guide(PackerInterface $packer, ?ResponseInterface $response): Collection { if (is_null($response)) { - throw new InvalidResponseException(Exception::RESPONSE_NONE); + throw new InvalidResponseException(Exception::RESPONSE_EMPTY); } $body = (string) $response->getBody(); diff --git a/src/Direction/OriginResponseDirection.php b/src/Direction/OriginResponseDirection.php index ceb4f8355..b558c4ce8 100644 --- a/src/Direction/OriginResponseDirection.php +++ b/src/Direction/OriginResponseDirection.php @@ -21,6 +21,6 @@ public function guide(PackerInterface $packer, ?ResponseInterface $response): ?R return $response; } - throw new InvalidResponseException(Exception::INVALID_RESPONSE_CODE); + throw new InvalidResponseException(Exception::RESPONSE_CODE_WRONG); } } diff --git a/src/Event.php b/src/Event.php index 24c07cd65..b68571ba6 100644 --- a/src/Event.php +++ b/src/Event.php @@ -33,6 +33,6 @@ public static function __callStatic(string $method, array $args): void return; } - throw new InvalidConfigException(Exception\Exception::EVENT_CONFIG_ERROR); + throw new InvalidConfigException(Exception\Exception::EVENT_CONFIG_INVALID); } } diff --git a/src/Exception/Exception.php b/src/Exception/Exception.php index 4d7d97796..85009d8b7 100644 --- a/src/Exception/Exception.php +++ b/src/Exception/Exception.php @@ -24,28 +24,28 @@ class Exception extends \Exception */ public const SERVICE_ERROR = 2000; - public const SERVICE_NOT_FOUND_ERROR = 2001; + public const SERVICE_NOT_FOUND = 2001; /* * 关于配置. */ public const CONFIG_ERROR = 3000; - public const INVALID_DIRECTION = 3001; + public const DIRECTION_INVALID = 3001; - public const ALIPAY_CONFIG_ERROR = 3002; + public const ALIPAY_CONFIG_INVALID = 3002; - public const LOGGER_CONFIG_ERROR = 3003; + public const LOGGER_CONFIG_INVALID = 3003; - public const HTTP_CLIENT_CONFIG_ERROR = 3004; + public const HTTP_CLIENT_INVALID = 3004; - public const EVENT_CONFIG_ERROR = 3005; + public const EVENT_CONFIG_INVALID = 3005; - public const WECHAT_CONFIG_ERROR = 3006; + public const WECHAT_CONFIG_INVALID = 3006; - public const UNIPAY_CONFIG_ERROR = 3007; + public const UNIPAY_CONFIG_INVALID = 3007; - public const INVALID_PACKER = 3008; + public const PACKER_INVALID = 3008; /* * 关于参数. @@ -54,23 +54,19 @@ class Exception extends \Exception public const SHORTCUT_NOT_FOUND = 4001; - public const PLUGIN_ERROR = 4002; + public const PLUGIN_INCOMPATIBLE = 4002; - public const SHORTCUT_MULTI_ACTION_ERROR = 4003; + public const SHORTCUT_MULTI_ACTION_INVALID = 4003; public const METHOD_NOT_SUPPORTED = 4004; - public const REQUEST_NULL_ERROR = 4005; + public const REQUEST_EMPTY = 4005; - public const MISSING_NECESSARY_PARAMS = 4006; + public const NECESSARY_PARAMS_MISSING = 4006; - public const NOT_IN_SERVICE_MODE = 4007; + public const CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE = 4007; - public const WECHAT_SERIAL_NO_NOT_FOUND = 4008; - - public const UNIPAY_FIND_STRING_NOT_SUPPORTED = 4009; - - public const UNIPAY_CANCEL_STRING_NOT_SUPPORTED = 4010; + public const WECHAT_SERIAL_NOT_FOUND = 4008; /** * 关于api. @@ -81,19 +77,19 @@ class Exception extends \Exception public const UNPACK_RESPONSE_ERROR = 5002; - public const INVALID_RESPONSE_SIGN = 5003; + public const SIGN_INVALID = 5003; - public const INVALID_RESPONSE_CODE = 5004; + public const RESPONSE_CODE_WRONG = 5004; public const RESPONSE_MISSING_NECESSARY_PARAMS = 5005; - public const RESPONSE_NONE = 5006; + public const RESPONSE_EMPTY = 5006; - public const INVALID_CIPHERTEXT_PARAMS = 5007; + public const CIPHERTEXT_PARAMS_INVALID = 5007; - public const INVALID_REQUEST_ENCRYPTED_DATA = 5008; + public const REQUEST_ENCRYPTED_DATA_INVALID = 5008; - public const INVALID_REQUEST_ENCRYPTED_METHOD = 5009; + public const REQUEST_ENCRYPTED_METHOD_INVALID = 5009; public mixed $extra; diff --git a/src/Exception/ServiceNotFoundException.php b/src/Exception/ServiceNotFoundException.php index 0853c5af9..e90e283f6 100644 --- a/src/Exception/ServiceNotFoundException.php +++ b/src/Exception/ServiceNotFoundException.php @@ -9,7 +9,7 @@ class ServiceNotFoundException extends Exception implements NotFoundExceptionInterface { - public function __construct(string $message = 'Service Not Found', int $code = self::SERVICE_NOT_FOUND_ERROR, mixed $extra = null, Throwable $previous = null) + public function __construct(string $message = 'Service Not Found', int $code = self::SERVICE_NOT_FOUND, mixed $extra = null, Throwable $previous = null) { parent::__construct($message, $code, $extra, $previous); } diff --git a/src/Functions.php b/src/Functions.php index 6731db179..713e4c55d 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -46,7 +46,7 @@ function get_direction(mixed $direction): DirectionInterface } if (!$direction instanceof DirectionInterface) { - throw new InvalidConfigException(Exception::INVALID_DIRECTION); + throw new InvalidConfigException(Exception::DIRECTION_INVALID); } return $direction; @@ -90,7 +90,7 @@ function verify_alipay_sign(array $params, string $contents, string $sign): void $public = get_alipay_config($params)['alipay_public_cert_path'] ?? null; if (empty($public)) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [alipay_public_cert_path]'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Missing Alipay Config -- [alipay_public_cert_path]'); } $result = 1 === openssl_verify( @@ -101,7 +101,7 @@ function verify_alipay_sign(array $params, string $contents, string $sign): void ); if (!$result) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Verify Alipay Response Sign Failed', func_get_args()); + throw new InvalidResponseException(Exception::SIGN_INVALID, 'Verify Alipay Response Sign Failed', func_get_args()); } } @@ -137,7 +137,7 @@ function get_wechat_sign(array $params, string $contents): string $privateKey = get_wechat_config($params)['mch_secret_cert'] ?? null; if (empty($privateKey)) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_secret_cert]'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Missing Wechat Config -- [mch_secret_cert]'); } $privateKey = get_private_cert($privateKey); @@ -157,7 +157,7 @@ function get_wechat_sign_v2(array $params, array $payload, bool $upper = true): $key = get_wechat_config($params)['mch_secret_key_v2'] ?? null; if (empty($key)) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_secret_key_v2]'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Missing Wechat Config -- [mch_secret_key_v2]'); } ksort($payload); @@ -196,7 +196,7 @@ function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, a $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null; if (empty($sign)) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, $body, ['headers' => $message->getHeaders(), 'body' => $body]); + throw new InvalidResponseException(Exception::SIGN_INVALID, $body, ['headers' => $message->getHeaders(), 'body' => $body]); } $public = get_public_cert( @@ -211,7 +211,7 @@ function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, a ); if (!$result) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, '', ['headers' => $message->getHeaders(), 'body' => $body]); + throw new InvalidResponseException(Exception::SIGN_INVALID, '', ['headers' => $message->getHeaders(), 'body' => $body]); } } @@ -250,7 +250,7 @@ function reload_wechat_public_certs(array $params, ?string $serialNo = null): st ); if (!is_null($serialNo) && empty($certs[$serialNo])) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Get Wechat Public Cert Error'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Get Wechat Public Cert Error'); } return $certs[$serialNo] ?? ''; @@ -292,16 +292,16 @@ function decrypt_wechat_resource(array $resource, array $params): array $secret = get_wechat_config($params)['mch_secret_key'] ?? null; if (strlen($ciphertext) <= Wechat::AUTH_TAG_LENGTH_BYTE) { - throw new InvalidResponseException(Exception::INVALID_CIPHERTEXT_PARAMS); + throw new InvalidResponseException(Exception::CIPHERTEXT_PARAMS_INVALID); } if (is_null($secret) || Wechat::MCH_SECRET_KEY_LENGTH_BYTE != strlen($secret)) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_secret_key]'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Missing Wechat Config -- [mch_secret_key]'); } $resource['ciphertext'] = match ($resource['algorithm'] ?? '') { 'AEAD_AES_256_GCM' => decrypt_wechat_resource_aes_256_gcm($ciphertext, $secret, $resource['nonce'] ?? '', $resource['associated_data'] ?? ''), - default => throw new InvalidResponseException(Exception::INVALID_REQUEST_ENCRYPTED_METHOD), + default => throw new InvalidResponseException(Exception::REQUEST_ENCRYPTED_METHOD_INVALID), }; return $resource; @@ -326,7 +326,7 @@ function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, $decrypted = json_decode(strval($decrypted), true); if (JSON_ERROR_NONE !== json_last_error()) { - throw new InvalidResponseException(Exception::INVALID_REQUEST_ENCRYPTED_DATA); + throw new InvalidResponseException(Exception::REQUEST_ENCRYPTED_DATA_INVALID); } } @@ -354,7 +354,7 @@ function verify_unipay_sign(array $params, string $contents, string $sign): void { if (empty($params['signPubKeyCert']) && empty($public = get_unipay_config($params)['unipay_public_cert_path'] ?? null)) { - throw new InvalidConfigException(Exception::UNIPAY_CONFIG_ERROR, 'Missing Unipay Config -- [unipay_public_cert_path]'); + throw new InvalidConfigException(Exception::UNIPAY_CONFIG_INVALID, 'Missing Unipay Config -- [unipay_public_cert_path]'); } $result = 1 === openssl_verify( @@ -365,6 +365,6 @@ function verify_unipay_sign(array $params, string $contents, string $sign): void ); if (!$result) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Verify Unipay Response Sign Failed', func_get_args()); + throw new InvalidResponseException(Exception::SIGN_INVALID, 'Verify Unipay Response Sign Failed', func_get_args()); } } diff --git a/src/Logger.php b/src/Logger.php index 3a81e3451..70d9bf646 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -43,6 +43,6 @@ public static function __callStatic(string $method, array $args): void return; } - throw new InvalidConfigException(Exception\Exception::LOGGER_CONFIG_ERROR); + throw new InvalidConfigException(Exception\Exception::LOGGER_CONFIG_INVALID); } } diff --git a/src/Plugin/Alipay/AddSignaturePlugin.php b/src/Plugin/Alipay/AddSignaturePlugin.php index ace2b9d3d..659611cec 100644 --- a/src/Plugin/Alipay/AddSignaturePlugin.php +++ b/src/Plugin/Alipay/AddSignaturePlugin.php @@ -60,7 +60,7 @@ protected function getPrivateKey(array $params): string $privateKey = get_alipay_config($params)['app_secret_cert'] ?? null; if (is_null($privateKey)) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_secret_cert]'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Missing Alipay Config -- [app_secret_cert]'); } return get_private_cert($privateKey); diff --git a/src/Plugin/Alipay/CallbackPlugin.php b/src/Plugin/Alipay/CallbackPlugin.php index 52fb28f9e..f44e9ab9b 100644 --- a/src/Plugin/Alipay/CallbackPlugin.php +++ b/src/Plugin/Alipay/CallbackPlugin.php @@ -35,7 +35,7 @@ public function assembly(Rocket $rocket, Closure $next): Rocket $sign = $rocket->getParams()['sign'] ?? false; if (!$sign) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Callback Empty Sign', $rocket->getParams()); + throw new InvalidResponseException(Exception::SIGN_INVALID, 'Callback Empty Sign', $rocket->getParams()); } verify_alipay_sign($rocket->getParams(), $this->getSignContent($rocket->getPayload()), $sign); diff --git a/src/Plugin/Alipay/StartPlugin.php b/src/Plugin/Alipay/StartPlugin.php index c6618ac47..30d5df4aa 100644 --- a/src/Plugin/Alipay/StartPlugin.php +++ b/src/Plugin/Alipay/StartPlugin.php @@ -106,13 +106,13 @@ protected function getAppCertSn(string $tenant, array $config): string $path = $config['app_public_cert_path'] ?? null; if (is_null($path)) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_public_cert_path]'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Missing Alipay Config -- [app_public_cert_path]'); } $ssl = openssl_x509_parse(get_public_cert($path)); if (false === $ssl) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Parse `app_public_cert_path` Error'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Parse `app_public_cert_path` Error'); } $result = $this->getCertSn($ssl['issuer'] ?? [], $ssl['serialNumber'] ?? ''); @@ -136,7 +136,7 @@ protected function getAlipayRootCertSn(string $tenant, array $config): string $path = $config['alipay_root_cert_path'] ?? null; if (is_null($path)) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [alipay_root_cert_path]'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Missing Alipay Config -- [alipay_root_cert_path]'); } $sn = ''; @@ -150,7 +150,7 @@ protected function getAlipayRootCertSn(string $tenant, array $config): string $ssl = openssl_x509_parse($cert.'-----END CERTIFICATE-----'); if (false === $ssl) { - throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Invalid alipay_root_cert'); + throw new InvalidConfigException(Exception::ALIPAY_CONFIG_INVALID, 'Invalid alipay_root_cert'); } $detail = $this->formatCert($ssl); diff --git a/src/Plugin/Alipay/VerifySignaturePlugin.php b/src/Plugin/Alipay/VerifySignaturePlugin.php index 8dfcca92b..9d32ca388 100644 --- a/src/Plugin/Alipay/VerifySignaturePlugin.php +++ b/src/Plugin/Alipay/VerifySignaturePlugin.php @@ -42,7 +42,7 @@ public function assembly(Rocket $rocket, Closure $next): Rocket $result = $destination->except('_sign')->all(); if ('' === $sign || empty($result)) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Verify Alipay Response Sign Failed: sign is empty', $destination); + throw new InvalidResponseException(Exception::SIGN_INVALID, 'Verify Alipay Response Sign Failed: sign is empty', $destination); } verify_alipay_sign($rocket->getParams(), json_encode($result, JSON_UNESCAPED_UNICODE), $sign); diff --git a/src/Plugin/ParserPlugin.php b/src/Plugin/ParserPlugin.php index 8f47ecdc8..0c6fd28ce 100644 --- a/src/Plugin/ParserPlugin.php +++ b/src/Plugin/ParserPlugin.php @@ -56,7 +56,7 @@ protected function getPacker(Rocket $rocket): PackerInterface $packer = is_string($packer) ? Pay::get($packer) : $packer; if (!$packer instanceof PackerInterface) { - throw new InvalidConfigException(Exception::INVALID_PACKER); + throw new InvalidConfigException(Exception::PACKER_INVALID); } return $packer; diff --git a/src/Plugin/Unipay/CallbackPlugin.php b/src/Plugin/Unipay/CallbackPlugin.php index fadd64e4b..01e929b6e 100644 --- a/src/Plugin/Unipay/CallbackPlugin.php +++ b/src/Plugin/Unipay/CallbackPlugin.php @@ -37,7 +37,7 @@ public function assembly(Rocket $rocket, Closure $next): Rocket $signature = $params['signature'] ?? false; if (!$signature) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, '', $params); + throw new InvalidResponseException(Exception::SIGN_INVALID, '', $params); } verify_unipay_sign($params, $rocket->getPayload()->sortKeys()->toString(), $signature); diff --git a/src/Plugin/Unipay/Shortcut/CancelShortcut.php b/src/Plugin/Unipay/Shortcut/CancelShortcut.php index 998a9fb50..1d1cf36ba 100644 --- a/src/Plugin/Unipay/Shortcut/CancelShortcut.php +++ b/src/Plugin/Unipay/Shortcut/CancelShortcut.php @@ -27,7 +27,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Cancel action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Cancel action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Unipay/Shortcut/PosShortcut.php b/src/Plugin/Unipay/Shortcut/PosShortcut.php index b48e8ee21..76facce44 100644 --- a/src/Plugin/Unipay/Shortcut/PosShortcut.php +++ b/src/Plugin/Unipay/Shortcut/PosShortcut.php @@ -28,7 +28,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Pos action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Pos action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Unipay/Shortcut/QueryShortcut.php b/src/Plugin/Unipay/Shortcut/QueryShortcut.php index 831208ccc..090428729 100644 --- a/src/Plugin/Unipay/Shortcut/QueryShortcut.php +++ b/src/Plugin/Unipay/Shortcut/QueryShortcut.php @@ -27,7 +27,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Query action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Query action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Unipay/Shortcut/RefundShortcut.php b/src/Plugin/Unipay/Shortcut/RefundShortcut.php index d2f6055cc..aaf547e43 100644 --- a/src/Plugin/Unipay/Shortcut/RefundShortcut.php +++ b/src/Plugin/Unipay/Shortcut/RefundShortcut.php @@ -27,7 +27,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Refund action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Refund action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Unipay/Shortcut/ScanShortcut.php b/src/Plugin/Unipay/Shortcut/ScanShortcut.php index 02ffa7ac5..1d0e2b964 100644 --- a/src/Plugin/Unipay/Shortcut/ScanShortcut.php +++ b/src/Plugin/Unipay/Shortcut/ScanShortcut.php @@ -30,7 +30,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Scan action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Scan action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Wechat/CallbackPlugin.php b/src/Plugin/Wechat/CallbackPlugin.php index 95f6263d2..04a814fd4 100644 --- a/src/Plugin/Wechat/CallbackPlugin.php +++ b/src/Plugin/Wechat/CallbackPlugin.php @@ -60,7 +60,7 @@ protected function formatRequestAndParams(Rocket $rocket): void $request = $rocket->getParams()['request'] ?? null; if (!$request instanceof ServerRequestInterface) { - throw new InvalidParamsException(Exception::REQUEST_NULL_ERROR); + throw new InvalidParamsException(Exception::REQUEST_EMPTY); } $rocket->setDestination(clone $request) diff --git a/src/Plugin/Wechat/Ecommerce/Refund/ApplyPlugin.php b/src/Plugin/Wechat/Ecommerce/Refund/ApplyPlugin.php index 64967dc00..f63d47a71 100644 --- a/src/Plugin/Wechat/Ecommerce/Refund/ApplyPlugin.php +++ b/src/Plugin/Wechat/Ecommerce/Refund/ApplyPlugin.php @@ -23,7 +23,7 @@ class ApplyPlugin extends GeneralPlugin */ protected function getUri(Rocket $rocket): string { - throw new InvalidParamsException(Exception::NOT_IN_SERVICE_MODE); + throw new InvalidParamsException(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); } protected function getPartnerUri(Rocket $rocket): string diff --git a/src/Plugin/Wechat/Ecommerce/Refund/QueryPlugin.php b/src/Plugin/Wechat/Ecommerce/Refund/QueryPlugin.php index 7a1cca142..dbf8da720 100644 --- a/src/Plugin/Wechat/Ecommerce/Refund/QueryPlugin.php +++ b/src/Plugin/Wechat/Ecommerce/Refund/QueryPlugin.php @@ -23,7 +23,7 @@ class QueryPlugin extends GeneralPlugin */ protected function getUri(Rocket $rocket): string { - throw new InvalidParamsException(Exception::NOT_IN_SERVICE_MODE); + throw new InvalidParamsException(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); } /** @@ -45,7 +45,7 @@ protected function getPartnerUri(Rocket $rocket): string return 'v3/ecommerce/refunds/out-refund-no/'.$payload->get('out_refund_no').'?sub_mchid='.$subMchId; } - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } protected function getMethod(): string diff --git a/src/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePlugin.php b/src/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePlugin.php index 503e440ae..cfe7cec56 100644 --- a/src/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePlugin.php +++ b/src/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePlugin.php @@ -23,7 +23,7 @@ class QueryReturnAdvancePlugin extends GeneralPlugin */ protected function getUri(Rocket $rocket): string { - throw new InvalidParamsException(Exception::NOT_IN_SERVICE_MODE); + throw new InvalidParamsException(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); } /** @@ -38,7 +38,7 @@ protected function getPartnerUri(Rocket $rocket): string $subMchId = $payload->get('sub_mchid', $config['sub_mch_id'] ?? ''); if (!$payload->has('refund_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/ecommerce/refunds/'.$payload->get('refund_id').'/return-advance?sub_mchid='.$subMchId; diff --git a/src/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePlugin.php b/src/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePlugin.php index 8270b2e05..be04937d3 100644 --- a/src/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePlugin.php +++ b/src/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePlugin.php @@ -24,7 +24,7 @@ class ReturnAdvancePlugin extends GeneralPlugin */ protected function getUri(Rocket $rocket): string { - throw new InvalidParamsException(Exception::NOT_IN_SERVICE_MODE); + throw new InvalidParamsException(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); } /** @@ -35,7 +35,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('refund_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/ecommerce/refunds/'.$payload->get('refund_id').'/return-advance'; diff --git a/src/Plugin/Wechat/Fund/Balance/QueryDayEndPlugin.php b/src/Plugin/Wechat/Fund/Balance/QueryDayEndPlugin.php index 961245223..9d2cc5953 100644 --- a/src/Plugin/Wechat/Fund/Balance/QueryDayEndPlugin.php +++ b/src/Plugin/Wechat/Fund/Balance/QueryDayEndPlugin.php @@ -26,7 +26,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('account_type') || !$payload->has('date')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant/fund/dayendbalance/'. diff --git a/src/Plugin/Wechat/Fund/Balance/QueryPlugin.php b/src/Plugin/Wechat/Fund/Balance/QueryPlugin.php index e76cea9da..03e3711dc 100644 --- a/src/Plugin/Wechat/Fund/Balance/QueryPlugin.php +++ b/src/Plugin/Wechat/Fund/Balance/QueryPlugin.php @@ -26,7 +26,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('account_type')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant/fund/balance/'. diff --git a/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php b/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php index 8fa9170ce..381d9aa8c 100644 --- a/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php +++ b/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php @@ -23,7 +23,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('download_url')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return $payload->get('download_url'); diff --git a/src/Plugin/Wechat/Fund/Profitsharing/QueryAmountsPlugin.php b/src/Plugin/Wechat/Fund/Profitsharing/QueryAmountsPlugin.php index 7bd73c748..09fc0d917 100644 --- a/src/Plugin/Wechat/Fund/Profitsharing/QueryAmountsPlugin.php +++ b/src/Plugin/Wechat/Fund/Profitsharing/QueryAmountsPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('transaction_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/profitsharing/transactions/'. diff --git a/src/Plugin/Wechat/Fund/Profitsharing/QueryPlugin.php b/src/Plugin/Wechat/Fund/Profitsharing/QueryPlugin.php index 141693cd7..c4ea593a6 100644 --- a/src/Plugin/Wechat/Fund/Profitsharing/QueryPlugin.php +++ b/src/Plugin/Wechat/Fund/Profitsharing/QueryPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($rocket->getParams()); if (!$payload->has('out_order_no') || !$payload->has('transaction_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $url = 'v3/profitsharing/orders/'. diff --git a/src/Plugin/Wechat/Fund/Profitsharing/QueryReturnPlugin.php b/src/Plugin/Wechat/Fund/Profitsharing/QueryReturnPlugin.php index a3e4888a8..c999a0ab1 100644 --- a/src/Plugin/Wechat/Fund/Profitsharing/QueryReturnPlugin.php +++ b/src/Plugin/Wechat/Fund/Profitsharing/QueryReturnPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($rocket->getParams()); if (!$payload->has('out_return_no') || !$payload->has('out_order_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $url = 'v3/profitsharing/return-orders/'. diff --git a/src/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPlugin.php b/src/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPlugin.php index add6ce2b1..34add7d82 100644 --- a/src/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPlugin.php @@ -22,7 +22,7 @@ protected function doSomething(Rocket $rocket): void $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } } diff --git a/src/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPlugin.php b/src/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPlugin.php index 882b37659..dfcb29b17 100644 --- a/src/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPlugin.php @@ -22,7 +22,7 @@ protected function doSomething(Rocket $rocket): void $payload = $rocket->getPayload(); if (!$payload->has('out_detail_no') || !$payload->has('accept_type')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } } diff --git a/src/Plugin/Wechat/Fund/Transfer/DownloadReceiptPlugin.php b/src/Plugin/Wechat/Fund/Transfer/DownloadReceiptPlugin.php index 1bd5025eb..2ebd8f4dc 100644 --- a/src/Plugin/Wechat/Fund/Transfer/DownloadReceiptPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/DownloadReceiptPlugin.php @@ -23,7 +23,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('download_url')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return $payload->get('download_url'); diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPlugin.php index b2251dd85..d0fb5053b 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('batch_id') || !$payload->get('detail_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/transfer/batches/batch-id/'. @@ -49,7 +49,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('batch_id') || !$payload->has('detail_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/partner-transfer/batches/batch-id/'. diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryBatchIdPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryBatchIdPlugin.php index c87a4f291..0b6c505d1 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryBatchIdPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryBatchIdPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('batch_id') || !$payload->has('need_query_detail')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $batchId = $payload->get('batch_id'); @@ -51,7 +51,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('batch_id') || !$payload->has('need_query_detail')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $batchId = $payload->get('batch_id'); diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPlugin.php index 5fdd9da89..6ccc72193 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/transfer/bill-receipt/'.$payload->get('out_batch_no'); diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPlugin.php index 39aa13f43..8c40dad80 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPlugin.php @@ -27,7 +27,7 @@ protected function doSomething(Rocket $rocket): void $payload = $rocket->getPayload(); if (!$payload->has('out_detail_no') || !$payload->has('accept_type')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $rocket->setPayload(null); diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPlugin.php index 199430bdf..39ca4b677 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no') || !$payload->has('out_detail_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/transfer/batches/out-batch-no/'. @@ -49,7 +49,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no') || !$payload->has('out_detail_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/partner-transfer/batches/out-batch-no/'. diff --git a/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPlugin.php b/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPlugin.php index ec5a19173..dba7b4241 100644 --- a/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPlugin.php +++ b/src/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no') || !$payload->has('need_query_detail')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $outBatchNo = $payload->get('out_batch_no'); @@ -51,7 +51,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_batch_no') || !$payload->has('need_query_detail')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $outBatchNo = $payload->get('out_batch_no'); diff --git a/src/Plugin/Wechat/LaunchPlugin.php b/src/Plugin/Wechat/LaunchPlugin.php index 071669589..e4c24258a 100644 --- a/src/Plugin/Wechat/LaunchPlugin.php +++ b/src/Plugin/Wechat/LaunchPlugin.php @@ -57,7 +57,7 @@ protected function validateResponse(Rocket $rocket): null|array|Collection|Messa if ($response instanceof ResponseInterface && ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300)) { - throw new InvalidResponseException(Exception::INVALID_RESPONSE_CODE); + throw new InvalidResponseException(Exception::RESPONSE_CODE_WRONG); } return $response; diff --git a/src/Plugin/Wechat/Marketing/Coupon/PausePlugin.php b/src/Plugin/Wechat/Marketing/Coupon/PausePlugin.php index 4e27fe158..0ba529539 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/PausePlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/PausePlugin.php @@ -42,7 +42,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'.$payload->get('stock_id').'/pause'; diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPlugin.php index c05a92352..e5bd43a9e 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($params); if (!$payload->has('coupon_id') || !$payload->has('openid')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/users/'. diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPlugin.php index d21d836ef..f258e1ffd 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($params); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'. diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPlugin.php index eefe524ce..f7b26eb53 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($params); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } if (!$payload->has('stock_creator_mchid')) { diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPlugin.php index 9f3278b87..d084d1087 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPlugin.php @@ -44,7 +44,7 @@ protected function getUri(Rocket $rocket): string } if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $query = $rocket->getPayload()->all(); diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPlugin.php index baff7acef..ccf4c93b4 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'. diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPlugin.php index a639158a2..deb735c6e 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'. diff --git a/src/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPlugin.php index 80496c017..1dd000832 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPlugin.php @@ -40,7 +40,7 @@ protected function getUri(Rocket $rocket): string $config = get_wechat_config($params); if (!$payload->has('openid')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } if (!$payload->has('appid')) { diff --git a/src/Plugin/Wechat/Marketing/Coupon/RestartPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/RestartPlugin.php index 602956ab1..1b4b310a4 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/RestartPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/RestartPlugin.php @@ -43,7 +43,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'.$payload->get('stock_id').'/restart'; diff --git a/src/Plugin/Wechat/Marketing/Coupon/SendPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/SendPlugin.php index cf9017e23..75395c6fd 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/SendPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/SendPlugin.php @@ -46,7 +46,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('openid')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/users/'.$payload->get('openid').'/coupons'; diff --git a/src/Plugin/Wechat/Marketing/Coupon/StartPlugin.php b/src/Plugin/Wechat/Marketing/Coupon/StartPlugin.php index f26ad4c69..a11198488 100644 --- a/src/Plugin/Wechat/Marketing/Coupon/StartPlugin.php +++ b/src/Plugin/Wechat/Marketing/Coupon/StartPlugin.php @@ -42,7 +42,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('stock_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/marketing/favor/stocks/'.$payload->get('stock_id').'/start'; diff --git a/src/Plugin/Wechat/Pay/Combine/ClosePlugin.php b/src/Plugin/Wechat/Pay/Combine/ClosePlugin.php index ec14c1e75..6e30f0d7f 100644 --- a/src/Plugin/Wechat/Pay/Combine/ClosePlugin.php +++ b/src/Plugin/Wechat/Pay/Combine/ClosePlugin.php @@ -23,7 +23,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('combine_out_trade_no') && !$payload->has('out_trade_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/combine-transactions/out-trade-no/'. diff --git a/src/Plugin/Wechat/Pay/Combine/QueryPlugin.php b/src/Plugin/Wechat/Pay/Combine/QueryPlugin.php index 580ff53b7..985ac493e 100644 --- a/src/Plugin/Wechat/Pay/Combine/QueryPlugin.php +++ b/src/Plugin/Wechat/Pay/Combine/QueryPlugin.php @@ -18,7 +18,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('combine_out_trade_no') && !$payload->has('transaction_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/combine-transactions/out-trade-no/'. diff --git a/src/Plugin/Wechat/Pay/Common/ClosePlugin.php b/src/Plugin/Wechat/Pay/Common/ClosePlugin.php index ec981dc9b..3bae7d737 100644 --- a/src/Plugin/Wechat/Pay/Common/ClosePlugin.php +++ b/src/Plugin/Wechat/Pay/Common/ClosePlugin.php @@ -26,7 +26,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_trade_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/pay/transactions/out-trade-no/'. @@ -42,7 +42,7 @@ protected function getPartnerUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_trade_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/pay/partner/transactions/out-trade-no/'. diff --git a/src/Plugin/Wechat/Pay/Common/DownloadBillPlugin.php b/src/Plugin/Wechat/Pay/Common/DownloadBillPlugin.php index a7651d74f..1dfd7459b 100644 --- a/src/Plugin/Wechat/Pay/Common/DownloadBillPlugin.php +++ b/src/Plugin/Wechat/Pay/Common/DownloadBillPlugin.php @@ -20,7 +20,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('download_url')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return $payload->get('download_url'); diff --git a/src/Plugin/Wechat/Pay/Common/QueryPlugin.php b/src/Plugin/Wechat/Pay/Common/QueryPlugin.php index 68071c7ec..2eddc68c8 100644 --- a/src/Plugin/Wechat/Pay/Common/QueryPlugin.php +++ b/src/Plugin/Wechat/Pay/Common/QueryPlugin.php @@ -37,7 +37,7 @@ protected function getUri(Rocket $rocket): string '?mchid='.($config['mch_id'] ?? ''); } - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } /** @@ -64,7 +64,7 @@ protected function getPartnerUri(Rocket $rocket): string '&sub_mchid='.$payload->get('sub_mchid', $config['sub_mch_id'] ?? null); } - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } protected function getMethod(): string diff --git a/src/Plugin/Wechat/Pay/Common/QueryRefundPlugin.php b/src/Plugin/Wechat/Pay/Common/QueryRefundPlugin.php index e30df7212..2265aa784 100644 --- a/src/Plugin/Wechat/Pay/Common/QueryRefundPlugin.php +++ b/src/Plugin/Wechat/Pay/Common/QueryRefundPlugin.php @@ -23,7 +23,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('out_refund_no')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/refund/domestic/refunds/'.$payload->get('out_refund_no'); diff --git a/src/Plugin/Wechat/RadarSignPlugin.php b/src/Plugin/Wechat/RadarSignPlugin.php index 0f20450cd..8993ec8a3 100644 --- a/src/Plugin/Wechat/RadarSignPlugin.php +++ b/src/Plugin/Wechat/RadarSignPlugin.php @@ -115,13 +115,13 @@ protected function v3GetWechatAuthorization(array $params, int $timestamp, strin $mchPublicCertPath = $config['mch_public_cert_path'] ?? null; if (empty($mchPublicCertPath)) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_public_cert_path]'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Missing Wechat Config -- [mch_public_cert_path]'); } $ssl = openssl_x509_parse(get_public_cert($mchPublicCertPath)); if (empty($ssl['serialNumberHex'])) { - throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Parse [mch_public_cert_path] Serial Number Error'); + throw new InvalidConfigException(Exception::WECHAT_CONFIG_INVALID, 'Parse [mch_public_cert_path] Serial Number Error'); } $auth = sprintf( @@ -144,7 +144,7 @@ protected function v3GetContents(Rocket $rocket, int $timestamp, string $random) $request = $rocket->getRadar(); if (is_null($request)) { - throw new InvalidParamsException(Exception::REQUEST_NULL_ERROR); + throw new InvalidParamsException(Exception::REQUEST_EMPTY); } $uri = $request->getUri(); diff --git a/src/Plugin/Wechat/Risk/Complaints/CompleteComplaintPlugin.php b/src/Plugin/Wechat/Risk/Complaints/CompleteComplaintPlugin.php index ca1554172..cbc10f23f 100644 --- a/src/Plugin/Wechat/Risk/Complaints/CompleteComplaintPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/CompleteComplaintPlugin.php @@ -44,7 +44,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('complaint_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant-service/complaints-v2/'. diff --git a/src/Plugin/Wechat/Risk/Complaints/DownloadMediaPlugin.php b/src/Plugin/Wechat/Risk/Complaints/DownloadMediaPlugin.php index b5e8ce3b0..ed6e0571b 100644 --- a/src/Plugin/Wechat/Risk/Complaints/DownloadMediaPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/DownloadMediaPlugin.php @@ -23,7 +23,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('media_url')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return $payload->get('media_url'); diff --git a/src/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPlugin.php b/src/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPlugin.php index 4c4fc4975..603aa5826 100644 --- a/src/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPlugin.php @@ -32,7 +32,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('complaint_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant-service/complaints-v2/'.$payload->get('complaint_id'); diff --git a/src/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPlugin.php b/src/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPlugin.php index 7aef299d1..4a3ec84c8 100644 --- a/src/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPlugin.php @@ -33,7 +33,7 @@ protected function getUri(Rocket $rocket): string $complaintId = $payload->get('complaint_id'); if (is_null($complaintId)) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } $payload->forget('complaint_id'); diff --git a/src/Plugin/Wechat/Risk/Complaints/ResponseComplaintPlugin.php b/src/Plugin/Wechat/Risk/Complaints/ResponseComplaintPlugin.php index b941e2bf9..4050676d6 100644 --- a/src/Plugin/Wechat/Risk/Complaints/ResponseComplaintPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/ResponseComplaintPlugin.php @@ -47,7 +47,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('complaint_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant-service/complaints-v2/'. diff --git a/src/Plugin/Wechat/Risk/Complaints/UpdateRefundPlugin.php b/src/Plugin/Wechat/Risk/Complaints/UpdateRefundPlugin.php index 66ff61c28..2e4b5ae2b 100644 --- a/src/Plugin/Wechat/Risk/Complaints/UpdateRefundPlugin.php +++ b/src/Plugin/Wechat/Risk/Complaints/UpdateRefundPlugin.php @@ -27,7 +27,7 @@ protected function getUri(Rocket $rocket): string $payload = $rocket->getPayload(); if (!$payload->has('complaint_id')) { - throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); + throw new InvalidParamsException(Exception::NECESSARY_PARAMS_MISSING); } return 'v3/merchant-service/complaints-v2/'. diff --git a/src/Plugin/Wechat/Shortcut/CloseShortcut.php b/src/Plugin/Wechat/Shortcut/CloseShortcut.php index a63cfccb9..e25fbd764 100644 --- a/src/Plugin/Wechat/Shortcut/CloseShortcut.php +++ b/src/Plugin/Wechat/Shortcut/CloseShortcut.php @@ -31,7 +31,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Query action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Query action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Plugin/Wechat/Shortcut/PapayShortcut.php b/src/Plugin/Wechat/Shortcut/PapayShortcut.php index b511d8566..e85dfe36c 100644 --- a/src/Plugin/Wechat/Shortcut/PapayShortcut.php +++ b/src/Plugin/Wechat/Shortcut/PapayShortcut.php @@ -29,7 +29,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}($params); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Papay action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Papay action [{$typeMethod}] not supported"); } /** diff --git a/src/Plugin/Wechat/Shortcut/QueryShortcut.php b/src/Plugin/Wechat/Shortcut/QueryShortcut.php index a1573d9d0..79772013b 100644 --- a/src/Plugin/Wechat/Shortcut/QueryShortcut.php +++ b/src/Plugin/Wechat/Shortcut/QueryShortcut.php @@ -32,7 +32,7 @@ public function getPlugins(array $params): array return $this->{$typeMethod}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Query action [{$typeMethod}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Query action [{$typeMethod}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 10ba80fe9..b021b7a07 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -88,7 +88,7 @@ public function ignite(Rocket $rocket): Rocket $http = Pay::get(HttpClientInterface::class); if (!$http instanceof ClientInterface) { - throw new InvalidConfigException(Exception::HTTP_CLIENT_CONFIG_ERROR); + throw new InvalidConfigException(Exception::HTTP_CLIENT_INVALID); } Logger::info('[AbstractProvider] 准备请求支付服务商 API', $rocket->toArray()); @@ -131,7 +131,7 @@ protected function verifyPlugin(array $plugins): void continue; } - throw new InvalidParamsException(Exception::PLUGIN_ERROR, "[{$plugin}] is not incompatible"); + throw new InvalidParamsException(Exception::PLUGIN_INCOMPATIBLE, "[{$plugin}] is not incompatible"); } } } diff --git a/src/Shortcut/Alipay/CancelShortcut.php b/src/Shortcut/Alipay/CancelShortcut.php index 29eea6dc5..a2eca9667 100644 --- a/src/Shortcut/Alipay/CancelShortcut.php +++ b/src/Shortcut/Alipay/CancelShortcut.php @@ -34,7 +34,7 @@ public function getPlugins(array $params): array return $this->{$method}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Cancel action [{$method}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Cancel action [{$method}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Shortcut/Alipay/CloseShortcut.php b/src/Shortcut/Alipay/CloseShortcut.php index b669de6bf..a2e14a6d0 100644 --- a/src/Shortcut/Alipay/CloseShortcut.php +++ b/src/Shortcut/Alipay/CloseShortcut.php @@ -37,7 +37,7 @@ public function getPlugins(array $params): array return $this->{$method}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Close action [{$method}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Close action [{$method}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Shortcut/Alipay/QueryShortcut.php b/src/Shortcut/Alipay/QueryShortcut.php index 080b809b4..65b360107 100644 --- a/src/Shortcut/Alipay/QueryShortcut.php +++ b/src/Shortcut/Alipay/QueryShortcut.php @@ -50,7 +50,7 @@ public function getPlugins(array $params): array return $this->{$method}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Query action [{$method}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Query action [{$method}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Shortcut/Alipay/RefundShortcut.php b/src/Shortcut/Alipay/RefundShortcut.php index aaf96cc60..e488283ad 100644 --- a/src/Shortcut/Alipay/RefundShortcut.php +++ b/src/Shortcut/Alipay/RefundShortcut.php @@ -38,7 +38,7 @@ public function getPlugins(array $params): array return $this->{$method}(); } - throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_ERROR, "Refund action [{$method}] not supported"); + throw new InvalidParamsException(Exception::SHORTCUT_MULTI_ACTION_INVALID, "Refund action [{$method}] not supported"); } protected function defaultPlugins(): array diff --git a/src/Traits/GetUnipayCerts.php b/src/Traits/GetUnipayCerts.php index a596b0c7a..76b42bd2e 100644 --- a/src/Traits/GetUnipayCerts.php +++ b/src/Traits/GetUnipayCerts.php @@ -28,7 +28,7 @@ public function getCertId(string $tenant, array $config): string $ssl = openssl_x509_parse($certs['cert'] ?? ''); if (false === $ssl) { - throw new InvalidConfigException(Exception::UNIPAY_CONFIG_ERROR, 'Parse `mch_cert_path` Error'); + throw new InvalidConfigException(Exception::UNIPAY_CONFIG_INVALID, 'Parse `mch_cert_path` Error'); } $certs['cert_id'] = $ssl['serialNumber'] ?? ''; @@ -49,11 +49,11 @@ protected function getCerts(array $config): array $password = $config['mch_cert_password'] ?? null; if (is_null($path) || is_null($password)) { - throw new InvalidConfigException(Exception::UNIPAY_CONFIG_ERROR, 'Missing Unipay Config -- [mch_cert_path] or [mch_cert_password]'); + throw new InvalidConfigException(Exception::UNIPAY_CONFIG_INVALID, 'Missing Unipay Config -- [mch_cert_path] or [mch_cert_password]'); } if (false === openssl_pkcs12_read(file_get_contents($path), $certs, $password)) { - throw new InvalidConfigException(Exception::UNIPAY_CONFIG_ERROR, 'Read `mch_cert_path` Error'); + throw new InvalidConfigException(Exception::UNIPAY_CONFIG_INVALID, 'Read `mch_cert_path` Error'); } return $certs; diff --git a/src/Traits/HasWechatEncryption.php b/src/Traits/HasWechatEncryption.php index c9adb60c6..3c2e093cc 100644 --- a/src/Traits/HasWechatEncryption.php +++ b/src/Traits/HasWechatEncryption.php @@ -53,7 +53,7 @@ public function getPublicKey(array $params, string $serialNo): string $publicKey = $config['wechat_public_cert_path'][$serialNo] ?? null; if (empty($publicKey)) { - throw new InvalidParamsException(Exception::WECHAT_SERIAL_NO_NOT_FOUND, 'Wechat serial no not found: '.$serialNo); + throw new InvalidParamsException(Exception::WECHAT_SERIAL_NOT_FOUND, 'Wechat serial no not found: '.$serialNo); } return $publicKey; diff --git a/tests/Direction/CollectionDirectionTest.php b/tests/Direction/CollectionDirectionTest.php index a05a6e46a..9d84e2fb7 100644 --- a/tests/Direction/CollectionDirectionTest.php +++ b/tests/Direction/CollectionDirectionTest.php @@ -33,7 +33,7 @@ public function testNormal() public function testResponseNull() { self::expectException(InvalidResponseException::class); - self::expectExceptionCode(Exception::RESPONSE_NONE); + self::expectExceptionCode(Exception::RESPONSE_EMPTY); $this->parser->guide(new JsonPacker(), null); } diff --git a/tests/Direction/OriginResponseDirectionTest.php b/tests/Direction/OriginResponseDirectionTest.php index 5220b450b..b3761fa45 100644 --- a/tests/Direction/OriginResponseDirectionTest.php +++ b/tests/Direction/OriginResponseDirectionTest.php @@ -22,7 +22,7 @@ protected function setUp(): void public function testResponseNull() { self::expectException(InvalidResponseException::class); - self::expectExceptionCode(Exception::INVALID_RESPONSE_CODE); + self::expectExceptionCode(Exception::RESPONSE_CODE_WRONG); $this->parser->guide(new JsonPacker(), null); } diff --git a/tests/FunctionTest.php b/tests/FunctionTest.php index 581ec8e81..df83ff3f5 100644 --- a/tests/FunctionTest.php +++ b/tests/FunctionTest.php @@ -78,7 +78,7 @@ public function testGetDirection() self::assertInstanceOf(DirectionInterface::class, get_direction(DirectionInterface::class)); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::INVALID_DIRECTION); + self::expectExceptionCode(Exception::DIRECTION_INVALID); get_direction('invalid'); } @@ -141,7 +141,7 @@ public function testVerifyAlipaySign() Pay::config(array_merge($config1, ['_force' => true])); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::ALIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::ALIPAY_CONFIG_INVALID); verify_alipay_sign([], '', ''); } @@ -205,7 +205,7 @@ public function testGetWechatSign() Pay::config(array_merge($config1, ['_force' => true])); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::WECHAT_CONFIG_ERROR); + self::expectExceptionCode(Exception::WECHAT_CONFIG_INVALID); get_wechat_sign([], '', ''); } @@ -225,7 +225,7 @@ public function testGetWechatSignV2() Pay::config(array_merge($config1, ['_force' => true])); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::WECHAT_CONFIG_ERROR); + self::expectExceptionCode(Exception::WECHAT_CONFIG_INVALID); get_wechat_sign_v2([], []); } @@ -377,7 +377,7 @@ public function testDecryptWechatResourceAes256Gcm() 'nonce' => '4196a5b75276', ]; self::expectException(InvalidResponseException::class); - self::expectExceptionCode(Exception::INVALID_REQUEST_ENCRYPTED_DATA); + self::expectExceptionCode(Exception::REQUEST_ENCRYPTED_DATA_INVALID); decrypt_wechat_resource_aes_256_gcm(base64_decode($resource['ciphertext']), 'foo', $resource['nonce'], $resource['associated_data']); } @@ -434,7 +434,7 @@ public function testVerifyUnipaySign() self::assertTrue(true); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::UNIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::UNIPAY_CONFIG_INVALID); self::expectExceptionMessage('Missing Unipay Config -- [unipay_public_cert_path]'); Pay::get(ConfigInterface::class)->set('unipay.default.unipay_public_cert_path', null); verify_unipay_sign([], $contents, $sign); diff --git a/tests/Plugin/Alipay/StartPluginTest.php b/tests/Plugin/Alipay/StartPluginTest.php index 51b8d13a6..2266dbfac 100644 --- a/tests/Plugin/Alipay/StartPluginTest.php +++ b/tests/Plugin/Alipay/StartPluginTest.php @@ -106,7 +106,7 @@ public function testMissingAppPublicCertPath() Pay::set(ConfigInterface::class, new Config()); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::ALIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::ALIPAY_CONFIG_INVALID); self::expectExceptionMessage('Missing Alipay Config -- [app_public_cert_path]'); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); @@ -121,7 +121,7 @@ public function testWrongAppPublicCertPath() Pay::set(ConfigInterface::class, $config); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::ALIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::ALIPAY_CONFIG_INVALID); self::expectExceptionMessage('Parse `app_public_cert_path` Error'); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); @@ -135,7 +135,7 @@ public function testMissingAlipayRootPath() $config->set('alipay.default.alipay_root_cert_path', null); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::ALIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::ALIPAY_CONFIG_INVALID); self::expectExceptionMessage('Missing Alipay Config -- [alipay_root_cert_path]'); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); @@ -149,7 +149,7 @@ public function testWrongAlipayRootPath() $config->set('alipay.default.alipay_root_cert_path', __DIR__.'/../../Cert/foo'); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::ALIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::ALIPAY_CONFIG_INVALID); self::expectExceptionMessage('Invalid alipay_root_cert'); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); diff --git a/tests/Plugin/Alipay/VerifySignaturePluginTest.php b/tests/Plugin/Alipay/VerifySignaturePluginTest.php index 74fd6764f..b531c65ea 100644 --- a/tests/Plugin/Alipay/VerifySignaturePluginTest.php +++ b/tests/Plugin/Alipay/VerifySignaturePluginTest.php @@ -60,7 +60,7 @@ public function testSignWrong() ->setDestination(new Collection($destination)); self::expectException(InvalidResponseException::class); - self::expectExceptionCode(Exception::INVALID_RESPONSE_SIGN); + self::expectExceptionCode(Exception::SIGN_INVALID); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/ParserPluginTest.php b/tests/Plugin/ParserPluginTest.php index b8c3ff13b..9ab3f54c0 100644 --- a/tests/Plugin/ParserPluginTest.php +++ b/tests/Plugin/ParserPluginTest.php @@ -32,7 +32,7 @@ protected function setUp(): void public function testWrongParser() { self::expectException(InvalidConfigException::class); - self::expectExceptionCode(InvalidConfigException::INVALID_DIRECTION); + self::expectExceptionCode(InvalidConfigException::DIRECTION_INVALID); $rocket = new Rocket(); $rocket->setDirection(FooParserStub::class); @@ -43,7 +43,7 @@ public function testWrongParser() public function testWrongPacker() { self::expectException(InvalidConfigException::class); - self::expectExceptionCode(InvalidConfigException::INVALID_PACKER); + self::expectExceptionCode(InvalidConfigException::PACKER_INVALID); $rocket = new Rocket(); $rocket->setPacker(FooPackerStub::class); diff --git a/tests/Plugin/Unipay/Shortcut/CancelShortcutTest.php b/tests/Plugin/Unipay/Shortcut/CancelShortcutTest.php index 84007a6c9..035771d07 100644 --- a/tests/Plugin/Unipay/Shortcut/CancelShortcutTest.php +++ b/tests/Plugin/Unipay/Shortcut/CancelShortcutTest.php @@ -50,7 +50,7 @@ public function testQrCode() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Cancel action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Unipay/Shortcut/PosShortcutTest.php b/tests/Plugin/Unipay/Shortcut/PosShortcutTest.php index 043a13ac9..c001b4fa9 100644 --- a/tests/Plugin/Unipay/Shortcut/PosShortcutTest.php +++ b/tests/Plugin/Unipay/Shortcut/PosShortcutTest.php @@ -51,7 +51,7 @@ public function testPreAuth() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Pos action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Unipay/Shortcut/QueryShortcutTest.php b/tests/Plugin/Unipay/Shortcut/QueryShortcutTest.php index b6e28ddc1..76145c6e0 100644 --- a/tests/Plugin/Unipay/Shortcut/QueryShortcutTest.php +++ b/tests/Plugin/Unipay/Shortcut/QueryShortcutTest.php @@ -50,7 +50,7 @@ public function testQrCode() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Query action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Unipay/Shortcut/ScanShortcutTest.php b/tests/Plugin/Unipay/Shortcut/ScanShortcutTest.php index ab1d210df..8e74fcb21 100644 --- a/tests/Plugin/Unipay/Shortcut/ScanShortcutTest.php +++ b/tests/Plugin/Unipay/Shortcut/ScanShortcutTest.php @@ -75,7 +75,7 @@ public function testFee() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Scan action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Wechat/Ecommerce/Refund/ApplyPluginTest.php b/tests/Plugin/Wechat/Ecommerce/Refund/ApplyPluginTest.php index 79fad7067..6b95fdf57 100644 --- a/tests/Plugin/Wechat/Ecommerce/Refund/ApplyPluginTest.php +++ b/tests/Plugin/Wechat/Ecommerce/Refund/ApplyPluginTest.php @@ -32,7 +32,7 @@ public function testNotInServiceMode() $rocket->setParams([])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::NOT_IN_SERVICE_MODE); + $this->expectExceptionCode(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } diff --git a/tests/Plugin/Wechat/Ecommerce/Refund/QueryPluginTest.php b/tests/Plugin/Wechat/Ecommerce/Refund/QueryPluginTest.php index a166a856b..6090fb24e 100644 --- a/tests/Plugin/Wechat/Ecommerce/Refund/QueryPluginTest.php +++ b/tests/Plugin/Wechat/Ecommerce/Refund/QueryPluginTest.php @@ -32,7 +32,7 @@ public function testNotInServiceMode() $rocket->setParams([])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::NOT_IN_SERVICE_MODE); + $this->expectExceptionCode(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } @@ -43,7 +43,7 @@ public function testMissingParams() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + $this->expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } diff --git a/tests/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePluginTest.php b/tests/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePluginTest.php index 4735a578f..2bdac018f 100644 --- a/tests/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePluginTest.php +++ b/tests/Plugin/Wechat/Ecommerce/Refund/QueryReturnAdvancePluginTest.php @@ -32,7 +32,7 @@ public function testNotInServiceMode() $rocket->setParams([])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::NOT_IN_SERVICE_MODE); + $this->expectExceptionCode(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } @@ -43,7 +43,7 @@ public function testMissingRefundId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + $this->expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } diff --git a/tests/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePluginTest.php b/tests/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePluginTest.php index e78b2c812..49bc9a99f 100644 --- a/tests/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePluginTest.php +++ b/tests/Plugin/Wechat/Ecommerce/Refund/ReturnAdvancePluginTest.php @@ -32,7 +32,7 @@ public function testNotInServiceMode() $rocket->setParams([])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::NOT_IN_SERVICE_MODE); + $this->expectExceptionCode(Exception::CURRENT_PLUGIN_ONLY_SUPPORT_SERVICE_MODE); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } @@ -43,7 +43,7 @@ public function testMissingParams() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection()); $this->expectException(InvalidParamsException::class); - $this->expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + $this->expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Balance/QueryDayEndPluginTest.php b/tests/Plugin/Wechat/Fund/Balance/QueryDayEndPluginTest.php index 253ee5a96..e4ea4537c 100644 --- a/tests/Plugin/Wechat/Fund/Balance/QueryDayEndPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Balance/QueryDayEndPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoAccountType() $rocket->setParams([])->setPayload(new Collection(['date' => '2021-10-23'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoDate() $rocket->setParams([])->setPayload(new Collection(['account_type' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Balance/QueryPluginTest.php b/tests/Plugin/Wechat/Fund/Balance/QueryPluginTest.php index 5d7bdc191..dafa08e77 100644 --- a/tests/Plugin/Wechat/Fund/Balance/QueryPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Balance/QueryPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoAccountType() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Profitsharing/DownloadBillPluginTest.php b/tests/Plugin/Wechat/Fund/Profitsharing/DownloadBillPluginTest.php index ad55548e7..febb92938 100644 --- a/tests/Plugin/Wechat/Fund/Profitsharing/DownloadBillPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Profitsharing/DownloadBillPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoDownloadUrl() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Profitsharing/QueryPluginTest.php b/tests/Plugin/Wechat/Fund/Profitsharing/QueryPluginTest.php index 5522b6082..981a98e2f 100644 --- a/tests/Plugin/Wechat/Fund/Profitsharing/QueryPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Profitsharing/QueryPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoOutTradeNo() $rocket->setParams([])->setPayload(new Collection(['transaction_id' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoTransactionId() $rocket->setParams([])->setPayload(new Collection(['out_order_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Profitsharing/QueryReturnPluginTest.php b/tests/Plugin/Wechat/Fund/Profitsharing/QueryReturnPluginTest.php index 494b3e52e..cf0d2edd4 100644 --- a/tests/Plugin/Wechat/Fund/Profitsharing/QueryReturnPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Profitsharing/QueryReturnPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoOutTradeNo() $rocket->setParams([])->setPayload(new Collection(['out_return_no' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoTransactionId() $rocket->setParams([])->setPayload(new Collection(['out_order_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPluginTest.php index 5276444d3..d2f9cfc99 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/CreateBillReceiptPluginTest.php @@ -46,7 +46,7 @@ public function testNormalNoOutBatchNo() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPluginTest.php index 48f07b43d..2ddc24960 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/CreateDetailReceiptPluginTest.php @@ -47,7 +47,7 @@ public function testNormalNoOutBatchNo() $rocket->setParams([])->setPayload(new Collection(['accept_type' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -58,7 +58,7 @@ public function testNormalNoAcceptType() $rocket->setParams([])->setPayload(new Collection(['out_detail_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/DownloadReceiptPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/DownloadReceiptPluginTest.php index e985fda16..31f774a0a 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/DownloadReceiptPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/DownloadReceiptPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoDownloadUrl() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPluginTest.php index 7d41fedf8..94b57db11 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryBatchDetailIdPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoBatchId() $rocket->setParams([])->setPayload(new Collection(['detail' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoDetailId() $rocket->setParams([])->setPayload(new Collection(['batch_id' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -80,7 +80,7 @@ public function testPartnerNoBatchId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['detail' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -91,7 +91,7 @@ public function testPartnerNoDetailId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['batch_id' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryBatchIdPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryBatchIdPluginTest.php index 726aef65d..a3045aaf6 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryBatchIdPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryBatchIdPluginTest.php @@ -44,7 +44,7 @@ public function testNormalNoBatchId() $rocket->setParams([])->setPayload(new Collection(['need_query_detail' => false])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -55,7 +55,7 @@ public function testNormalNoNeedQueryDetail() $rocket->setParams([])->setPayload(new Collection(['batch_id' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -81,7 +81,7 @@ public function testPartnerNoBatchId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['need_query_detail' => false])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -92,7 +92,7 @@ public function testPartnerNoNeedQueryDetail() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['batch_id' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPluginTest.php index 979ead13c..e461151c6 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryBillReceiptPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoOutBatchNo() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -69,7 +69,7 @@ public function testPartnerNoOutBatchNo() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPluginTest.php index 2664c8873..4348a9bec 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryDetailReceiptPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoOutDetailNo() $rocket->setParams([])->setPayload(new Collection(['accept_type' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoAcceptType() $rocket->setParams([])->setPayload(new Collection(['out_detail_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPluginTest.php index 39e5968d4..2e48ccacc 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchDetailNoPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoBatchId() $rocket->setParams([])->setPayload(new Collection(['out_detail_no' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -56,7 +56,7 @@ public function testNormalNoDetailId() $rocket->setParams([])->setPayload(new Collection(['out_batch_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -80,7 +80,7 @@ public function testPartnerNoBatchId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['out_detail_no' => '456'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -91,7 +91,7 @@ public function testPartnerNoDetailId() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['out_batch_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPluginTest.php b/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPluginTest.php index 0a952fee9..83edbcb21 100644 --- a/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPluginTest.php +++ b/tests/Plugin/Wechat/Fund/Transfer/QueryOutBatchNoPluginTest.php @@ -44,7 +44,7 @@ public function testNormalNoOutBatchNo() $rocket->setParams([])->setPayload(new Collection(['need_query_detail' => false])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -55,7 +55,7 @@ public function testNormalNoNeedQueryDetail() $rocket->setParams([])->setPayload(new Collection(['out_batch_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -81,7 +81,7 @@ public function testPartnerNoOutBatchNo() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['need_query_detail' => false])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } @@ -92,7 +92,7 @@ public function testPartnerNoNeedQueryDetail() $rocket->setParams(['_config' => 'service_provider'])->setPayload(new Collection(['out_batch_no' => '123'])); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/LaunchPluginTest.php b/tests/Plugin/Wechat/LaunchPluginTest.php index b24144581..04644ff29 100644 --- a/tests/Plugin/Wechat/LaunchPluginTest.php +++ b/tests/Plugin/Wechat/LaunchPluginTest.php @@ -61,7 +61,7 @@ public function testOriginalResponseCodeErrorDestination() $rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost')); self::expectException(InvalidResponseException::class); - self::expectExceptionCode(Exception::INVALID_RESPONSE_CODE); + self::expectExceptionCode(Exception::RESPONSE_CODE_WRONG); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPluginTest.php index a2da485ac..32d34ef39 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryCouponDetailPluginTest.php @@ -42,7 +42,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection([ 'coupon_id' => '123456', diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPluginTest.php index 826670f89..3403c87c8 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockDetailPluginTest.php @@ -41,7 +41,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPluginTest.php index 31ca2e5d1..82b919efe 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockItemsPluginTest.php @@ -42,7 +42,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPluginTest.php index 00576dec0..ca02b65dd 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockMerchantsPluginTest.php @@ -42,7 +42,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPluginTest.php index 3815cf8f8..7d61b29dc 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockRefundFlowPluginTest.php @@ -41,7 +41,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPluginTest.php index 99201fc86..19a2d9d9c 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryStockUseFlowPluginTest.php @@ -41,7 +41,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPluginTest.php index 06402da06..a73332234 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/QueryUserCouponsPluginTest.php @@ -42,7 +42,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/RestartPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/RestartPluginTest.php index 3eee2d718..d92344b70 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/RestartPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/RestartPluginTest.php @@ -43,7 +43,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/SendPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/SendPluginTest.php index e3d81095f..6ed04a009 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/SendPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/SendPluginTest.php @@ -46,7 +46,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Marketing/Coupon/StartPluginTest.php b/tests/Plugin/Wechat/Marketing/Coupon/StartPluginTest.php index d7a96089f..c0d52986e 100644 --- a/tests/Plugin/Wechat/Marketing/Coupon/StartPluginTest.php +++ b/tests/Plugin/Wechat/Marketing/Coupon/StartPluginTest.php @@ -43,7 +43,7 @@ public function testNormal() public function testException() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $rocket = (new Rocket())->setParams([])->setPayload(new Collection()); diff --git a/tests/Plugin/Wechat/Pay/Common/ClosePluginTest.php b/tests/Plugin/Wechat/Pay/Common/ClosePluginTest.php index 1bcdd8def..59e368451 100644 --- a/tests/Plugin/Wechat/Pay/Common/ClosePluginTest.php +++ b/tests/Plugin/Wechat/Pay/Common/ClosePluginTest.php @@ -46,7 +46,7 @@ public function testNormalNoOutTradeNo() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php b/tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php index f82822055..f2a93f776 100644 --- a/tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php +++ b/tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoDownloadUrl() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/RadarSignPluginTest.php b/tests/Plugin/Wechat/RadarSignPluginTest.php index 926fda110..dfe2e895f 100644 --- a/tests/Plugin/Wechat/RadarSignPluginTest.php +++ b/tests/Plugin/Wechat/RadarSignPluginTest.php @@ -135,7 +135,7 @@ public function testGetWechatAuthorizationMissingMchPublicCert() $config->set('wechat.default.mch_public_cert_path', null); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::WECHAT_CONFIG_ERROR); + self::expectExceptionCode(Exception::WECHAT_CONFIG_INVALID); self::expectExceptionMessage('Missing Wechat Config -- [mch_public_cert_path]'); $class = new ReflectionClass($this->plugin); @@ -166,7 +166,7 @@ public function testGetWechatAuthorizationWrongMchPublicCert() $config->set('wechat.default.mch_public_cert_path', __DIR__.'/../../Cert/foo'); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::WECHAT_CONFIG_ERROR); + self::expectExceptionCode(Exception::WECHAT_CONFIG_INVALID); self::expectExceptionMessage('Parse [mch_public_cert_path] Serial Number Error'); $class = new ReflectionClass($this->plugin); diff --git a/tests/Plugin/Wechat/Risk/Complaints/CompleteComplaintPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/CompleteComplaintPluginTest.php index 2105560e9..41f521d09 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/CompleteComplaintPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/CompleteComplaintPluginTest.php @@ -62,7 +62,7 @@ public function testMissingId() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket;}); } diff --git a/tests/Plugin/Wechat/Risk/Complaints/DownloadMediaPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/DownloadMediaPluginTest.php index b2a3b9464..565a23b72 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/DownloadMediaPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/DownloadMediaPluginTest.php @@ -45,7 +45,7 @@ public function testNormalNoDownloadUrl() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }); } diff --git a/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPluginTest.php index 648d7d43c..0db4b2b08 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintDetailPluginTest.php @@ -46,7 +46,7 @@ public function testMissingId() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket;}); } diff --git a/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPluginTest.php index fb892c27f..d9454a287 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/QueryComplaintNegotiationPluginTest.php @@ -46,7 +46,7 @@ public function testMissingId() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket;}); } diff --git a/tests/Plugin/Wechat/Risk/Complaints/ResponseComplaintPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/ResponseComplaintPluginTest.php index 0c84821fb..61c5165c7 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/ResponseComplaintPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/ResponseComplaintPluginTest.php @@ -62,7 +62,7 @@ public function testMissingId() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket;}); } diff --git a/tests/Plugin/Wechat/Risk/Complaints/UpdateRefundPluginTest.php b/tests/Plugin/Wechat/Risk/Complaints/UpdateRefundPluginTest.php index a52022081..f586622fd 100644 --- a/tests/Plugin/Wechat/Risk/Complaints/UpdateRefundPluginTest.php +++ b/tests/Plugin/Wechat/Risk/Complaints/UpdateRefundPluginTest.php @@ -46,7 +46,7 @@ public function testMissingId() $rocket->setParams([])->setPayload(new Collection()); self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS); + self::expectExceptionCode(Exception::NECESSARY_PARAMS_MISSING); $this->plugin->assembly($rocket, function ($rocket) {return $rocket;}); } diff --git a/tests/Plugin/Wechat/Shortcut/CloseShortcutTest.php b/tests/Plugin/Wechat/Shortcut/CloseShortcutTest.php index 26322b8d4..ba6393b50 100644 --- a/tests/Plugin/Wechat/Shortcut/CloseShortcutTest.php +++ b/tests/Plugin/Wechat/Shortcut/CloseShortcutTest.php @@ -70,7 +70,7 @@ public function testCombineParams() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Query action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Wechat/Shortcut/PapayShortcutTest.php b/tests/Plugin/Wechat/Shortcut/PapayShortcutTest.php index fd8c7b73e..e4aa48a4d 100644 --- a/tests/Plugin/Wechat/Shortcut/PapayShortcutTest.php +++ b/tests/Plugin/Wechat/Shortcut/PapayShortcutTest.php @@ -81,7 +81,7 @@ public function testApply() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Papay action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Plugin/Wechat/Shortcut/QueryShortcutTest.php b/tests/Plugin/Wechat/Shortcut/QueryShortcutTest.php index ce272c7e1..f4993cbc2 100644 --- a/tests/Plugin/Wechat/Shortcut/QueryShortcutTest.php +++ b/tests/Plugin/Wechat/Shortcut/QueryShortcutTest.php @@ -73,7 +73,7 @@ public function testCombineParams() public function testFoo() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); self::expectExceptionMessage('Query action [fooPlugins] not supported'); $this->plugin->getPlugins(['_action' => 'foo']); diff --git a/tests/Provider/AbstractProviderTest.php b/tests/Provider/AbstractProviderTest.php index 6f03ee294..be6f9c9d3 100644 --- a/tests/Provider/AbstractProviderTest.php +++ b/tests/Provider/AbstractProviderTest.php @@ -114,7 +114,7 @@ public function testIgniteWrongHttpClient() Pay::set(HttpClientInterface::class, new Collection()); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::HTTP_CLIENT_CONFIG_ERROR); + self::expectExceptionCode(Exception::HTTP_CLIENT_INVALID); $provider = new FooProviderStub(); $provider->ignite($rocket); diff --git a/tests/Shortcut/Alipay/CancelShortcutTest.php b/tests/Shortcut/Alipay/CancelShortcutTest.php index 3e77dac5a..426331465 100644 --- a/tests/Shortcut/Alipay/CancelShortcutTest.php +++ b/tests/Shortcut/Alipay/CancelShortcutTest.php @@ -33,7 +33,7 @@ protected function setUp(): void public function testFooParam() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); $this->shortcut->getPlugins(['_action' => 'foo']); } diff --git a/tests/Shortcut/Alipay/CloseShortcutTest.php b/tests/Shortcut/Alipay/CloseShortcutTest.php index 5150074ac..55f3ac7e6 100644 --- a/tests/Shortcut/Alipay/CloseShortcutTest.php +++ b/tests/Shortcut/Alipay/CloseShortcutTest.php @@ -36,7 +36,7 @@ protected function setUp(): void public function testFooParam() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); $this->shortcut->getPlugins(['_action' => 'foo']); } diff --git a/tests/Shortcut/Alipay/QueryShortcutTest.php b/tests/Shortcut/Alipay/QueryShortcutTest.php index 42bb0a753..b656f18f4 100644 --- a/tests/Shortcut/Alipay/QueryShortcutTest.php +++ b/tests/Shortcut/Alipay/QueryShortcutTest.php @@ -45,7 +45,7 @@ protected function setUp(): void public function testFooParam() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); $this->shortcut->getPlugins(['_action' => 'foo']); } diff --git a/tests/Shortcut/Alipay/RefundShortcutTest.php b/tests/Shortcut/Alipay/RefundShortcutTest.php index 766b8fb1f..c32336df6 100644 --- a/tests/Shortcut/Alipay/RefundShortcutTest.php +++ b/tests/Shortcut/Alipay/RefundShortcutTest.php @@ -37,7 +37,7 @@ protected function setUp(): void public function testFooParam() { self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_ERROR); + self::expectExceptionCode(Exception::SHORTCUT_MULTI_ACTION_INVALID); $this->shortcut->getPlugins(['_action' => 'foo']); } diff --git a/tests/Traits/GetUnipayCertsTest.php b/tests/Traits/GetUnipayCertsTest.php index 95336ec86..13fc819b9 100644 --- a/tests/Traits/GetUnipayCertsTest.php +++ b/tests/Traits/GetUnipayCertsTest.php @@ -41,7 +41,7 @@ public function testMissingCert() $config->set('unipay.default.mch_cert_path', null); $this->expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::UNIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::UNIPAY_CONFIG_INVALID); $this->expectExceptionMessage('Missing Unipay Config -- [mch_cert_path] or [mch_cert_password]'); $this->trait->getCertId('default', get_unipay_config([])); @@ -53,7 +53,7 @@ public function testMissingCertPassword() $config->set('unipay.default.mch_cert_password', null); $this->expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::UNIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::UNIPAY_CONFIG_INVALID); $this->expectExceptionMessage('Missing Unipay Config -- [mch_cert_path] or [mch_cert_password]'); $this->trait->getCertId('default', get_unipay_config([])); @@ -66,7 +66,7 @@ public function testWrongCert() $config->set('unipay.default.mch_cert_path', __DIR__.'/../Cert/foo'); self::expectException(InvalidConfigException::class); - self::expectExceptionCode(Exception::UNIPAY_CONFIG_ERROR); + self::expectExceptionCode(Exception::UNIPAY_CONFIG_INVALID); self::expectExceptionMessage('Read `mch_cert_path` Error'); $this->trait->getCertId('default', get_unipay_config([])); diff --git a/tests/Traits/HasWechatEncryptionTest.php b/tests/Traits/HasWechatEncryptionTest.php index 9f8a30446..15097b4de 100644 --- a/tests/Traits/HasWechatEncryptionTest.php +++ b/tests/Traits/HasWechatEncryptionTest.php @@ -79,7 +79,7 @@ public function testGetPublicKey() $serialNo = 'non-exist'; self::expectException(InvalidParamsException::class); - self::expectExceptionCode(Exception::WECHAT_SERIAL_NO_NOT_FOUND); + self::expectExceptionCode(Exception::WECHAT_SERIAL_NOT_FOUND); $this->trait->getPublicKey([], $serialNo); } }