diff --git a/src/Payment/Application/Service/TransactionService.php b/src/Payment/Application/Service/TransactionService.php index 5cf31a6..24945bb 100644 --- a/src/Payment/Application/Service/TransactionService.php +++ b/src/Payment/Application/Service/TransactionService.php @@ -5,11 +5,13 @@ namespace Paymentic\Sdk\Payment\Application\Service; use Exception; +use JsonException; use Paymentic\Sdk\Payment\Application\Contract\TransactionServiceContract; use Paymentic\Sdk\Payment\Application\DTO\CreateTransactionRequest; use Paymentic\Sdk\Payment\Application\DTO\CreateTransactionResponse; use Paymentic\Sdk\Payment\Application\Mapper\TransactionMapper; use Paymentic\Sdk\Payment\Domain\Entity\Transaction; +use Paymentic\Sdk\Shared\Exception\PaymenticException; use Paymentic\Sdk\Shared\Http\HttpClient; final readonly class TransactionService implements TransactionServiceContract @@ -19,6 +21,10 @@ public function __construct( ) { } + /** + * @throws PaymenticException + * @throws JsonException + */ public function create(string $pointId, CreateTransactionRequest $request): CreateTransactionResponse { $response = $this->httpClient->post( @@ -30,6 +36,8 @@ public function create(string $pointId, CreateTransactionRequest $request): Crea } /** + * @throws PaymenticException + * @throws JsonException * @throws Exception */ public function get(string $pointId, string $transactionId): Transaction @@ -41,6 +49,10 @@ public function get(string $pointId, string $transactionId): Transaction return TransactionMapper::fromArray($response['data']); } + /** + * @throws PaymenticException + * @throws JsonException + */ public function capture(string $pointId, string $transactionId): void { $this->httpClient->patch( diff --git a/src/Shared/Http/HttpClient.php b/src/Shared/Http/HttpClient.php index 597857b..d4ca2ee 100644 --- a/src/Shared/Http/HttpClient.php +++ b/src/Shared/Http/HttpClient.php @@ -24,6 +24,8 @@ public function __construct( /** * @param array $data * @return array + * @throws JsonException + * @throws PaymenticException */ public function post(string $uri, array $data = []): array { @@ -32,6 +34,8 @@ public function post(string $uri, array $data = []): array /** * @return array + * @throws JsonException + * @throws PaymenticException */ public function get(string $uri): array { @@ -41,6 +45,8 @@ public function get(string $uri): array /** * @param array $data * @return array + * @throws JsonException + * @throws PaymenticException */ public function patch(string $uri, array $data = []): array {