fix(payverse): PVKR 카드 코드면 method를 "카드"로 저장

This commit is contained in:
2025-09-30 17:02:02 +09:00
parent 22bd1bf042
commit 1bd6f8da4e
3 changed files with 26 additions and 2 deletions

View File

@@ -64,11 +64,13 @@ class CanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : CanQue
val chargeStatusCondition = when (container) {
"aos" -> {
charge.payment.paymentGateway.eq(PaymentGateway.PG)
.or(charge.payment.paymentGateway.eq(PaymentGateway.PAYVERSE))
.or(charge.payment.paymentGateway.eq(PaymentGateway.GOOGLE_IAP))
}
"ios" -> {
charge.payment.paymentGateway.eq(PaymentGateway.PG)
.or(charge.payment.paymentGateway.eq(PaymentGateway.PAYVERSE))
.or(charge.payment.paymentGateway.eq(PaymentGateway.APPLE_IAP))
}

View File

@@ -63,6 +63,7 @@ data class PayverseVerifyRequest(
data class PayverseVerifyResponse(
val resultStatus: String,
val tid: String,
val schemeGroup: String,
val schemeCode: String,
val transactionType: String,
val transactionStatus: String,
@@ -77,6 +78,7 @@ data class PayverseWebhookRequest(
val type: String,
val mid: String,
val tid: String,
val schemeGroup: String,
val schemeCode: String,
val orderId: String,
val productName: String,

View File

@@ -118,7 +118,12 @@ class ChargeService(
if (isSuccess) {
// payverseVerify의 226~246 라인과 동일 처리
charge.payment?.receiptId = request.tid
charge.payment?.method = request.schemeCode
val mappedMethod = if (request.schemeGroup == "PVKR") {
mapPayverseSchemeToMethodByCode(request.schemeCode)
} else {
null
}
charge.payment?.method = mappedMethod ?: request.schemeCode
charge.payment?.status = PaymentStatus.COMPLETE
charge.payment?.locale = request.requestCurrency
@@ -280,6 +285,7 @@ class ChargeService(
}
val body = response.body?.string() ?: throw SodaException("결제정보에 오류가 있습니다.")
print(body)
val verifyResponse = objectMapper.readValue(body, PayverseVerifyResponse::class.java)
val isSuccess = verifyResponse.resultStatus == "SUCCESS" &&
@@ -290,7 +296,12 @@ class ChargeService(
if (isSuccess) {
// verify 함수의 232~248 라인과 동일 처리
charge.payment?.receiptId = verifyResponse.tid
charge.payment?.method = verifyResponse.schemeCode
val mappedMethod = if (verifyResponse.schemeGroup == "PVKR") {
mapPayverseSchemeToMethodByCode(verifyResponse.schemeCode)
} else {
null
}
charge.payment?.method = mappedMethod ?: verifyResponse.schemeCode
charge.payment?.status = PaymentStatus.COMPLETE
// 통화코드 설정
charge.payment?.locale = verifyResponse.processingCurrency
@@ -642,4 +653,13 @@ class ChargeService(
throw SodaException("결제를 완료하지 못했습니다.")
}
}
// Payverse 결제수단 매핑: 특정 schemeCode는 "카드"로 표기, 아니면 null 반환
private fun mapPayverseSchemeToMethodByCode(schemeCode: String?): String? {
val cardCodes = setOf(
"041", "044", "361", "364", "365", "366", "367", "368", "369", "370", "371", "372", "373", "374", "381",
"218", "071", "002", "089", "045", "050", "048", "090", "092"
)
return if (schemeCode != null && cardCodes.contains(schemeCode)) "카드" else null
}
}