refactor: Nice CI Accept, Send code refactoring

dev
Jonguk. Lim 1 month ago
parent 9565456542
commit 5aed628da0

@ -107,41 +107,8 @@ public class NiceCiAcceptService {
final String prefixBillUid = PostSeCd.intgrnNoti.getCode() + "-" + IdGenerator.getCurrentTimeSec(); final String prefixBillUid = PostSeCd.intgrnNoti.getCode() + "-" + IdGenerator.getCurrentTimeSec();
for(NiceCiDTO.InputXit xit : list){ for(NiceCiDTO.InputXit xit : list){
final KkoPayUrlRespData kkoPayUrlRespData = buildKkoPayUrlRespData(xit.getPayExpiresDt());
final OrgMng orgMng = niceCiMapper.selectKkoBpApiUrlFromEnsOrgMng(xit.getOrgCd())
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm()));
NiceCiDTO.BillHistDTO billHistDTO = null;
try { try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits(); processAccept(xit, prefixBillUid);
for (NiceCiDTO.InputDataXit data : inputDataXits) {
//----------------------------------------------------------
// pay Url API call & Get Result
//----------------------------------------------------------
PayApiRespDTO<Map<String, Object>> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData);
//----------------------------------------------------------
// API Call 후처리 - response 반영 & 결제 이력 생성
//----------------------------------------------------------
// FIXME: API 호출 결과 SET - 연계 설정후 확인 필요
data.setPayUrl(String.valueOf(respDTO.getData()));
niceCiMapper.updatePayUrlOfDataInput(data);
final String billUid = IdGenerator.getShortUUID(prefixBillUid);
// FIXME: API 호출 결과 로그 저장
billHistDTO.setBillUid(billUid);
billHistDTO.setResponseData(String.valueOf(respDTO.getData()));
billHistoryService.updateBillHistory(billHistDTO);
// FIXME: bill_se_cd, org_cd 설정 및 확인 필요???
insertBillRecord(data, xit, billUid);
// FIXME: biller_notice_key, custom_url, expire_at 설정 및 확인 필요???
insertBillKkoRecord(data, kkoPayUrlRespData, billUid);
}
xit.setPrcsCd(IupPrcsCd.GRUC.getCode());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
// FIXME: API 호출 에러 // FIXME: API 호출 에러
} catch (EnsException e) { } catch (EnsException e) {
@ -163,6 +130,43 @@ public class NiceCiAcceptService {
.build(); .build();
} }
private void processAccept(NiceCiDTO.InputXit xit, String prefixBillUid) throws Exception {
final KkoPayUrlRespData kkoPayUrlRespData = buildKkoPayUrlRespData(xit.getPayExpiresDt());
final OrgMng orgMng = niceCiMapper.selectKkoBpApiUrlFromEnsOrgMng(xit.getOrgCd())
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm()));
//List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
for (NiceCiDTO.InputDataXit data : xit.getInputDataXits()) {
NiceCiDTO.BillHistDTO billHistDTO = new NiceCiDTO.BillHistDTO();
//----------------------------------------------------------
// pay Url API call & Get Result
//----------------------------------------------------------
PayApiRespDTO<Map<String, Object>> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData);
//----------------------------------------------------------
// API Call 후처리 - response 반영 & 결제 이력 생성
//----------------------------------------------------------
// FIXME: API 호출 결과 SET - 연계 설정후 확인 필요
data.setPayUrl(String.valueOf(respDTO.getData()));
niceCiMapper.updatePayUrlOfDataInput(data);
final String billUid = IdGenerator.getShortUUID(prefixBillUid);
// FIXME: API 호출 결과 로그 저장
billHistDTO.setBillUid(billUid);
billHistDTO.setResponseData(String.valueOf(respDTO.getData()));
billHistoryService.updateBillHistory(billHistDTO);
// FIXME: bill_se_cd, org_cd 설정 및 확인 필요???
insertBillRecord(data, xit, billUid);
// FIXME: biller_notice_key, custom_url, expire_at 설정 및 확인 필요???
insertBillKkoRecord(data, kkoPayUrlRespData, billUid);
}
xit.setPrcsCd(IupPrcsCd.GRUC.getCode());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
/** /**
* NICE CI payUrn Call * NICE CI payUrn Call
* @param dataXit NiceCiDTO.InputDataXit * @param dataXit NiceCiDTO.InputDataXit

Loading…
Cancel
Save