diff --git a/app/Libraries/NaverApiClient.php b/app/Libraries/NaverApiClient.php index a64c121..01618f3 100644 --- a/app/Libraries/NaverApiClient.php +++ b/app/Libraries/NaverApiClient.php @@ -31,6 +31,27 @@ class NaverApiClient return $this->request('PUT', $url, $updateData); } + /** + * [POST] 매물 정보 가격수정 + * @param string $articleNumber 매물번호 + * @param array $priceData 가격 수정 데이터 + * API:PATCH /kiso/center/verification-article/price/{매물번호}?charger={변경자} + * priceType int 가격유형 (DEAL:매매, WARRANTY:보증금, LEASE:월세, PRE_SALE:분양, PREMIUM:프리미엄, PRE_SALE_OPTION:분양옵션) + * dealAmount Int 매매금액 + * warrantyAmount Int 보증금 + * leaseAmount Int 월세금액 + * preSaleAmount Int 분양금액 + * premiumAmount Int 프리미엄금액 + * preSaleOptionAmount Int 분양옵션금액 + */ + public function postArticlePriceUpdate(string $articleNumber, array $priceData, string $charger = 'admin'): ?array + { + $this->charger = $charger; + $url = "{$this->baseUrl}/kiso/center/verification-article/price/{$articleNumber}?charger={$this->charger}"; + + return $this->request('POST', $url, $priceData); + } + public function submitSyncResult(string $reserveNoList): ?array { $url = "{$this->baseUrl}/site/submitSyncResult.nhn"; @@ -79,6 +100,17 @@ class NaverApiClient 'X-Naver-Client-Id: yqBbvQZ123_hjH3b3Df9' ]); } + } elseif ( $method === 'PATCH') { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); + if ($data) { + $payload = json_encode($data); + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', + 'Content-Length: ' . strlen($payload), + 'X-Naver-Client-Id: yqBbvQZ123_hjH3b3Df9' + ]); + } } $response = curl_exec($ch);