fix: 카카오페이결재 처리시 로깅추가

main
Jonguk. Lim 2 months ago
parent 168c5db27c
commit bc70be8695

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

Loading…
Cancel
Save