Exception.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. declare(strict_types=1);
  3. namespace Yansongda\Pay\Exception;
  4. use Throwable;
  5. class Exception extends \Exception
  6. {
  7. public const UNKNOWN_ERROR = 9999;
  8. /*
  9. * 关于参数.
  10. */
  11. public const PARAMS_SHORTCUT_ACTION_INVALID = 9210;
  12. public const PARAMS_METHOD_NOT_SUPPORTED = 9211;
  13. public const PARAMS_WECHAT_PAPAY_TYPE_NOT_SUPPORTED = 9212;
  14. public const PARAMS_WECHAT_URL_MISSING = 9213;
  15. public const PARAMS_WECHAT_BODY_MISSING = 9214;
  16. public const PARAMS_WECHAT_SERIAL_NOT_FOUND = 9215;
  17. public const PARAMS_UNIPAY_URL_MISSING = 9216;
  18. public const PARAMS_UNIPAY_BODY_MISSING = 9217;
  19. public const PARAMS_NECESSARY_PARAMS_MISSING = 9218;
  20. public const PARAMS_PLUGIN_ONLY_SUPPORT_SERVICE_MODE = 9219;
  21. public const PARAMS_PLUGIN_ONLY_SUPPORT_NORMAL_MODE = 9220;
  22. public const PARAMS_CALLBACK_REQUEST_INVALID = 9221;
  23. public const PARAMS_DOUYIN_URL_MISSING = 9222;
  24. /**
  25. * 关于响应.
  26. */
  27. public const RESPONSE_CODE_WRONG = 9304;
  28. public const RESPONSE_MISSING_NECESSARY_PARAMS = 9305;
  29. public const RESPONSE_BUSINESS_CODE_WRONG = 9306;
  30. /*
  31. * 关于配置.
  32. */
  33. public const CONFIG_ALIPAY_INVALID = 9401;
  34. public const CONFIG_WECHAT_INVALID = 9402;
  35. public const CONFIG_UNIPAY_INVALID = 9403;
  36. public const CONFIG_JSB_INVALID = 9404;
  37. public const CONFIG_DOUYIN_INVALID = 9405;
  38. /**
  39. * 关于签名.
  40. */
  41. public const SIGN_ERROR = 9500;
  42. public const SIGN_EMPTY = 9501;
  43. /**
  44. * 关于加解密.
  45. */
  46. public const DECRYPT_ERROR = 9600;
  47. public const DECRYPT_WECHAT_CIPHERTEXT_PARAMS_INVALID = 9601;
  48. public const DECRYPT_WECHAT_ENCRYPTED_DATA_INVALID = 9602;
  49. public const DECRYPT_WECHAT_DECRYPTED_METHOD_INVALID = 9603;
  50. public const DECRYPT_WECHAT_ENCRYPTED_CONTENTS_INVALID = 9604;
  51. public mixed $extra;
  52. public function __construct(string $message = '未知异常', int $code = self::UNKNOWN_ERROR, mixed $extra = null, ?Throwable $previous = null)
  53. {
  54. $this->extra = $extra;
  55. parent::__construct($message, $code, $previous);
  56. }
  57. }