fix(payverse-verify): 결제 성공 여부 판단 로직 수정
- processingAmount 대신 requestAmount와 can 가격 비교 - productName, customerId 비교 추가
This commit is contained in:
@@ -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(
|
||||
|
@@ -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")
|
||||
|
||||
|
Reference in New Issue
Block a user