|
|
@@ -1,9 +1,6 @@
|
|
|
package com.style24.core.biz.service;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -13,14 +10,11 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import com.gagaframework.web.parameter.GagaMap;
|
|
|
-import com.style24.core.biz.thirdparty.KakaoPayApi;
|
|
|
+import com.style24.core.biz.dao.TscOrderDao;
|
|
|
import com.style24.core.biz.thirdparty.NaverPayApi;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
|
-import com.style24.persistence.domain.KakaoPay;
|
|
|
import com.style24.persistence.domain.NaverPay;
|
|
|
import com.style24.persistence.domain.Order;
|
|
|
import com.style24.persistence.domain.Payment;
|
|
|
@@ -46,6 +40,9 @@ public class TscNaverPayService {
|
|
|
@Autowired
|
|
|
private NaverPayApi naverPayApi;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TscOrderDao orderDao;
|
|
|
+
|
|
|
/**
|
|
|
* 네이버페이 결제준비 처리
|
|
|
*
|
|
|
@@ -216,10 +213,15 @@ public class TscNaverPayService {
|
|
|
payment.setCustNo(payment.getCustNo());
|
|
|
payment.setNaverMethodType(naverPay.getBody().getPrimaryPayMeans());
|
|
|
payment.setPayAmt(naverPay.getBody().getPrimaryPayCancelAmount() + naverPay.getBody().getNpointCancelAmount());
|
|
|
+ payment.setResCd(naverPay.getCode());
|
|
|
+ payment.setResMsg(naverPay.getMessage());
|
|
|
+
|
|
|
+ orderDao.insertPayment(payment);
|
|
|
+ } else {
|
|
|
+ throw new IllegalStateException(naverPay.getMessage());
|
|
|
}
|
|
|
|
|
|
- payment.setResCd(naverPay.getCode());
|
|
|
- payment.setResMsg(naverPay.getMessage());
|
|
|
+
|
|
|
|
|
|
return payment;
|
|
|
}
|
|
|
@@ -238,4 +240,18 @@ public class TscNaverPayService {
|
|
|
|
|
|
return payment;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 네이버페이 결제 처리 후 로직 진행 중 에러 발생으로 인한 취소처리
|
|
|
+ *
|
|
|
+ * @param Payment
|
|
|
+ * @author card007
|
|
|
+ * @since 2021. 04. 09
|
|
|
+ */
|
|
|
+ public void naverPayRollBack(Payment payment) {
|
|
|
+ payment.setPayStat(TscConstants.PaymentStat.DB_FAIL.value());
|
|
|
+ payment.setPayGb("E");
|
|
|
+
|
|
|
+ cancelNaverPayment(payment);
|
|
|
+ }
|
|
|
}
|