diff --git a/src/Api/ApiClient.php b/src/Api/ApiClient.php index d89d879..b6f5fc3 100644 --- a/src/Api/ApiClient.php +++ b/src/Api/ApiClient.php @@ -69,7 +69,9 @@ public function __construct() { * The response from the API. */ public function sendRequest( - string $method, string $endpoint, array $data = [] + string $method, + string $endpoint, + array $data = [] ): mixed { $timestamp = gmdate('c'); $authKey = $this->generateAuthKey($timestamp); diff --git a/src/Service/StatusCheckService.php b/src/Service/StatusCheckService.php index 21655ad..ace93d5 100644 --- a/src/Service/StatusCheckService.php +++ b/src/Service/StatusCheckService.php @@ -4,18 +4,39 @@ use QuickTopUpAPI\Api\ApiClient; -class StatusCheckService -{ - private $apiClient; +/** + * Class StatusCheckService + * + * @package QuickTopUpAPI\Service + * + * A simple service to check the status of a transaction. + */ +class StatusCheckService { + private ApiClient $apiClient; - public function __construct(ApiClient $apiClient) - { - $this->apiClient = $apiClient; - } + /** + * StatusCheckService constructor. + * + * @param ApiClient $apiClient + * The API client. + */ + public function __construct(ApiClient $apiClient) { + $this->apiClient = $apiClient; + } + + /** + * Check the status of a transaction. + * + * @param string $ctid + * The CTID. + * + * @return array + * The transaction status. + */ + public function checkStatus($ctid) { + $endpoint = 'WSGetTransactionStatus'; + + return $this->apiClient->sendRequest('POST', $endpoint, ['CTID' => $ctid]); + } - public function checkStatus($ctid) - { - $endpoint = 'WSGetTransactionStatus'; - return $this->apiClient->sendRequest('POST', $endpoint, ['CTID' => $ctid]); - } }