init
- 框架初始化 - 安装插件 - 修复PHP8.4报错
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class BusinessException extends GatewayException
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
*/
|
||||
public function __construct($message, $raw = [])
|
||||
{
|
||||
parent::__construct('ERROR_BUSINESS: '.$message, $raw, self::ERROR_BUSINESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
const UNKNOWN_ERROR = 9999;
|
||||
|
||||
const INVALID_GATEWAY = 1;
|
||||
|
||||
const INVALID_CONFIG = 2;
|
||||
|
||||
const INVALID_ARGUMENT = 3;
|
||||
|
||||
const ERROR_GATEWAY = 4;
|
||||
|
||||
const INVALID_SIGN = 5;
|
||||
|
||||
const ERROR_BUSINESS = 6;
|
||||
|
||||
/**
|
||||
* Raw error info.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $raw;
|
||||
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
* @param int|string $code
|
||||
*/
|
||||
public function __construct($message = '', $raw = [], $code = self::UNKNOWN_ERROR)
|
||||
{
|
||||
$message = '' === $message ? 'Unknown Error' : $message;
|
||||
$this->raw = is_array($raw) ? $raw : [$raw];
|
||||
|
||||
parent::__construct($message, intval($code));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class GatewayException extends Exception
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
* @param int $code
|
||||
*/
|
||||
public function __construct($message, $raw = [], $code = self::ERROR_GATEWAY)
|
||||
{
|
||||
parent::__construct('ERROR_GATEWAY: '.$message, $raw, $code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class InvalidArgumentException extends Exception
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
*/
|
||||
public function __construct($message, $raw = [])
|
||||
{
|
||||
parent::__construct('INVALID_ARGUMENT: '.$message, $raw, self::INVALID_ARGUMENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class InvalidConfigException extends Exception
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
*/
|
||||
public function __construct($message, $raw = [])
|
||||
{
|
||||
parent::__construct('INVALID_CONFIG: '.$message, $raw, self::INVALID_CONFIG);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class InvalidGatewayException extends Exception
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
*/
|
||||
public function __construct($message, $raw = [])
|
||||
{
|
||||
parent::__construct('INVALID_GATEWAY: '.$message, $raw, self::INVALID_GATEWAY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
class InvalidSignException extends Exception
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @author yansongda <me@yansonga.cn>
|
||||
*
|
||||
* @param string $message
|
||||
* @param array|string $raw
|
||||
*/
|
||||
public function __construct($message, $raw = [])
|
||||
{
|
||||
parent::__construct('INVALID_SIGN: '.$message, $raw, self::INVALID_SIGN);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user