|
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.*;
|
|
|
|
import org.springframework.transaction.annotation.*;
|
|
|
|
import org.springframework.transaction.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.*;
|
|
|
|
import com.google.gson.*;
|
|
|
|
|
|
|
|
import com.google.gson.reflect.*;
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.biz.iup.code.*;
|
|
|
|
import cokr.xit.ens.biz.iup.code.*;
|
|
|
|
import cokr.xit.ens.core.aop.*;
|
|
|
|
import cokr.xit.ens.core.aop.*;
|
|
|
@ -15,10 +16,10 @@ import cokr.xit.ens.core.exception.*;
|
|
|
|
import cokr.xit.ens.core.exception.code.*;
|
|
|
|
import cokr.xit.ens.core.exception.code.*;
|
|
|
|
import cokr.xit.ens.core.utils.*;
|
|
|
|
import cokr.xit.ens.core.utils.*;
|
|
|
|
import cokr.xit.ens.modules.common.code.*;
|
|
|
|
import cokr.xit.ens.modules.common.code.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.*;
|
|
|
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.*;
|
|
|
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*;
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*;
|
|
|
|
import cokr.xit.ens.modules.nice.mapper.*;
|
|
|
|
import cokr.xit.ens.modules.nice.mapper.*;
|
|
|
@ -55,11 +56,9 @@ public class NiceCiAcceptService {
|
|
|
|
|
|
|
|
|
|
|
|
private final KeySequenceService keySequenceService;
|
|
|
|
private final KeySequenceService keySequenceService;
|
|
|
|
private final NiceCiBillHistoryService billHistoryService;
|
|
|
|
private final NiceCiBillHistoryService billHistoryService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final INiceCiMapper niceCiMapper;
|
|
|
|
private final INiceCiMapper niceCiMapper;
|
|
|
|
private final PayUseSysApi payUseSysApi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final BillKkoPayApiSpec billKkoPayApi;
|
|
|
|
|
|
|
|
|
|
|
|
private Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
|
|
|
private Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
|
|
|
|
|
|
|
|
|
|
@ -83,9 +82,11 @@ public class NiceCiAcceptService {
|
|
|
|
* </pre>
|
|
|
|
* </pre>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
public EnsResponseVO<?> accept(final NiceCiDTO.NiceCiParam niceCiParam){
|
|
|
|
public EnsResponseVO<?> accept(){
|
|
|
|
niceCiParam.setSendType(IupSendTypeCd.NI.getCode());
|
|
|
|
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
|
|
|
|
niceCiParam.setPrcsCd(IupPrcsCd.TGRG.getCode());
|
|
|
|
.sendType(IupSendTypeCd.NI.getCode())
|
|
|
|
|
|
|
|
.prcsCd(IupPrcsCd.TGRG.getCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiAcceptTgts(niceCiParam);
|
|
|
|
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiAcceptTgts(niceCiParam);
|
|
|
|
if(list.isEmpty()){
|
|
|
|
if(list.isEmpty()){
|
|
|
@ -119,8 +120,9 @@ public class NiceCiAcceptService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
|
|
|
|
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
|
|
|
|
for (NiceCiDTO.InputDataXit data : inputDataXits) {
|
|
|
|
for (NiceCiDTO.InputDataXit data : inputDataXits) {
|
|
|
|
BillKkoApiRespDTO<?> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData);
|
|
|
|
PayApiRespDTO<Map<String, Object>> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: API 호출 결과 SET - 연계 설정후 확인 필요
|
|
|
|
data.setPayUrl(String.valueOf(respDTO.getData()));
|
|
|
|
data.setPayUrl(String.valueOf(respDTO.getData()));
|
|
|
|
niceCiMapper.updatePayUrlOfDataInput(data);
|
|
|
|
niceCiMapper.updatePayUrlOfDataInput(data);
|
|
|
|
|
|
|
|
|
|
|
@ -190,7 +192,7 @@ public class NiceCiAcceptService {
|
|
|
|
* @param kkoPayUrlRespData KkoPayUrlRespData
|
|
|
|
* @param kkoPayUrlRespData KkoPayUrlRespData
|
|
|
|
* @return KkoPayUrlRespData
|
|
|
|
* @return KkoPayUrlRespData
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private BillKkoApiRespDTO<?> getPayUrl(final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){
|
|
|
|
private PayApiRespDTO<Map<String, Object>> getPayUrl(final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){
|
|
|
|
// FIXME: 파라메터 확인 필요
|
|
|
|
// FIXME: 파라메터 확인 필요
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("biller_user_key", dataXit.getDataId());
|
|
|
|
map.put("biller_user_key", dataXit.getDataId());
|
|
|
@ -207,22 +209,25 @@ public class NiceCiAcceptService {
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
billHistoryService.insertBillHistory(billHistDTO);
|
|
|
|
billHistoryService.insertBillHistory(billHistDTO);
|
|
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> resEntity = payUseSysApi.payUrl(orgMng.getKkoBpUrlApi(), param,
|
|
|
|
ResponseEntity<String> resEntity = billKkoPayApi.url(orgMng.getKkoBpBillerCode(), orgMng.getKkoBpAuthorization(),
|
|
|
|
null);
|
|
|
|
gson.toJson(param));
|
|
|
|
|
|
|
|
|
|
|
|
// 마스터 상태 실패처리
|
|
|
|
// 마스터 상태 실패처리
|
|
|
|
|
|
|
|
String rsltStr = resEntity.getBody();
|
|
|
|
if(resEntity.getStatusCode() != HttpStatus.OK){
|
|
|
|
if(resEntity.getStatusCode() != HttpStatus.OK){
|
|
|
|
billHistDTO.setErrorCode(resEntity.getStatusCode().toString());
|
|
|
|
billHistDTO.setErrorCode(EnsErrCd.API_COMM_ERROR.getCode());
|
|
|
|
//billHistDTO.setErrorCode(EnsErrCd.API_COMM_ERROR.getCode());
|
|
|
|
billHistDTO.setErrorMessage("["+ BillLogSeCd.VD +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + resEntity.getStatusCode().toString());
|
|
|
|
billHistDTO.setErrorMessage(resEntity.getBody());
|
|
|
|
|
|
|
|
billHistoryService.updateBillHistory(billHistDTO);
|
|
|
|
billHistoryService.updateBillHistory(billHistDTO);
|
|
|
|
throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm());
|
|
|
|
throw new EnsException(EnsErrCd.API_COMM_ERROR, "["+ BillLogSeCd.VD +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + resEntity.getStatusCode().toString(), rsltStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
String rsltStr = resEntity.getBody();
|
|
|
|
|
|
|
|
return BillKkoApiRespDTO.okBuilder()
|
|
|
|
|
|
|
|
.data(resEntity.getBody())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return gson.fromJson(rsltStr, new TypeToken<PayApiRespDTO<Map<String, Object>>>() {}.getType());
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
billHistDTO.setErrorCode(EnsErrCd.INVALID_RESPONSE.getCode());
|
|
|
|
|
|
|
|
billHistDTO.setErrorMessage("["+ BillLogSeCd.VD +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm());
|
|
|
|
|
|
|
|
billHistoryService.updateBillHistory(billHistDTO);
|
|
|
|
|
|
|
|
throw new EnsException(EnsErrCd.INVALID_RESPONSE, "["+ BillLogSeCd.VD +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|