|
|
@@ -11,8 +11,10 @@ import com.style24.core.biz.checkout.MallServiceLocator;
|
|
|
import com.style24.core.biz.checkout.MallServiceSOAP11BindingStub;
|
|
|
import com.style24.core.biz.checkout.base.AccessCredentialsType;
|
|
|
import com.style24.core.biz.checkout.base.DeliveryMethodType;
|
|
|
-import com.style24.core.biz.checkout.mall.ShipProductOrderRequest;
|
|
|
-import com.style24.core.biz.checkout.mall.ShipProductOrderResponse;
|
|
|
+import com.style24.core.biz.checkout.mall.*;
|
|
|
+import com.style24.core.biz.dao.TscOrderChangeDao;
|
|
|
+import com.style24.persistence.domain.OrderChange;
|
|
|
+import org.apache.axis.AxisFault;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -54,6 +56,9 @@ public class TscNaverPayService {
|
|
|
@Autowired
|
|
|
private TscOrderDao orderDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TscOrderChangeDao orderChangeDao;
|
|
|
+
|
|
|
private String timeStamp;
|
|
|
private String signature;
|
|
|
|
|
|
@@ -292,6 +297,78 @@ public class TscNaverPayService {
|
|
|
cancelNaverPayment(payment);
|
|
|
}
|
|
|
|
|
|
+ public void sendNaverPayOrderCancelConfirm(Order param) {
|
|
|
+ Collection<Order> confirmList = orderChangeDao.getOrderChangeDetailList(param);
|
|
|
+ try {
|
|
|
+ Security.addProvider(new BouncyCastleProvider());
|
|
|
+ AccessCredentialsType accessCredentialsType = new AccessCredentialsType();
|
|
|
+ MallServiceLocator MSL = new MallServiceLocator(env.getProperty("naverPay.port.address"));
|
|
|
+ MallServiceSOAP11BindingStub stub = new MallServiceSOAP11BindingStub();
|
|
|
+
|
|
|
+ stub = (MallServiceSOAP11BindingStub) MSL.getMallServiceSOAP11Port();
|
|
|
+
|
|
|
+ ApproveCancelApplicationRequest approveCancelApplicationRequest = null;
|
|
|
+ ApproveCancelApplicationResponse approveCancelApplicationResponse = null;
|
|
|
+
|
|
|
+ // 네이버페이 주문상세 정보 가져올 Request , Response 세팅
|
|
|
+ GetProductOrderInfoListRequest getProdOrderInfoRequest = new GetProductOrderInfoListRequest();
|
|
|
+ GetProductOrderInfoListResponse getProdOrderInfoResponse = new GetProductOrderInfoListResponse();
|
|
|
+
|
|
|
+ for(Order order : confirmList) {
|
|
|
+ //서명생성
|
|
|
+ generateSignature("ApproveCancelApplication", env.getProperty("naverPay.secret.key"));
|
|
|
+ log.debug("ApproveCancelApplication(취소요청승인 데이타 송신) :: timeStamp === " + timeStamp);
|
|
|
+
|
|
|
+ //인증정보
|
|
|
+ accessCredentialsType.setAccessLicense(env.getProperty("naverPay.access.license"));
|
|
|
+ accessCredentialsType.setSignature(signature);
|
|
|
+ accessCredentialsType.setTimestamp(timeStamp);
|
|
|
+
|
|
|
+ approveCancelApplicationRequest = new ApproveCancelApplicationRequest();
|
|
|
+ approveCancelApplicationRequest.setAccessCredentials(accessCredentialsType);
|
|
|
+ approveCancelApplicationRequest.setDetailLevel("Full");
|
|
|
+ approveCancelApplicationRequest.setVersion(env.getProperty("naverPay.version"));
|
|
|
+ approveCancelApplicationRequest.setRequestID("");
|
|
|
+ approveCancelApplicationRequest.setProductOrderID(order.getNpayOrdDtlNo());
|
|
|
+
|
|
|
+ approveCancelApplicationResponse = stub.approveCancelApplication(approveCancelApplicationRequest);
|
|
|
+
|
|
|
+ String resultStr = "";
|
|
|
+ if (approveCancelApplicationResponse.getResponseType() != null) {
|
|
|
+ resultStr = approveCancelApplicationResponse.getResponseType().toUpperCase();
|
|
|
+ }
|
|
|
+
|
|
|
+ //결과 출력
|
|
|
+ if ("SUCCESS".equals(resultStr)) {
|
|
|
+ log.info("취소승인 성공 주문번호 ===> " + param.getOrdNo());
|
|
|
+ log.info("취소승인 성공 네이버상품주문번호 ===> " + order.getNpayOrdDtlNo());
|
|
|
+ } else {
|
|
|
+ log.debug("취소승인 에러");
|
|
|
+ log.debug("주문번호 ===> " + param.getOrdNo());
|
|
|
+ log.debug("네이버주문번호 ===> " + order.getNpayOrdDtlNo());
|
|
|
+ log.debug("Code : " + approveCancelApplicationResponse.getError().getCode());
|
|
|
+ log.debug("Message : " + approveCancelApplicationResponse.getError().getMessage());
|
|
|
+ log.debug("Detail : " + approveCancelApplicationResponse.getError().getDetail());
|
|
|
+
|
|
|
+ Order fail = new Order();
|
|
|
+ fail.setErrorReason("취소 완료 주문 정보 송부 에러");
|
|
|
+ fail.setOrdNo(order.getOrdNo());
|
|
|
+ fail.setOptCd("sendNaverPayOrderCancelConfirm");
|
|
|
+ fail.setResultCd(approveCancelApplicationResponse.getError().getCode());
|
|
|
+ fail.setResultMsg(approveCancelApplicationResponse.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(param.getRegNo());
|
|
|
+
|
|
|
+ orderDao.createNaverPayErrorLog(fail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch(Exception e) {
|
|
|
+ throw new IllegalStateException("네이버페이 취소 완료 송부 실패");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void sendNaverPayDeliveryStartOrder(Collection<Order> params, String statGb) {
|
|
|
for(Order param : params) {
|
|
|
if ("SHIPPING".equals(statGb)) {
|