You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
681 B
26 lines
681 B
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Yansongda\Pay\Direction;
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Yansongda\Pay\Contract\DirectionInterface;
|
|
use Yansongda\Pay\Contract\PackerInterface;
|
|
use Yansongda\Pay\Exception\Exception;
|
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
|
|
|
class OriginResponseDirection implements DirectionInterface
|
|
{
|
|
/**
|
|
* @throws InvalidResponseException
|
|
*/
|
|
public function parse(PackerInterface $packer, ?ResponseInterface $response): ?ResponseInterface
|
|
{
|
|
if (!is_null($response)) {
|
|
return $response;
|
|
}
|
|
|
|
throw new InvalidResponseException(Exception::INVALID_RESPONSE_CODE);
|
|
}
|
|
}
|
|
|