fix(payverse-verify): 결제 성공 여부 판단 로직 수정

- processingAmount 대신 requestAmount와 can 가격 비교
- productName, customerId 비교 추가
This commit is contained in:
2025-10-03 01:25:27 +09:00
parent 02ef706fc2
commit 42eaf1d5e3
2 changed files with 8 additions and 4 deletions

View File

@@ -70,8 +70,9 @@ data class PayverseVerifyResponse(
val transactionMessage: String,
val orderId: String,
val customerId: String,
val processingCurrency: String,
val processingAmount: BigDecimal
val productName: String,
val requestCurrency: String,
val requestAmount: BigDecimal
)
data class PayverseWebhookRequest(

View File

@@ -346,10 +346,13 @@ class ChargeService(
val verifyResponse = objectMapper.readValue(body, PayverseVerifyResponse::class.java)
println(verifyResponse)
val customerId = "${serverEnv}_user_${member.id!!}"
val isSuccess = verifyResponse.resultStatus == "SUCCESS" &&
verifyResponse.transactionStatus == "SUCCESS" &&
verifyResponse.orderId.toLongOrNull() == charge.id &&
verifyResponse.processingAmount.compareTo(charge.can!!.price) == 0
verifyResponse.productName == charge.title &&
verifyResponse.customerId == customerId &&
verifyResponse.requestAmount.compareTo(charge.can!!.price) == 0
println(isSuccess)
if (isSuccess) {
@@ -363,7 +366,7 @@ class ChargeService(
charge.payment?.method = mappedMethod ?: verifyResponse.schemeCode
charge.payment?.status = PaymentStatus.COMPLETE
// 통화코드 설정
charge.payment?.locale = verifyResponse.processingCurrency
charge.payment?.locale = verifyResponse.requestCurrency
member.charge(charge.chargeCan, charge.rewardCan, "pg")