Files
confirms/app/Services/NaverService.php
2026-01-23 21:40:56 +09:00

624 lines
28 KiB
PHP

<?php
namespace App\Services;
use CodeIgniter\CLI\CLI;
use App\Libraries\NaverApiClient;
use App\Models\Entities\VrfcReqModel;
use App\Models\Entities\V2articleinfoModel;
use App\Models\Entities\V2articleinfoetcModel;
use App\Models\Entities\V2stdailyModel;
use App\Models\Entities\NaverRawStagingModel;
use App\Models\Entities\ReceiptModel;
use App\Models\Entities\ResultModel;
use App\Services\StatusService; // 추가
use Exception;
class NaverService
{
protected $db;
protected $naverClient;
protected $VrfcReqModel;
protected $V2stdailyModel;
protected $statusService;
protected $rawStagingModel;
protected $receiptModel;
protected $resultModel;
protected $articleModel;
protected $articleEtcModel;
public function __construct()
{
$this->db = \Config\Database::connect();
helper('log');
}
/**
* 모델/서비스 지연 로딩 (Null 에러 방지 핵심)
*/
private function getStatusService() {
return $this->statusService ??= new StatusService();
}
private function getModel($property, $class) {
return $this->$property ??= new $class();
}
/**
* NaverApiClient 지연 로딩
*/
private function getNaverClient()
{
if ($this->naverClient === null) {
$this->naverClient = new \App\Libraries\NaverApiClient();
}
return $this->naverClient;
}
/**
* 메인 프로세스: 요청 타입에 따른 분기 처리
*/
public function processArticle(array $payload)
{
$articleNumber = $payload['articleNumber'];
$requestType = $payload['requestType'] ?? '';
CLI::write(CLI::color('🟢 getArticleInfo Start :: ' . $articleNumber , 'green'));
// 1. 네이버 API 호출
$response = $this->getNaverClient()->getArticleInfo($articleNumber);
if (!$response || $response['code'] !== 'success') {
throw new \Exception("네이버 API 응답 에러: $articleNumber");
}
$rawData = $response['data'];
$vType = $rawData['verificationTypeCode'] ?? '';
// [Staging] 원본 저장
$this->getModel('rawStagingModel', NaverRawStagingModel::class)->insert([
'atcl_no' => $articleNumber,
'verification_type' => $vType,
'request_type' => $requestType,
'raw_json' => $rawData
]);
CLI::write(CLI::color('🟢 임시테이블 :: ' . $this->rawStagingModel->getLastQuery() , 'green'));
// 3. 타입별 분기 처리
if ($vType === 'S') {
// [Type S] 현장확인 응답 처리 (A01 등)
return $this->processTypeS($articleNumber, $rawData, $payload);
} else {
// [Type D/기타] 서류확인/비공동 처리 (D04, F01 등)
return $this->processTypeV2($articleNumber, $rawData, $payload);
}
// $vrfcParams = $this->mapToDatabaseParams($response['data'], $payload);
// write_custom_log("PROCESS_START | Type: $requestType | Atcl: $articleNumber", 'INFO', 'service');
// switch ($requestType) {
// case 'REG': // 신규 등록
// $vr_sq = $this->insertVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], $vrfcParams['vrfc_type'] . '0103', '1', 'add');
// break;
// case 'MOD': // 수정
// $vr_sq = $this->updateVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], $vrfcParams['vrfc_type'] . '0102', '1', 'add');
// break;
// case 'CNC': // 취소
// $vr_sq = $this->deleteVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], 'A0101', '1', 'add');
// break;
// // case 'FIN': // 완료
// // $vr_sq = $this->finVrfcReq($articleNumber, $vrfcParams);
// // if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], 'A0101', '1', 'add');
// // break;
// default:
// throw new \Exception("알 수 없는 requestType: $requestType");
// }
// return ['vr_sq' => $vr_sq, 'articleNumber' => $articleNumber];
}
/**
* [Type S] 현장확인 응답 처리 (A01 등)
*/
private function processTypeS($articleNumber, $rawData, $payload)
{
$now = db_now();
// 시작 전 트랜잭션
$this->db->transStart();
switch ( trim($rawData['tradeType']) ) {
case '매매': $trade_type = 'A1'; break;
case '전세': $trade_type = 'B1'; break;
case '월세': $trade_type = 'B2'; break;
case '단기임대': $trade_type = 'B3'; break;
}
/* 좌표와 전용면적을 기준으로 */
if( in_array($rawData['realEstateTypeCode'], array('C01', 'C02'))){
$ground_plan = 'N';
} else {
$ground_plan = 'Y';
}
try {
// 1. receipt 데이터 준비
$receiptData = [
'comp_sq' => '2',
'rcpt_rating' => '3',
'rcpt_key' => $articleNumber,
'rcpt_atclno' => $articleNumber,
'rcpt_product' => $rawData['realEstateTypeCode'] ?? null,
'rcpt_product_nm' => $rawData['realEstateType'] ?? null,
'rcpt_product_info1'=> $rawData['tradeType'] ?? null,
'rcpt_product_info2'=> $rawData['price']['dealAmount'] ?? '0',
'rcpt_product_info4'=> $rawData['price']['preSaleAmount'] ?? '0',
'rcpt_product_info5'=> $rawData['price']['premiumAmount'] ?? '0',
'rcpt_living_yn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
'rcpt_agent' => $rawData['realtor']['realtorName'] ?? null,
'rcpt_sido' => mb_substr($rawData['address']['legalDivision']['cityNumber'] ?? '', 0, 5),
'rcpt_gugun' => mb_substr($rawData['address']['legalDivision']['divisionNumber'] ?? '', 0, 10),
'rcpt_dong' => $rawData['address']['legalDivision']['sectorNumber'] ?? null,
'rcpt_hscp_nm' => $rawData['address']['complexName'] ?? null,
'rcpt_hscp_no' => $rawData['address']['complexNumber'] ?? null,
'rcpt_ptp_nm' => null,
'rcpt_ptp_no' => $rawData['address']['pyeongTypeNumber'] ?? null,
'rcpt_dtl_addr' => trim(($rawData['address']['legalDivision']['legalDivisionAddress'] ?? '') . $rawData['address']['buildingName'] . '동 ' . ($rawData['address']['hoName'] ?? '') . '호'),
'rcpt_etc_addr' => $rawData['address']['hoName'] ?? null,
'rcpt_floor' => $rawData['floor']['correspondenceFloorCount'] ?? null,
'rcpt_floor2' => $rawData['floor']['totalFloorCount'] ?? null,
'rcpt_exps_type' => '',
'rcpt_exp_photo_yn' => 'Y',
'rcpt_deal_type' => $rawData['tradeTypeCode'] ?? null,
'rcpt_product_nm' => $rawData['tradeType'] ?? null,
'trade_type' => $trade_type ?? null,
'ground_plan' => $ground_plan,
'excls_spce' => $rawData['space']['exclusiveSpace'] ?? null,
'sply_spc' => $rawData['space']['supplySpace'] ?? null,
'tot_spc' => $rawData['space']['totalSpace'] ?? null,
'grnd_spc' => $rawData['space']['groundSpace'] ?? null,
'bldg_spc' => $rawData['space']['buildingSpace'] ?? null,
'share_spc' => $rawData['space']['supplySpace']-$rawData['space']['exclusiveSpace'] ?? null,
'room_cnt' => $rawData['facilities']['roomCount'] ?? null,
'cupnNo' => $rawData['couponNumber'] ?? null,
'roomSiteAtclRgstCnt' => $rawData['site']['monthlyRegisterCount'] ?? null,
'roomSiteAtclExpsCnt' => $rawData['site']['monthlyExposureCount'] ?? null,
'direct_trad_yn' => ($rawData['seller']['isDirectTrade'] ?? false) ? 'Y' : 'N',
'sellr_nm' => $rawData['seller']['sellerName'] ?? null,
'sellr_tel_no' => $rawData['seller']['sellerTelephoneNumber'] ?? null,
'rcpt_ref_addr' => $rawData['address']['etcAddress'] ?? null,
'rcpt_tm' => $now,
'rcpt_stat' => '100000',
'rcpt_x' => $rawData['address']['longitude'] ?? null,
'rcpt_y' => $rawData['address']['latitude'] ?? null,
'agent_id' => '',
'agent_nm' => $rawData['realtor']['realtorName'] ?? null,
'agent_head_tel' => $rawData['realtor']['representativeCellphoneNumber'] ?? null,
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00', // 컬럼명이 rsrv_tm_ap 인지 확인 필요 (제공해주신 스키마 기준)
'insert_tm' => $now,
'rcpt_cpid' => $rawData['cpId'] ?? 'naver',
'room_cnt' => $rawData['facilities']['roomCount'] ?? null,
'isSiteVRVerification' => ($rawData['site']['isVrVerification'] ?? false) ? 'Y' : 'N',
'isPromotionApply' => ($rawData['site']['isVrRepresentativeApply'] ?? false) ? 'Y' : 'N',
];
if (!$this->receiptModel->insert($receiptData)) {
throw new \Exception("Receipt Insert 실패: " . json_encode($this->receiptModel->errors()));
}
$rcpt_sq = $this->receiptModel->getInsertID();
if ( $receiptData['isVrVerification'] == "Y") {
$dept_sq = '29';
$usr_sq = '1993';
}
// 2. result 데이터 준비
$resultData = [
'rcpt_sq' => $rcpt_sq,
'use_yn' => 'Y',
'cust_nm' => '',
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00', // 컬럼명이 rsrv_tm_ap 인지 확인 필요 (제공해주신 스키마 기준)
'result_cd1' => '10',
'result_cd2' => '1000',
'result_cd3' => '100000',
'insert_tm' => $now,
'insert_usr' => 0,
'update_tm' => $now,
'update_usr' => 0,
'dept_sq' => $dept_sq, // 필요 시 매핑 로직 추가
'usr_sq' => $usr_sq, // 필요 시 매핑 로직 추가
'resYn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
];
if (!$this->resultModel->insert($resultData)) {
throw new \Exception("Result Insert 실패");
}
$this->db->transComplete();
// 성공 로그 생성 쿼리 포함
write_custom_log("Type S 처리 성공 | Atcl: $articleNumber | Rcpt_sq: $rcpt_sq", 'INFO', 'service');
write_custom_log("Receipt Insert SQL: " . (string)$this->receiptModel->getLastQuery(), 'INFO', 'service');
write_custom_log("Result Insert SQL: " . (string)$this->resultModel->getLastQuery(), 'INFO', 'service');
// 예약 정보 동기화 전송
$return = $this->naverClient->submitSyncResult($rawData['reserveNo']);
write_custom_log("Naver Sync Result Response: " . json_encode($return), 'INFO', 'service');
// transComplete 이후에 transStatus를 확인하는 것이 CI4의 표준입니다.
if ($this->db->transStatus() === false) {
// transComplete가 실패하면 자동으로 롤백되지만, 명시적 예외 처리가 안전합니다.
// 로그 남기기
write_custom_log("Type S DB 트랜잭션 최종 실패", 'ERROR', 'service');
throw new \Exception("Type S DB 트랜잭션 최종 실패");
}
return $rcpt_sq;
} catch (\Exception $e) {
// 이미 transComplete 내부에서 실패 시 롤백되지만, 예외 발생 시 수동 롤백 보장
// if ($this->db->transEnabled()) {
$this->db->transRollback();
// }
throw $e;
}
}
/**
* [Type V2] 일반/서류/비공동주택 처리 로직
*/
private function processTypeV2($articleNumber, $rawData, $payload)
{
CLI::write(CLI::color('🟢 V2_VRFC_REQ :: START ' , 'green'));
$vrfcParam = $this->v2Parameter($articleNumber, $rawData, $payload);
$articleInfoParam = $this->articleInfoParameter($articleNumber, $rawData, $payload);
$articleInfoEtcParam = $this->articleInfoEtcParameter($articleNumber, $rawData, $payload);
try {
switch ($payload['requestType']){
case "REG":
$vr_sq = $this->insertVrfcReq($vrfcParam);
$articleInfoParam['vr_sq'] = $vr_sq;
write_custom_log("articleInfoParam :: " . json_encode($articleInfoParam, JSON_UNESCAPED_UNICODE) , "INFO", "SERVICE");
if (!$this->getModel('articleModel', V2articleinfoModel::class)->insert($articleInfoParam)) {
throw new \Exception("ArticleInfo Insert 실패: " . json_encode($this->db->error()));
}
$articleInfoEtcParam['vr_sq'] = $vr_sq;
if (!$this->getModel('articleEtcModel', V2articleinfoetcModel::class)->insert($articleInfoEtcParam)) {
throw new \Exception("ArticleInfoEtc Insert 실패");
}
break;
case "MOD":
break;
case "CNC":
break;
}
} catch (\Exception $e) {
write_custom_log("CRITICAL_ERROR :: " . $e->getMessage(), "ERROR", "SERVICE");
throw $e;
}
}
/**
* [REG] 신규 등록
*/
private function insertVrfcReq($vrfcParam)
{
CLI::write(CLI::color('🟢 매물 정보 시작', 'green'));
$model = $this->getModel('VrfcReqModel', VrfcReqModel::class);
$existing = $model->where('atcl_no', $vrfcParam['atcl_no'])->first();
if ($existing) throw new \Exception("중복 등록 시도: " . $vrfcParam['atcl_no']);
if (!$model->insert($vrfcParam)) {
$dbError = $this->db->error();
$lastQuery = (string)$model->getLastQuery();
// 🚨 에러 발생 시 상세 정보 출력
CLI::write(CLI::color('❌ SQL INSERT ERROR', 'red', 'bold'));
CLI::write(CLI::color('메시지: ', 'white') . $dbError['message']);
CLI::write(CLI::color('쿼리 실행: ', 'white') . (string)$model->getLastQuery());
// 입력하려던 데이터 덤프 (디버깅용)
CLI::write(CLI::color('입력 데이터:', 'yellow'));
print_r($vrfcParam);
throw new \Exception("신규 등록 실패: " . $dbError['message']);
}
$vr_sq = $model->getInsertID();
CLI::write(CLI::color("✅ Insert 성공 (vr_sq: $vr_sq)", 'blue'));
// 🟢 여기서 Null 에러 방지 (getStatusService 사용)
$this->getStatusService()->recordStatusAndHistory($vr_sq, '10', 'C9', "NEW 신규접수 : 10");
return $vr_sq;
}
private function v2Parameter($articleNumber, $rawData , $payload){
$now = db_now();
$step = isset($rawData['step']) ? $rawData['step'] : '00';
$rdate = $payload['requestDate'] ?? db_now('YmdHis');
$insert_user = 0;
$stat_cd = '10';
$sync_yn = 'N';
$insert_tm = $now;
$reg_type = function($payload) {
switch ($payload['requestType'] ?? '') {
case 'REG': return 'C';
case 'MOD': return 'U';
case 'CNC': return 'D';
default: return '0';
}
};($payload);
$files = $rawData['files'] ?? [];
$certRegister = [];
$confirm_doc_img_url = [];
$referenceFileUrl = [];
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'];
if ($fileTypeCode == 'RCDOC') {
$certRegister[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'ADDOC') {
$confirm_doc_img_url[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'REFER') {
$referenceFileUrl[] = $file['originalFileUrl'];
}
}
// 1. v2_vrfc_req (검증요청) 데이터 준비
$vrfcReqData = [
'reqSeq' => '', // 네이버 요청 고유 ID
'atcl_no' => $articleNumber,
'step' => $step, // 기본 단계 설정
'cpid' => $rawData['cpId'] ?? 'naver',
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? '',
'trade_type' => $rawData['tradeTypeCode'] ?? '',
'realtor_nm' => $rawData['realtor']['realtorName'] ?? null,
'realtor_tel_no' => $rawData['realtor']['representativeCellphoneNumber'] ?? null,
'seller_tel_no' => $rawData['seller']['cellphoneNumber'] ?? null,
'vrfc_type' => $rawData['verificationTypeCode'] ?? 'D', // D, T, P 등
'rgbk_confirm' => null,
'req_type' => $reg_type($payload), // 등록:C, 수정:U, 취소:D
'rdate' => $rdate,
'cpTelNo' => null,
'stat_cd' => $stat_cd, // 초기 대기 상태
'insert_user' => $insert_user,
'insert_tm' => $insert_tm,
'sync_yn' => $sync_yn,
'rgbk_confirm_owner_nm' => null,
'direct_trad_yn' => ($rawData['seller']['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode($confirm_doc_img_url),
'confirm_doc_owner_check_yn' => null,
'certRegister' => json_encode($certRegister),
'referenceFileUrl' => json_encode($referenceFileUrl),
];
return $vrfcReqData;
}
private function articleInfoParameter($articleNumber, $rawData , $payload){
// JSON 객체 안전하게 로드
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
$files = $rawData['realtor']['file'] ?? [];
$certRegister = [];
$confirm_doc_img_url = [];
$referenceFileUrl = [];
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'];
if ($fileTypeCode == 'RCDOC') {
$certRegister[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'ADDOC') {
$confirm_doc_img_url[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'REFER') {
$referenceFileUrl[] = $file['originalFileUrl'];
}
}
$ownerTypeCodeRaw = $rawData['ownerTypeCode'] ?? null;
$ownerTypeCode = match($ownerTypeCodeRaw) {
"INDIV" => 0,
"CORP" => 1,
"FRGNR" => 2,
"DELEG" => 3,
default => null,
};
$ownerCheckYn = ($seller['isOwnerCertificationAgree'] ?? false) ? 'Y' : 'N';
return [
// 'vr_sq' => $vr_sq,
'atcl_no' => $articleNumber,
'cpid' => $rawData['cpId'] ?? null,
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? null,
'rlet_type_cd' => $rawData['realEstateTypeCode'] ?? null,
'trade_type' => $rawData['tradeTypeCode'] ?? null,
'address_code' => $address['legalDivision']['sectorNumber'] ?? null,
'address1' => $address['complexName'] ?? null,
'address2' => trim(($address['buildingName'] ?? '') . ' ' . ($address['hoName'] ?? '')),
'address3' => $address['legalDivision']['legalDivisionAddress'] ?? null,
// 면적 및 가격 (데이터 없으면 null)
'sply_spc' => $space['supplySpace'] ?? null,
'excls_spc' => $space['exclusiveSpace'] ?? null,
'tot_spc' => $space['totalSpace'] ?? null,
'grnd_spc' => $space['groundSpace'] ?? null,
'bldg_spc' => $space['buildingSpace'] ?? null,
'deal_amt' => $price['dealAmount'] ?? 0,
'wrrnt_amt' => $price['warrantyAmount'] ?? 0,
'lease_amt' => $price['leaseAmount'] ?? 0,
'isale_amt' => $price['preSaleAmount'] ?? 0,
'prem_amt' => $price['premiumAmount'] ?? 0,
'sise' => null,
// 층 및 일정
'floor' => $floor['correspondenceFloorCount'] ?? null,
'floor2' => $floor['totalFloorCount'] ?? null,
'rdate' => date("Y-m-d H:i:s" , strtotime( $payload['requestDatetime'] )),
// 셀러
'seller_tel_no' => $seller['sellerTelephoneNumber'] ?? null, // JSON seller 객체에 연락처 필드 부재
'seller_nm' => $seller['sellerName'] ?? null,
// 중개업소
'realtor_nm' => $realtor['realtorName'] ?? null,
'realtor_tel_no' => $realtor['representativeTelephoneNumber'] ?? null,
// 단지 정보
'hscp_no' => $address['complexNumber'] ?? null,
'hscp_nm' => $address['complexName'] ?? null,
'ptp_no' => $address['pyeongTypeNumber'] ?? null,
'ptp_nm' => $address['pyeongTypeNumber'] ?? null,
// 담당자
'charger' => null, // 담당자
'reg_price_yn' => 'N', // 가격수정요청여부
'reg_charger' => null, // 등기부등본 담당자
'dept1_sq' => null, // 부서(본부)
'dept2_sq' => null, // 부서(팀)
'reg_dept2_sq' => null, // 부서(팀)
'reg_dept1_sq' => null, // 부서(본부)
// 상태 및 기타
'dong_ho_chk' => ($address['isDongHoCheck'] ?? false) ? 'Y' : 'N',
'hscplqry_lv' => $address['inquiryLevel'] ?? null,
// 소유자
'ownerNm' => $seller['ownerName'] ?? null,
'ownerTelNo' => $seller['ownerName'] ?? null,
//
'chg_trade_type' => null,
'chg_address2' => null,
'chg_address3' => null,
'chg_seller_tel' => null,
'chg_amt' => null,
'reg_status' => null,
'cupnNo' => null,
'roomSiteAtclRgstCnt' => null,
'rootSiteAtclExpsCnt' => null,
'redvlp_area_nm' => $address['redevelopAreaName'] ?? null,
'biz_stp_desc' => $address['bizStepDescription'] ?? null,
// file
'cert_register' => json_encode($certRegister, JSON_UNESCAPED_UNICODE),
'direct_trad_yn' => ($seller['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode( $confirm_doc_img_url , JSON_UNESCAPED_UNICODE),
'confirm_doc_owner_check_yn' => $ownerCheckYn,
'owner_birth' => null,
'vrfc_type_sub' => ($rawData['verificationTypeCode'] === 'D') ? ($ownerCheckYn === 'Y' ? 'D2' : 'D1') : ($rawData['verificationTypeCode'] === 'N' ? 'N2' : $rawData['verificationTypeCode'] . '1'),
'cert_register_save_yn' => 'N',
'confirm_doc_img_url_save_yn' => 'N',
'address4' => $address['etcAddress'] ?? null,
'reference_file_url' => !empty($referenceFileUrl) ? implode('|', $referenceFileUrl) : '',
'reference_file_url_save_yn' => !empty($referenceFileUrl) ? 'Y' : 'N',
'registerBookUniqueNo' => $rawData['verificationReference'] ?? null,
'relationSellerAndOwner' => null,
'ownerTypeCode' => $ownerTypeCode,
'registerBookUniqueNumber' => null
];
}
private function articleInfoEtcParameter($articleNumber, $rawData , $payload){
// JSON 객체 안전하게 로드
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
$files = $rawData['realtor']['file'] ?? [];
// 공동 : 동 정보, 비공동 : 지번주소
if ( $rawData['realEstateTypeCode'] == "A01"){
$address2b = $address['buildingName'];
} else {
$address2b = $address['jibunAddress'] ?? null;
}
$ownerTypeCode = null;
$ownerTypeCodeResponse = isset($rawData['ownerTypeCode']) ?? null;
if ($ownerTypeCodeResponse !== null ){
switch ($ownerTypeCodeResponse) {
case "INDIV":
$ownerTypeCode = 0;
break;
case "CORP":
$ownerTypeCode = 1;
break;
case "FRGNR":
$ownerTypeCode = 2;
break;
case "DELEG":
$ownerTypeCode = 3;
break;
}
}
return [
'atcl_no' => $articleNumber,
'vir_addr_yn' => ($address['isVirtualAddress'] ?? null) === true ? 'Y' : (($address['isVirtualAddress'] ?? null) === false ? 'N' : null),
'bild_no' => null,
'vrfcMthdTpcd' => null,
'cert_uncnfrm_status' => null,
'expsStartYmdt' => $rawData['exposureStartDateTime'] ?? null,
'vrfcAutoPassYn' => ($rawData['isAutoVerificationRequested'] ?? false) === true ? "Y" : "N",
'address2a' => $address['liAddress'] ?? null,
'address2b' => $address2b,
'registerBookUniqueNo' => null,
'ownerTypeCode' => $ownerTypeCode,
'orgRepCphNo' => null,
'orgRepTelNo' => null,
'orgRltrNm' => null,
'orgRepNm' => null,
'smsSendTime' => null,
'document_cert_method' => null,
'noRgbkVrfcReqYn' => ($address['isUnregisteredVerificationRequested'] ?? null) === true ? 'Y' : (($address['isUnregisteredVerificationRequested'] ?? null) === false ? 'N' : null),
'areaByBdbkVrfcReqYn' => ($address['isBuildingRegisterAreaCheckRequested'] ?? null) === true ? 'Y' : (($address['isBuildingRegisterAreaCheckRequested'] ?? null) === false ? 'N' : null),
'orgAtclNo' => null,
'atclStatCd' => null,
'repNm' => $realtor['realtorName'] ?? null,
'cpName' => $rawData['cpId'],
'document_not_received' => null,
'final_failure' => null,
];
}
}