diff --git a/src/Moadian.php b/src/Moadian.php index a336db6..af4f4e1 100644 --- a/src/Moadian.php +++ b/src/Moadian.php @@ -27,6 +27,7 @@ public function __construct($privateKey, $certificate, $baseUri ='https://tp.tax $this->client = new Client([ 'base_uri' => $baseUri, 'headers' => ['Content-Type' => 'application/json'], + 'timeout' => 60 ]); $this->signer = new SignatureService($privateKey, $certificate); $this->encryptor = new EncryptionService(); @@ -43,8 +44,9 @@ public function sendRequest(Request $request) { $request->prepare($this->signer, $this->encryptor); + $body = !empty($request->getBody()) ? json_encode($request->getBody()) : null; $httpResp = $this->client->request($request->method, $request->path, [ - 'body' => json_encode($request->getBody()), + 'body' => $body, 'headers' => $request->getHeaders(), 'query' => $request->getParams() ]);