responseFactory = $responseFactory; $this->clientFactory = $clientFactory; } /** * @param string $expressNo * @return array * @throws LocalizedException */ public function getExpressInfo(string $expressNo){ /** @var Client $client */ $client = $this->clientFactory->create(['config' => [ 'base_uri' => self::EXPRESS_REQUEST_URI ]]); try { $response = $client->request( 'GET', 'kdwlcx/?no='.$expressNo, ['headers'=>['Authorization' => 'APPCODE '.self::APPCODE]] ); } catch (GuzzleException $exception) { throw new LocalizedException(__($exception->getMessage())); } $result = json_decode($response->getBody()->getContents(), true); if ($result['status']==0) { return (array)$result['result']; } throw new LocalizedException(__($result['msg'])); } }