first commit

This commit is contained in:
Mr.Qin
2022-08-19 19:48:37 +08:00
commit afdd648b65
3275 changed files with 631084 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use DI\FactoryInterface;
use Invoker\InvokerInterface;
interface ContainerInterface extends \Psr\Container\ContainerInterface, FactoryInterface, InvokerInterface
{
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface EventDispatcherInterface extends \Psr\EventDispatcher\EventDispatcherInterface
{
}

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use GuzzleHttp\ClientInterface;
interface HttpClientInterface extends ClientInterface, \Psr\Http\Client\ClientInterface
{
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface LoggerInterface extends \Psr\Log\LoggerInterface
{
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Psr\Http\Message\ResponseInterface;
interface ParserInterface
{
/**
* @return mixed
*/
public function parse(?ResponseInterface $response);
}

View File

@@ -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;
}

View File

@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Psr\Http\Message\ResponseInterface;
use Yansongda\Supports\Collection;
interface ProviderInterface
{
/**
* pay.
*
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function pay(array $plugins, array $params);
/**
* Quick road - Query an order.
*
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection
*/
public function find($order);
/**
* Quick road - Cancel an order.
*
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection|void
*/
public function cancel($order);
/**
* Quick road - Close an order.
*
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection|void
*/
public function close($order);
/**
* Quick road - Refund an order.
*
* @return array|\Yansongda\Supports\Collection
*/
public function refund(array $order);
/**
* Verify a request.
*
* @param array|\Psr\Http\Message\ServerRequestInterface|null $contents
*/
public function callback($contents = null, ?array $params = null): Collection;
/**
* Echo success to server.
*/
public function success(): ResponseInterface;
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Yansongda\Pay\Pay;
interface ServiceProviderInterface
{
/**
* register the service.
*/
public function register(Pay $pay, ?array $data = null): void;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface ShortcutInterface
{
/**
* @return \Yansongda\Pay\Contract\PluginInterface[]|string[]
*/
public function getPlugins(array $params): array;
}