|
|
@@ -17,6 +17,7 @@ import com.style24.core.biz.dao.TscOrderDao;
|
|
|
import com.style24.core.biz.service.TscOrderService;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
import com.style24.persistence.domain.Order;
|
|
|
+import com.style24.persistence.domain.Payment;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
|
@@ -25,6 +26,7 @@ import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.security.Security;
|
|
|
import java.security.SignatureException;
|
|
|
import java.text.ParsePosition;
|
|
|
@@ -218,18 +220,31 @@ public class TsbNaverPayService {
|
|
|
orderNo = productOrderInfo[i].getProductOrder().getMerchantCustomCode1(); // 가맹점 주문번호
|
|
|
// naverSeq = productOrderInfo[i].getProductOrder().getProductOrderID(); // 네이버주문번호순번
|
|
|
|
|
|
- if (orderNo != null) {
|
|
|
+ if(StringUtils.isNotBlank(orderNo) && !"0".equals(orderNo)) {
|
|
|
log.info("CHECK NPAY_ORD_NO ::::: {}", productOrderInfo[i].getOrder().getOrderID());
|
|
|
|
|
|
+ // TB_ORDER 네이버페이 주문번호 UPDATE
|
|
|
naverParams.setOrdNo(Integer.parseInt(orderNo));
|
|
|
naverParams.setNpayOrdNo(Integer.parseInt(productOrderInfo[i].getOrder().getOrderID())); // 네이버 주문번호
|
|
|
naverParams.setSiteCd(productOrderInfo[i].getProductOrder().getMallID());
|
|
|
naverParams.setUpdNo(0);
|
|
|
-
|
|
|
coreOrderDao.updateNaverPayOrderNo(naverParams);
|
|
|
|
|
|
// 이어서 추가 >> 주문 데이터 확인하는데 세트상품 확인 방법 체크할것.
|
|
|
- Order orderDtlList = updateNpayOrderDtlNo(productOrderInfo[i], encryptKey, naverParams);
|
|
|
+ Order orderDtlList = updateNpayOrderDtl(productOrderInfo[i], encryptKey, naverParams);
|
|
|
+
|
|
|
+ // TB_PAYMENT 결제 완료로 변경 및 데이터 수정
|
|
|
+ log.info("CHECK orderNo ::::: {}", orderNo);
|
|
|
+ Payment payment = new Payment();
|
|
|
+ payment.setOrdNo(Integer.parseInt(orderNo));
|
|
|
+ payment.setPayStat(TscConstants.PaymentStat.PAYMENT_COMPLETE.value());
|
|
|
+ payment.setPgTid(productOrderInfo[i].getOrder().getPaymentNumber());
|
|
|
+ payment.setPayMeans(productOrderInfo[i].getOrder().getPaymentMeans());
|
|
|
+ log.info("CHECK payment.getPayStat() ::::: {}", payment.getPayMeans());
|
|
|
+ log.info("CHECK payment.getPayStat ::::: {}", payment.getPayStat());
|
|
|
+ log.info("CHECK payment.getPgTid() ::::: {}", payment.getPgTid());
|
|
|
+ log.info("CHECK payment.getPayMeans() ::::: {}", payment.getPayMeans());
|
|
|
+ naverPayDao.updateNaverpayPaymentInfo(payment);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -237,7 +252,7 @@ public class TsbNaverPayService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public Order updateNpayOrderDtlNo(ProductOrderInfo productOrderInfo, byte[] encryptKey, Order npayParam) {
|
|
|
+ public Order updateNpayOrderDtl(ProductOrderInfo productOrderInfo, byte[] encryptKey, Order npayParam) throws Exception {
|
|
|
Order order = new Order();
|
|
|
order.setGoodsCd(productOrderInfo.getProductOrder().getProductID()); // 네이버페이 상품코드
|
|
|
String npayOrdDtlNo = productOrderInfo.getProductOrder().getProductOrderID(); // 네이버페이 상품주문번호
|
|
|
@@ -252,6 +267,7 @@ public class TsbNaverPayService {
|
|
|
order.setOrdNo(npayParam.getOrdNo());
|
|
|
order.setNpayOrdNo(npayParam.getNpayOrdNo());
|
|
|
Collection<Order> orderDtlList = naverPayDao.getOrdBaseInfo(order);
|
|
|
+ int ordDtlNo = 0;
|
|
|
|
|
|
// 같은 상품 중 ordDtlNo 찾기
|
|
|
for(Order dtl : orderDtlList) {
|
|
|
@@ -271,6 +287,7 @@ public class TsbNaverPayService {
|
|
|
// 해당 Dtl List에 있는 옵션이 모두 같으면 상품주문번호 저장
|
|
|
if(chkItem) {
|
|
|
dtl.setNpayOrdDtlNo(order.getNpayOrdDtlNo());
|
|
|
+ ordDtlNo = dtl.getOrdDtlNo();
|
|
|
naverPayDao.updateNpayOrdDtlNo(dtl);
|
|
|
}
|
|
|
} else if (order.getOptCd().length() > 0) {
|
|
|
@@ -280,6 +297,7 @@ public class TsbNaverPayService {
|
|
|
|
|
|
for(Order itemOne : item) {
|
|
|
itemOne.setNpayOrdDtlNo(order.getNpayOrdDtlNo());
|
|
|
+ ordDtlNo = itemOne.getOrdDtlNo();
|
|
|
naverPayDao.updateNpayOrdDtlNo(itemOne);
|
|
|
}
|
|
|
}
|
|
|
@@ -291,17 +309,32 @@ public class TsbNaverPayService {
|
|
|
|
|
|
for(Order itemOne : item) {
|
|
|
itemOne.setNpayOrdDtlNo(order.getNpayOrdDtlNo());
|
|
|
+ ordDtlNo = itemOne.getOrdDtlNo();
|
|
|
naverPayDao.updateNpayOrdDtlNo(itemOne);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 배송지 정보 수정
|
|
|
+ if(ordDtlNo > 0) {
|
|
|
+ order.setOrdDtlNo(ordDtlNo);
|
|
|
+ order.setRecipNm(new String(SimpleCryptLib.decrypt(encryptKey, productOrderInfo.getProductOrder().getShippingAddress().getName()), StandardCharsets.UTF_8));
|
|
|
+ order.setRecipPhnno(new String(SimpleCryptLib.decrypt(encryptKey, productOrderInfo.getProductOrder().getShippingAddress().getTel1()), StandardCharsets.UTF_8));
|
|
|
+ order.setRecipTelno(new String(SimpleCryptLib.decrypt(encryptKey, productOrderInfo.getProductOrder().getShippingAddress().getTel2()), StandardCharsets.UTF_8));
|
|
|
+ order.setRecipZipcode(productOrderInfo.getProductOrder().getShippingAddress().getZipCode().replaceAll("-", ""));
|
|
|
+ order.setRecipBaseAddr(new String(SimpleCryptLib.decrypt(encryptKey, productOrderInfo.getProductOrder().getShippingAddress().getBaseAddress()), StandardCharsets.UTF_8));
|
|
|
+ order.setRecipDtlAddr(new String(SimpleCryptLib.decrypt(encryptKey, productOrderInfo.getProductOrder().getShippingAddress().getDetailedAddress()), StandardCharsets.UTF_8));
|
|
|
+ order.setDelvMemo(productOrderInfo.getProductOrder().getShippingMemo());
|
|
|
+
|
|
|
+ naverPayDao.updateShippingAddressInfo(order);
|
|
|
+ }
|
|
|
+
|
|
|
order.setSellGb("10");
|
|
|
order.setPgGb(TscConstants.PgGb.NAVER_ORDER.value());
|
|
|
order.setPayMeans(TscConstants.PayMeans.CREDIT_CARD.value());
|
|
|
coreOrderService.updateOrderInfo(order);
|
|
|
|
|
|
- return null;
|
|
|
+ return order;
|
|
|
}
|
|
|
|
|
|
/**
|