init
- 框架初始化 - 安装插件 - 修复PHP8.4报错
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface ConfigInterface
|
||||
{
|
||||
/**
|
||||
* @param mixed $default default value of the entry when does not found
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key, $default = null);
|
||||
|
||||
public function has(string $key): bool;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set(string $key, $value): void;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface ContainerInterface extends \Psr\Container\ContainerInterface
|
||||
{
|
||||
/**
|
||||
* factory make.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function make(string $name, ?array $parameters = []);
|
||||
|
||||
/**
|
||||
* @param mixed $entry
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function set(string $name, $entry);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
interface DirectionInterface
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function parse(PackerInterface $packer, ?ResponseInterface $response);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface EventDispatcherInterface extends \Psr\EventDispatcher\EventDispatcherInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
|
||||
interface HttpClientInterface extends ClientInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface LoggerInterface extends \Psr\Log\LoggerInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface PackerInterface
|
||||
{
|
||||
public function pack(array $payload): string;
|
||||
|
||||
public function unpack(string $payload): ?array;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Closure;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
interface PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Yansongda\Pay\Exception\ContainerException;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
interface ProviderInterface
|
||||
{
|
||||
/**
|
||||
* @return null|array|Collection|MessageInterface
|
||||
*
|
||||
* @throws ContainerException
|
||||
* @throws InvalidParamsException
|
||||
* @throws ServiceNotFoundException
|
||||
*/
|
||||
public function pay(array $plugins, ?array $params);
|
||||
|
||||
/**
|
||||
* @param array|string $order
|
||||
*
|
||||
* @return array|Collection
|
||||
*/
|
||||
public function find($order);
|
||||
|
||||
/**
|
||||
* @param array|string $order
|
||||
*
|
||||
* @return array|Collection|void
|
||||
*/
|
||||
public function cancel($order);
|
||||
|
||||
/**
|
||||
* @param array|string $order
|
||||
*
|
||||
* @return array|Collection|void
|
||||
*/
|
||||
public function close($order);
|
||||
|
||||
/**
|
||||
* @return array|Collection
|
||||
*/
|
||||
public function refund(array $order);
|
||||
|
||||
/**
|
||||
* @param null|array|ServerRequestInterface $contents
|
||||
*/
|
||||
public function callback($contents = null, ?array $params = null): Collection;
|
||||
|
||||
public function success(): ResponseInterface;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Yansongda\Pay\Exception\ContainerException;
|
||||
|
||||
interface ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* @param mixed $data
|
||||
*
|
||||
* @throws ContainerException
|
||||
*/
|
||||
public function register($data = null): void;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
interface ShortcutInterface
|
||||
{
|
||||
/**
|
||||
* @return PluginInterface[]|string[]
|
||||
*/
|
||||
public function getPlugins(array $params): array;
|
||||
}
|
||||
Reference in New Issue
Block a user