|
|
@@ -33,6 +33,7 @@ import com.style24.core.biz.checkout.MallServiceSOAP11BindingStub;
|
|
|
import com.style24.core.biz.checkout.base.AccessCredentialsType;
|
|
|
import com.style24.core.biz.checkout.base.ChangedProductOrderInfo;
|
|
|
import com.style24.core.biz.checkout.base.ClaimRequestReasonType;
|
|
|
+import com.style24.core.biz.checkout.base.DelayedDispatchReasonType;
|
|
|
import com.style24.core.biz.checkout.base.DeliveryMethodType;
|
|
|
import com.style24.core.biz.checkout.base.HoldbackClassType;
|
|
|
import com.style24.core.biz.checkout.base.HoldbackStatusType;
|
|
|
@@ -47,6 +48,8 @@ import com.style24.core.biz.checkout.mall.ApproveReturnApplicationRequest;
|
|
|
import com.style24.core.biz.checkout.mall.ApproveReturnApplicationResponse;
|
|
|
import com.style24.core.biz.checkout.mall.CancelSaleRequest;
|
|
|
import com.style24.core.biz.checkout.mall.CancelSaleResponse;
|
|
|
+import com.style24.core.biz.checkout.mall.DelayProductOrderRequest;
|
|
|
+import com.style24.core.biz.checkout.mall.DelayProductOrderResponse;
|
|
|
import com.style24.core.biz.checkout.mall.GetChangedProductOrderListRequest;
|
|
|
import com.style24.core.biz.checkout.mall.GetChangedProductOrderListResponse;
|
|
|
import com.style24.core.biz.checkout.mall.GetProductOrderInfoListRequest;
|
|
|
@@ -437,8 +440,8 @@ public class TscNaverPayService {
|
|
|
|
|
|
// 로컬의 경우 별도 기간을 설정해서 사용
|
|
|
if("locd".equals(env.getProperty("spring.profiles.active"))) {
|
|
|
- stdt = "20211008000000"; // 조회기간 시작
|
|
|
- eddt = "20211008235959"; // 조회기간 끝
|
|
|
+ stdt = "20211012000000"; // 조회기간 시작
|
|
|
+ eddt = "20211012235959"; // 조회기간 끝
|
|
|
|
|
|
log.info("stdt : eddt ---> " + stdt + " : " + eddt);
|
|
|
}
|
|
|
@@ -1228,7 +1231,6 @@ public class TscNaverPayService {
|
|
|
change.setRecipZipcode(orderInfo.getProductOrder().getShippingAddress().getZipCode().replaceAll("-", ""));
|
|
|
change.setRecipNm(new String(SimpleCryptLib.decrypt(encryptKey, orderInfo.getProductOrder().getShippingAddress().getName()), StandardCharsets.UTF_8));
|
|
|
change.setRecipPhnno(new String(SimpleCryptLib.decrypt(encryptKey, orderInfo.getProductOrder().getShippingAddress().getTel1()), StandardCharsets.UTF_8));
|
|
|
- change.setHypenRecipPhone();
|
|
|
change.setRecipBaseAddr(new String(SimpleCryptLib.decrypt(encryptKey, orderInfo.getProductOrder().getShippingAddress().getBaseAddress()), StandardCharsets.UTF_8));
|
|
|
if(StringUtils.isNotBlank(orderInfo.getProductOrder().getShippingAddress().getZipCode())) {
|
|
|
change.setRecipZipcode(orderInfo.getProductOrder().getShippingAddress().getZipCode().replaceAll("-", ""));
|
|
|
@@ -1264,6 +1266,9 @@ public class TscNaverPayService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 핸드폰번호 하이픈 처리
|
|
|
+ change.setHypenRecipPhone();
|
|
|
+
|
|
|
// 배송지 정보 (네이버페이 주문형 배송지는 회수지와 동일 적용 (배송지 주소 작성란 없음))
|
|
|
change.setChgerNm(change.getRecipNm());
|
|
|
change.setChgerPhnno(change.getRecipPhnno());
|
|
|
@@ -1355,6 +1360,13 @@ public class TscNaverPayService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 교환 보류 처리
|
|
|
+ order.setHoldCode(TscConstants.nPayExchangeHoldCode.ETC.value());
|
|
|
+ order.setHoldReason("교환 옵션 변경 대기중");
|
|
|
+ order.setRegNo(userNo);
|
|
|
+ order.setUpdNo(userNo);
|
|
|
+ this.nPayExchangeHold(order);
|
|
|
+
|
|
|
log.info("NAPAY_ORD_NO 교환 접수 성공 :::: {}", order.getNpayOrdDtlNo());
|
|
|
}
|
|
|
|
|
|
@@ -2518,10 +2530,12 @@ public class TscNaverPayService {
|
|
|
@Transactional("shopTxnManager")
|
|
|
public int nPayExchangeHold(Order order) {
|
|
|
Order info = naverPayDao.getOrderDetailInfoFromOrdDtlNo(order);
|
|
|
+ String holdCode = order.getHoldCode();
|
|
|
+ String holdReason = order.getHoldReason();
|
|
|
+ Integer regNo = order.getRegNo();
|
|
|
String npayOrdDtlNo = info.getNpayOrdDtlNo();
|
|
|
String pgGb = info.getPgGb();
|
|
|
Integer ordNo = info.getOrdNo();
|
|
|
- Integer regNo = order.getRegNo();
|
|
|
|
|
|
try {
|
|
|
Security.addProvider(new BouncyCastleProvider());
|
|
|
@@ -2546,10 +2560,25 @@ public class TscNaverPayService {
|
|
|
withholdExchangeRequest.setDetailLevel("Full");
|
|
|
withholdExchangeRequest.setVersion(env.getProperty("naverPay.version"));
|
|
|
withholdExchangeRequest.setRequestID("");
|
|
|
- withholdExchangeRequest.setProductOrderID(npayOrdDtlNo); // 상품 주문 번호
|
|
|
- withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.ETC); // 교환 보류 타입 코드
|
|
|
- withholdExchangeRequest.setExchangeHoldDetailContent("기타사유"); // 교환 보류 상세 사유
|
|
|
- // withholdExchangeRequest.setEtcFeeDemandAmount(0); // 기타 교환 비용
|
|
|
+ withholdExchangeRequest.setProductOrderID(npayOrdDtlNo); // 상품 주문 번호
|
|
|
+
|
|
|
+ // 교환 보류 타입 코드
|
|
|
+ if (TscConstants.nPayExchangeHoldCode.EXCHANGE_DELIVERYFEE.value().equals(holdCode)) {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.EXCHANGE_DELIVERYFEE); // 교환 배송비 청구
|
|
|
+ } else if (TscConstants.nPayExchangeHoldCode.EXCHANGE_EXTRAFEE.value().equals(holdCode)) {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.EXCHANGE_EXTRAFEE); // 기타 교환 비용 청구
|
|
|
+ } else if (TscConstants.nPayExchangeHoldCode.EXCHANGE_PRODUCT_READY.value().equals(holdCode)) {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.EXCHANGE_PRODUCT_READY); // 교환 상품 준비 중
|
|
|
+ } else if (TscConstants.nPayExchangeHoldCode.EXCHANGE_PRODUCT_NOT_DELIVERED.value().equals(holdCode)) {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.EXCHANGE_PRODUCT_NOT_DELIVERED); // 교환 상품 미입고
|
|
|
+ } else if (TscConstants.nPayExchangeHoldCode.EXCHANGE_HOLDBACK.value().equals(holdCode)) {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.EXCHANGE_HOLDBACK); // 교환 구매 확정 보류
|
|
|
+ } else {
|
|
|
+ withholdExchangeRequest.setExchangeHoldCode(HoldbackClassType.ETC); // 기타 사유
|
|
|
+ }
|
|
|
+
|
|
|
+ withholdExchangeRequest.setExchangeHoldDetailContent(holdReason); // 교환 보류 상세 사유
|
|
|
+ // withholdExchangeRequest.setEtcFeeDemandAmount(0); // 기타 교환 비용
|
|
|
|
|
|
|
|
|
withholdExchangeResponse = stub.withholdExchange(withholdExchangeRequest);
|
|
|
@@ -2692,6 +2721,7 @@ public class TscNaverPayService {
|
|
|
Order info = naverPayDao.getOrderDetailInfoFromOrdDtlNo(order);
|
|
|
String npayOrdDtlNo = info.getNpayOrdDtlNo();
|
|
|
String pgGb = info.getPgGb();
|
|
|
+ String holdCode = order.getHoldCode();
|
|
|
Integer ordNo = info.getOrdNo();
|
|
|
Integer regNo = order.getRegNo();
|
|
|
|
|
|
@@ -2718,10 +2748,23 @@ public class TscNaverPayService {
|
|
|
withholdReturnRequest.setDetailLevel("Full");
|
|
|
withholdReturnRequest.setVersion(env.getProperty("naverPay.version"));
|
|
|
withholdReturnRequest.setRequestID("");
|
|
|
- withholdReturnRequest.setProductOrderID(npayOrdDtlNo); // 상품 주문 번호
|
|
|
- withholdReturnRequest.setReturnHoldCode(HoldbackClassType.ETC); // 반품 보류 타입 코드
|
|
|
- withholdReturnRequest.setReturnHoldDetailContent("기타사유"); // 반품 보류 상세 사유
|
|
|
- // withholdReturnRequest.setEtcFeeDemandAmount(0); // 기타 교환 비용
|
|
|
+ withholdReturnRequest.setProductOrderID(npayOrdDtlNo); // 상품 주문 번호
|
|
|
+
|
|
|
+ // 교환 보류 타입 코드
|
|
|
+ if (TscConstants.nPayReturnHoldCode.RETURN_DELIVERYFEE.value().equals(holdCode)) {
|
|
|
+ withholdReturnRequest.setReturnHoldCode(HoldbackClassType.RETURN_DELIVERYFEE); // 반품 배송비 청구
|
|
|
+ } else if (TscConstants.nPayReturnHoldCode.EXTRAFEEE.value().equals(holdCode)) {
|
|
|
+ withholdReturnRequest.setReturnHoldCode(HoldbackClassType.EXTRAFEEE); // 기타 반품 비용 청구
|
|
|
+ } else if (TscConstants.nPayReturnHoldCode.RETURN_DELIVERYFEE_AND_EXTRAFEEE.value().equals(holdCode)) {
|
|
|
+ withholdReturnRequest.setReturnHoldCode(HoldbackClassType.RETURN_DELIVERYFEE_AND_EXTRAFEEE); // 반품 배송비 및 기타 반품 비용 청구
|
|
|
+ } else if (TscConstants.nPayReturnHoldCode.RETURN_PRODUCT_NOT_DELIVERED.value().equals(holdCode)) {
|
|
|
+ withholdReturnRequest.setReturnHoldCode(HoldbackClassType.RETURN_PRODUCT_NOT_DELIVERED); // 반품 상품 미입고
|
|
|
+ } else {
|
|
|
+ withholdReturnRequest.setReturnHoldCode(HoldbackClassType.ETC); // 기타 사유
|
|
|
+ }
|
|
|
+
|
|
|
+ withholdReturnRequest.setReturnHoldDetailContent(order.getHoldReason()); // 반품 보류 상세 사유
|
|
|
+ // withholdReturnRequest.setEtcFeeDemandAmount(0); // 기타 반품 비용
|
|
|
|
|
|
|
|
|
withholdReturnResponse = stub.withholdReturn(withholdReturnRequest);
|
|
|
@@ -2862,4 +2905,127 @@ public class TscNaverPayService {
|
|
|
public int updateNaverPayChangeHold(Order order) {
|
|
|
return naverPayDao.updateNaverPayChangeHold(order);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 네이버페이 주문형 발송지연 대상 조회
|
|
|
+ *
|
|
|
+ * @return Collection<Order>
|
|
|
+ * @author card007
|
|
|
+ * @since 2021. 10. 12
|
|
|
+ */
|
|
|
+ public Collection<Order> getNaverPayDelayTargetList() {
|
|
|
+ return naverPayDao.getNaverPayDelayTargetList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 네이버페이 주문형 발송 지연 처리
|
|
|
+ *
|
|
|
+ * @param Order
|
|
|
+ * @return int
|
|
|
+ * @author card007
|
|
|
+ * @since 2021. 10. 12
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public int nPayDelayProductOrder(Order order) {
|
|
|
+ Integer ordNo = order.getOrdNo();
|
|
|
+ String npayOrdDtlNo = order.getNpayOrdDtlNo();
|
|
|
+ String pgGb = order.getPgGb();
|
|
|
+ String reasonCd = order.getReasonCd();
|
|
|
+ Integer regNo = order.getRegNo();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Security.addProvider(new BouncyCastleProvider());
|
|
|
+ AccessCredentialsType accessCredentialsType = new AccessCredentialsType();
|
|
|
+ MallServiceLocator MSL = new MallServiceLocator(env.getProperty("naverPay.port.address"));
|
|
|
+ MallServiceSOAP11BindingStub stub = (MallServiceSOAP11BindingStub)MSL.getMallServiceSOAP11Port();
|
|
|
+
|
|
|
+ DelayProductOrderRequest delayProductOrderRequest = new DelayProductOrderRequest();
|
|
|
+ DelayProductOrderResponse delayProductOrderResponse = new DelayProductOrderResponse();
|
|
|
+
|
|
|
+ if (order != null && TscConstants.PgGb.NAVER_ORDER.value().equals(pgGb)) {
|
|
|
+ // 서명생성
|
|
|
+ generateSignature("DelayProductOrder", env.getProperty("naverPay.secret.key"));
|
|
|
+ log.info("DelayProductOrder(발송 지연 네이버로 송신) :: timeStamp === " + timeStamp);
|
|
|
+
|
|
|
+ //인증정보
|
|
|
+ accessCredentialsType.setAccessLicense(env.getProperty("naverPay.access.license"));
|
|
|
+ accessCredentialsType.setSignature(signature);
|
|
|
+ accessCredentialsType.setTimestamp(timeStamp);
|
|
|
+
|
|
|
+ delayProductOrderRequest.setAccessCredentials(accessCredentialsType);
|
|
|
+ delayProductOrderRequest.setDetailLevel("Full");
|
|
|
+ delayProductOrderRequest.setVersion(env.getProperty("naverPay.version"));
|
|
|
+ delayProductOrderRequest.setRequestID("");
|
|
|
+ delayProductOrderRequest.setProductOrderID(npayOrdDtlNo); // 상품 주문 번호
|
|
|
+
|
|
|
+ // 발송 기한 설정
|
|
|
+ Calendar dispatchDate = Calendar.getInstance();
|
|
|
+ Date tmp;
|
|
|
+ if(StringUtils.isNotBlank(order.getDelvResDt())) {
|
|
|
+ tmp = new SimpleDateFormat("yyyyMMddHHmmss").parse(order.getDelvResDt(), new ParsePosition(0));
|
|
|
+ } else {
|
|
|
+ tmp = new Date();
|
|
|
+ }
|
|
|
+
|
|
|
+ dispatchDate.setTime(tmp);
|
|
|
+ delayProductOrderRequest.setDispatchDueDate(dispatchDate); // 발송 기한
|
|
|
+
|
|
|
+ // 발송 지연 사유 코드 설정
|
|
|
+ if (TscConstants.nPayDelayReasonCode.PRODUCT_PREPARE.value().equals(reasonCd)) {
|
|
|
+ delayProductOrderRequest.setDispatchDelayReasonCode(DelayedDispatchReasonType.PRODUCT_PREPARE); // 상품 준비 중
|
|
|
+ } else if (TscConstants.nPayDelayReasonCode.CUSTOMER_REQUEST.value().equals(reasonCd)) {
|
|
|
+ delayProductOrderRequest.setDispatchDelayReasonCode(DelayedDispatchReasonType.CUSTOMER_REQUEST); // 고객 요청
|
|
|
+ } else if (TscConstants.nPayDelayReasonCode.CUSTOM_BUILD.value().equals(reasonCd)) {
|
|
|
+ delayProductOrderRequest.setDispatchDelayReasonCode(DelayedDispatchReasonType.CUSTOM_BUILD); // 주문 제작
|
|
|
+ } else if (TscConstants.nPayDelayReasonCode.RESERVED_DISPATCH.value().equals(reasonCd)) {
|
|
|
+ delayProductOrderRequest.setDispatchDelayReasonCode(DelayedDispatchReasonType.RESERVED_DISPATCH); // 예약 발송
|
|
|
+ } else {
|
|
|
+ delayProductOrderRequest.setDispatchDelayReasonCode(DelayedDispatchReasonType.ETC); // 기타
|
|
|
+ }
|
|
|
+
|
|
|
+ // delayProductOrderRequest.setDispatchDelayDetailReason(); // 발송 지연 상세 사유
|
|
|
+
|
|
|
+ delayProductOrderResponse = stub.delayProductOrder(delayProductOrderRequest);
|
|
|
+
|
|
|
+ String resultStr = "";
|
|
|
+ if (delayProductOrderResponse.getResponseType() != null) {
|
|
|
+ resultStr = delayProductOrderResponse.getResponseType().toUpperCase();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("SUCCESS".equals(resultStr)) {
|
|
|
+ log.info("발송 지연 처리 성공 주문번호===>" + ordNo);
|
|
|
+ log.info("발송 지연 처리 성공 네이버상품주문번호===>" + npayOrdDtlNo);
|
|
|
+ } else {
|
|
|
+ log.info("발송 지연 처리 에러");
|
|
|
+ log.info("주문번호 ===>" + ordNo);
|
|
|
+ log.info("네이버상품주문번호 ===> " + npayOrdDtlNo);
|
|
|
+ log.info("Code : " + delayProductOrderResponse.getError().getCode());
|
|
|
+ log.info("Message : " + delayProductOrderResponse.getError().getMessage());
|
|
|
+ log.info("Detail : " + delayProductOrderResponse.getError().getDetail());
|
|
|
+
|
|
|
+ Order fail = new Order();
|
|
|
+ fail.setErrorReason("발송 지연 처리 데이터 송부 에러");
|
|
|
+ fail.setOrdNo(ordNo);
|
|
|
+ fail.setNpayOrdDtlNo(npayOrdDtlNo);
|
|
|
+ fail.setOptCd("DelayProductOrder");
|
|
|
+ fail.setResultCd(delayProductOrderResponse.getError().getCode());
|
|
|
+ fail.setResultMsg(delayProductOrderResponse.getError().getMessage());
|
|
|
+ fail.setMallCd(env.getProperty("naverPay.shop.id"));
|
|
|
+ fail.setAccessLicense(env.getProperty("naverPay.access.license"));
|
|
|
+ fail.setSecretKey(env.getProperty("naverPay.secret.key"));
|
|
|
+ fail.setRegNo(regNo);
|
|
|
+
|
|
|
+ orderDao.createNaverPayErrorLog(fail);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
}
|