--- src/main/java/itn/let/mjo/pay/service/impl/MjonPayServiceImpl.java
+++ src/main/java/itn/let/mjo/pay/service/impl/MjonPayServiceImpl.java
... | ... | @@ -167,8 +167,7 @@ |
| 167 | 167 |
|
| 168 | 168 |
//nice - nicepay, sb - 세틀뱅크(가상계좌), kgm - kg 모바일 (핸드폰 결제) |
| 169 | 169 |
@Override |
| 170 |
- public MjonPayVO insertPay(MjonPayVO mjonPayVO, HttpServletRequest request, String p_payment_comp |
|
| 171 |
- ) throws Exception {
|
|
| 170 |
+ public MjonPayVO insertPay(MjonPayVO mjonPayVO, HttpServletRequest request, String p_payment_comp) throws Exception {
|
|
| 172 | 171 |
System.out.println("START 카드결제");
|
| 173 | 172 |
if (!isSupportedPaymentComp(p_payment_comp)) {
|
| 174 | 173 |
mjonPayVO.setPaySuccess(false); |
... | ... | @@ -729,7 +728,7 @@ |
| 729 | 728 |
result.setBankName((String) resultData.get("BankName"));
|
| 730 | 729 |
|
| 731 | 730 |
boolean resultSuccess = isInnopaySuccess(responsePayMethod, resultCode); |
| 732 |
- boolean amountValid = amt != null && amt.equals(responseAmt); |
|
| 731 |
+ boolean amountValid = isSamePaymentAmount(amt, responseAmt); |
|
| 733 | 732 |
boolean tidValid = txTid != null && txTid.equals(responseTid); |
| 734 | 733 |
|
| 735 | 734 |
result.setSuccess(resultSuccess && amountValid && tidValid); |
... | ... | @@ -737,6 +736,16 @@ |
| 737 | 736 |
return result; |
| 738 | 737 |
} |
| 739 | 738 |
|
| 739 |
+ // PG 응답 금액은 고정 길이로 앞에 0이 채워질 수 있다. |
|
| 740 |
+ static boolean isSamePaymentAmount(String requestedAmount, String approvedAmount) {
|
|
| 741 |
+ if (requestedAmount == null || approvedAmount == null |
|
| 742 |
+ || !requestedAmount.matches("[0-9]+") || !approvedAmount.matches("[0-9]+")) {
|
|
| 743 |
+ return false; |
|
| 744 |
+ } |
|
| 745 |
+ return new java.math.BigInteger(requestedAmount) |
|
| 746 |
+ .equals(new java.math.BigInteger(approvedAmount)); |
|
| 747 |
+ } |
|
| 748 |
+ |
|
| 740 | 749 |
private String getMerchantKey() {
|
| 741 | 750 |
return "33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A=="; |
| 742 | 751 |
} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?