|
|
|
@ -1,42 +1,33 @@
|
|
|
|
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.core.exception.EnsException;
|
|
|
|
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
|
|
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.BillKkoPayApiSpec;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.BillKkoPay;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.QBillKkoPay;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository.BillKkoPayRepository;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayUrlRespData;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.PayUseSysApi;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.BillLogSeCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.BillReqSeCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.BillSeCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.BillHist;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.QBill;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.repository.BillHistRepository;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayUrlService;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.model.PayUrlData;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.model.ReqAndRespInf;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.QOrgMng;
|
|
|
|
|
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.*;
|
|
|
|
|
|
|
|
|
|
import org.springframework.http.*;
|
|
|
|
|
import org.springframework.stereotype.*;
|
|
|
|
|
|
|
|
|
|
import com.google.gson.*;
|
|
|
|
|
import com.google.gson.reflect.*;
|
|
|
|
|
import com.querydsl.jpa.impl.*;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.core.exception.*;
|
|
|
|
|
import cokr.xit.ens.core.exception.code.*;
|
|
|
|
|
import cokr.xit.ens.core.utils.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository.*;
|
|
|
|
|
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.entity.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.repository.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.model.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.domain.support.*;
|
|
|
|
|
import lombok.*;
|
|
|
|
|
import lombok.extern.slf4j.*;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -77,7 +68,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void validate(String billUid, PayUrlData<BillKkoPay> data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CmmnUtil.isEmpty(data.getBill()))
|
|
|
|
|
throw new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 청구서 자료가 없습니다.");
|
|
|
|
|
if (CmmnUtil.isEmpty(data.getBillDetail()))
|
|
|
|
@ -93,14 +84,14 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
Bill bill = data.getBill();
|
|
|
|
|
OrgMng orgMng = bill.getOrgMng();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String useSysUrl = orgMng.getKkoBpUrlApi();
|
|
|
|
|
final String billerCode = orgMng.getKkoBpBillerCode();
|
|
|
|
|
final String authorization = orgMng.getKkoBpAuthorization();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* FIXME: 카카오페이 결제 Url API
|
|
|
|
|
* FIXME: Comment 카카오페이 결제 Url API
|
|
|
|
|
* [모바일 페이지 카카오페이 결제 버튼 이벤트 시 실행]
|
|
|
|
|
* 1. payUseSysApi.payUrl
|
|
|
|
|
* 운영 : https://phts-manager.koti.re.kr/iup/bill/kkopay/gnr/url
|
|
|
|
@ -117,23 +108,74 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
* 더즌 청구서 API 실패 시 더즌 청구서 RE API 호출
|
|
|
|
|
*/
|
|
|
|
|
Optional.ofNullable(data.getBillDetail())
|
|
|
|
|
.map(billKkoPay -> createMessage(billKkoPay.getBillerUserKey()))
|
|
|
|
|
.map(param -> loadReqData(data, useSysUrl, param))
|
|
|
|
|
.map(param -> payUseSysApi.payUrl(useSysUrl, param, null))
|
|
|
|
|
.map(response -> loadRespData(data, response))
|
|
|
|
|
.map(response -> checkResponse(response))
|
|
|
|
|
.map(document -> savePayUrlInfo(data, document))
|
|
|
|
|
.map(document -> createGnrUrlMessage(data, document))
|
|
|
|
|
.map(param -> loadGnrUrlReqData(data, param))
|
|
|
|
|
.map(param -> billKkoPayApi.url(billerCode, authorization, param))
|
|
|
|
|
.map(response -> loadGnrUrlRespData(data, response))
|
|
|
|
|
.map(response -> checkGnrUrlResponse(false, response))
|
|
|
|
|
.map(respData -> saveUrl(data, respData))
|
|
|
|
|
.filter(respData -> respData == null)
|
|
|
|
|
.map(respData -> loadGnrReUrlReqData(data))
|
|
|
|
|
.map(param -> billKkoPayApi.reUrl(billerCode, authorization, param))
|
|
|
|
|
.map(response -> checkGnrUrlResponse(true, response))
|
|
|
|
|
.map(respData -> saveUrl(data, respData))
|
|
|
|
|
.map(billKkoPay -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - createMessage: {}", billKkoPay.getBillerUserKey());
|
|
|
|
|
return safely(() -> createMessage(billKkoPay.getBillerUserKey()));
|
|
|
|
|
})
|
|
|
|
|
.map(param -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - loadReqData: {}", param);
|
|
|
|
|
return safely(() -> loadReqData(data, useSysUrl, param));
|
|
|
|
|
})
|
|
|
|
|
.map(param -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - payUseSysApi.payUrl", param);
|
|
|
|
|
return safely(() -> payUseSysApi.payUrl(useSysUrl, param, null));
|
|
|
|
|
})
|
|
|
|
|
.map(response -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - loadRespData: {}", response);
|
|
|
|
|
return safely(() -> loadRespData(data, response));
|
|
|
|
|
})
|
|
|
|
|
.map(response -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - checkResponse: {}", response);
|
|
|
|
|
return safely(() -> checkResponse(response));
|
|
|
|
|
})
|
|
|
|
|
.map(document -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - savePayUrlInfo: {}", document);
|
|
|
|
|
return safely(() -> savePayUrlInfo(data, document));
|
|
|
|
|
})
|
|
|
|
|
.map(document -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - createGnrUrlMessage: {}", document);
|
|
|
|
|
return safely(() -> createGnrUrlMessage(data, document));
|
|
|
|
|
})
|
|
|
|
|
.map(param -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - loadGnrUrlReqData: {}", param);
|
|
|
|
|
return safely(() -> loadGnrUrlReqData(data, param));
|
|
|
|
|
})
|
|
|
|
|
.map(param -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - billKkoPayApi.url: {}", param);
|
|
|
|
|
return safely(() -> billKkoPayApi.url(billerCode, authorization, param));
|
|
|
|
|
})
|
|
|
|
|
.map(response -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - loadGnrUrlRespData: {}", response);
|
|
|
|
|
return safely(() -> loadGnrUrlRespData(data, response));
|
|
|
|
|
})
|
|
|
|
|
.map(response -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - checkGnrUrlResponse: {}", response);
|
|
|
|
|
return safely(() -> checkGnrUrlResponse(false, response));
|
|
|
|
|
})
|
|
|
|
|
.map(respData -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - saveUrl: {}", respData);
|
|
|
|
|
return safely(() -> saveUrl(data, respData));
|
|
|
|
|
})
|
|
|
|
|
.filter(respData -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - respData == null: {}", respData);
|
|
|
|
|
return safely(() -> respData == null);
|
|
|
|
|
})
|
|
|
|
|
.map(respData -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - loadGnrReUrlReqData: {}", respData);
|
|
|
|
|
return safely(() -> loadGnrReUrlReqData(data));
|
|
|
|
|
})
|
|
|
|
|
.map(param -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - billKkoPayApi.reUrl: {}", param);
|
|
|
|
|
return safely(() -> billKkoPayApi.reUrl(billerCode, authorization, param));
|
|
|
|
|
})
|
|
|
|
|
.map(response -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - checkGnrReUrlResponse: {}", response);
|
|
|
|
|
return safely(() -> checkGnrUrlResponse(true, response));
|
|
|
|
|
})
|
|
|
|
|
.map(respData -> {
|
|
|
|
|
log.info("KkoPayUrlService::callApi - saveUrl: {}", respData);
|
|
|
|
|
return safely(() -> saveUrl(data, respData));
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -146,24 +188,24 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> loadReqData(PayUrlData<BillKkoPay> data, String url, Map<String, Object> param) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.getReqAndRespInf().setUrl(url);
|
|
|
|
|
data.getReqAndRespInf().setReqData(CmmnUtil.toJsonString(param));
|
|
|
|
|
return param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ResponseEntity<String> loadRespData(PayUrlData<BillKkoPay> data, ResponseEntity<String> response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.getReqAndRespInf().setRespRawData(response.getBody());
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private PayApiRespDTO<KkoPayUrlRespData> checkResponse(ResponseEntity<String> response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
|
|
|
throw new EnsException(EnsErrCd.API_COMM_ERROR, "["+ BillLogSeCd.US +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PayApiRespDTO<KkoPayUrlRespData> result = null;
|
|
|
|
|
try {
|
|
|
|
|
result = gson.fromJson(response.getBody(), new TypeToken<PayApiRespDTO<KkoPayUrlRespData>>() {
|
|
|
|
@ -171,7 +213,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
throw new EnsException(EnsErrCd.INVALID_RESPONSE, "["+ BillLogSeCd.US +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
PayUseSysResCd.valueOf(result.getResCode());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
@ -205,7 +247,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
final BillKkoPay billKkoPay = data.getBillDetail();
|
|
|
|
|
final KkoPayUrlRespData urlData = document.getData();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> parameters = null;
|
|
|
|
|
Map<String, Object> parameters = null;
|
|
|
|
|
parameters = CmmnUtil.isEmpty(urlData.getParameters()) ? new HashMap<>() : urlData.getParameters();
|
|
|
|
|
parameters.put("orgCd", orgMng == null ? null : orgMng.getOrgCd());
|
|
|
|
|
|
|
|
|
@ -228,24 +270,24 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String loadGnrUrlReqData(PayUrlData<BillKkoPay> data, String message) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.getReqAndRespInf().getEtc().put(DataKeys.gnrUrlReqMessage.name(), message);
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ResponseEntity<String> loadGnrUrlRespData(PayUrlData<BillKkoPay> data, ResponseEntity<String> response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.getReqAndRespInf().getEtc().put(DataKeys.gnrUrlRespMessage.name(), response.getBody());
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private PayApiRespDTO<Map<String, Object>> checkGnrUrlResponse(boolean isReurl, ResponseEntity<String> response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
|
|
|
throw new EnsException(EnsErrCd.API_COMM_ERROR, "["+ BillLogSeCd.VD +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
|
|
|
|
|
|
|
|
if (!isReurl && response.getBody().contains("Read timed out"))
|
|
|
|
|
|
|
|
|
|
if (!isReurl && response.getBody().contains("Read timed out"))
|
|
|
|
|
return null;
|
|
|
|
|
PayApiRespDTO<Map<String, Object>> result = null;
|
|
|
|
|
try {
|
|
|
|
@ -255,11 +297,11 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
if (isReurl)
|
|
|
|
|
throw new EnsException(EnsErrCd.INVALID_RESPONSE, "["+ BillLogSeCd.VD +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!"OK".equals(result.getResCode()))
|
|
|
|
|
if (!isReurl && "E818".equals(result.getResCode()))
|
|
|
|
|
if (!isReurl && "E818".equals(result.getResCode()))
|
|
|
|
|
return null;
|
|
|
|
|
else {
|
|
|
|
|
result.setMessage("["+ BillLogSeCd.VD +"] " + result.getMessage());
|
|
|
|
@ -281,7 +323,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String loadGnrReUrlReqData(PayUrlData<BillKkoPay> data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String message = (String) data.getReqAndRespInf().getEtc().get(DataKeys.gnrReUrlReqMessage.name());
|
|
|
|
|
data.getReqAndRespInf().getEtc().put(DataKeys.gnrReUrlReqMessage.name(), message);
|
|
|
|
|
|
|
|
|
@ -290,7 +332,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PayApiRespDTO<Map<String, Object>> generateResult(String billUid, PayUrlData<BillKkoPay> data, EnsException e) {
|
|
|
|
|
if (e == null) {
|
|
|
|
|
if (e == null) {
|
|
|
|
|
final String urlResponse = (String) data.getReqAndRespInf().getEtc().get(DataKeys.gnrUrlRespMessage.name());
|
|
|
|
|
final String reurlResponse = (String) data.getReqAndRespInf().getEtc().get(DataKeys.gnrReUrlRespMessage.name());
|
|
|
|
|
if (CmmnUtil.isEmpty(reurlResponse))
|
|
|
|
@ -299,7 +341,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
else
|
|
|
|
|
return gson.fromJson(reurlResponse, new TypeToken<PayApiRespDTO<Map<String, Object>>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
} else {
|
|
|
|
|
} else {
|
|
|
|
|
if (EnsErrCd.URL_ALREADY_CREATED.equals(e.getErrCd())) {
|
|
|
|
|
Map<String, Object> m = new HashMap<>();
|
|
|
|
|
m.put("url", data.getBillDetail().getUrl());
|
|
|
|
@ -326,11 +368,11 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
@Override
|
|
|
|
|
// @Transactional(propagation = Propagation.REQUIRED)
|
|
|
|
|
public void saveHist(String billUid, PayUrlData<BillKkoPay> data, EnsException e) {
|
|
|
|
|
saveHistByGetUrlInf(data, e);
|
|
|
|
|
saveHistByGnrUrl(data, e);
|
|
|
|
|
saveHistByGnrReUrl(data, e);
|
|
|
|
|
saveHistByGetUrlInf(data, e);
|
|
|
|
|
saveHistByGnrUrl(data, e);
|
|
|
|
|
saveHistByGnrReUrl(data, e);
|
|
|
|
|
|
|
|
|
|
if (e != null) {
|
|
|
|
|
if (e != null) {
|
|
|
|
|
if (data.getBillDetail() != null) {
|
|
|
|
|
data.getBillDetail().setError(FieldError.initBuilder()
|
|
|
|
|
.errorCode(e.getErrCd().getCode())
|
|
|
|
@ -350,8 +392,8 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
if (!CmmnUtil.isEmpty(requestData)) {
|
|
|
|
|
BillHist billHist = BillHist.builder()
|
|
|
|
|
.billUid(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getBillUid())
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.US_URLINF)
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.US_URLINF)
|
|
|
|
|
.orgMng(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getOrgMng())
|
|
|
|
|
.linkedUuid(CmmnUtil.isEmpty(data.getBillDetail()) ? null : data.getBillDetail().getBillerUserKey())
|
|
|
|
|
.requestData(requestData)
|
|
|
|
@ -378,8 +420,8 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
if (!CmmnUtil.isEmpty(requestData)) {
|
|
|
|
|
BillHist billHist = BillHist.builder()
|
|
|
|
|
.billUid(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getBillUid())
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.VD_URL)
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.VD_URL)
|
|
|
|
|
.orgMng(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getOrgMng())
|
|
|
|
|
.linkedUuid(CmmnUtil.isEmpty(data.getBillDetail()) ? null : data.getBillDetail().getBillerUserKey())
|
|
|
|
|
.requestData(requestData)
|
|
|
|
@ -406,8 +448,8 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
if (!CmmnUtil.isEmpty(requestData)) {
|
|
|
|
|
BillHist billHist = BillHist.builder()
|
|
|
|
|
.billUid(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getBillUid())
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.VD_REURL)
|
|
|
|
|
.billSe(BillSeCd.bpKko)
|
|
|
|
|
.reqSe(BillReqSeCd.VD_REURL)
|
|
|
|
|
.orgMng(CmmnUtil.isEmpty(data.getBill()) ? null : data.getBill().getOrgMng())
|
|
|
|
|
.linkedUuid(CmmnUtil.isEmpty(data.getBillDetail()) ? null : data.getBillDetail().getBillerUserKey())
|
|
|
|
|
.requestData(requestData)
|
|
|
|
@ -422,7 +464,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
|
|
|
|
|
billHistRepository.save(billHist);
|
|
|
|
|
|
|
|
|
|
if (e != null) {
|
|
|
|
|
if (e != null) {
|
|
|
|
|
if (data.getBillDetail() != null) {
|
|
|
|
|
data.getBillDetail().setError(FieldError.initBuilder()
|
|
|
|
|
.errorCode(e.getErrCd().getCode())
|
|
|
|
@ -434,4 +476,13 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <T> T safely(Supplier<T> supplier) {
|
|
|
|
|
try {
|
|
|
|
|
return supplier.get();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.info("Error occurred", e);
|
|
|
|
|
throw new EnsException(EnsErrCd.UNKNOWN, e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|