From 1bd6f8da4edbf74a3298f4b47a0ad13ab224bf19 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 30 Sep 2025 17:02:02 +0900 Subject: [PATCH] =?UTF-8?q?fix(payverse):=20PVKR=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EB=A9=B4=20method=EB=A5=BC=20"=EC=B9=B4?= =?UTF-8?q?=EB=93=9C"=EB=A1=9C=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vividnext/sodalive/can/CanRepository.kt | 2 ++ .../sodalive/can/charge/ChargeData.kt | 2 ++ .../sodalive/can/charge/ChargeService.kt | 24 +++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/CanRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/CanRepository.kt index 61863a0..12fc614 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/CanRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/can/CanRepository.kt @@ -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)) } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeData.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeData.kt index 312c713..9689415 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeData.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeData.kt @@ -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, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt index caa25e4..83c0a0b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt @@ -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 + } }