payverse 적용 #344
@@ -64,11 +64,13 @@ class CanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : CanQue
|
|||||||
val chargeStatusCondition = when (container) {
|
val chargeStatusCondition = when (container) {
|
||||||
"aos" -> {
|
"aos" -> {
|
||||||
charge.payment.paymentGateway.eq(PaymentGateway.PG)
|
charge.payment.paymentGateway.eq(PaymentGateway.PG)
|
||||||
|
.or(charge.payment.paymentGateway.eq(PaymentGateway.PAYVERSE))
|
||||||
.or(charge.payment.paymentGateway.eq(PaymentGateway.GOOGLE_IAP))
|
.or(charge.payment.paymentGateway.eq(PaymentGateway.GOOGLE_IAP))
|
||||||
}
|
}
|
||||||
|
|
||||||
"ios" -> {
|
"ios" -> {
|
||||||
charge.payment.paymentGateway.eq(PaymentGateway.PG)
|
charge.payment.paymentGateway.eq(PaymentGateway.PG)
|
||||||
|
.or(charge.payment.paymentGateway.eq(PaymentGateway.PAYVERSE))
|
||||||
.or(charge.payment.paymentGateway.eq(PaymentGateway.APPLE_IAP))
|
.or(charge.payment.paymentGateway.eq(PaymentGateway.APPLE_IAP))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,6 +63,7 @@ data class PayverseVerifyRequest(
|
|||||||
data class PayverseVerifyResponse(
|
data class PayverseVerifyResponse(
|
||||||
val resultStatus: String,
|
val resultStatus: String,
|
||||||
val tid: String,
|
val tid: String,
|
||||||
|
val schemeGroup: String,
|
||||||
val schemeCode: String,
|
val schemeCode: String,
|
||||||
val transactionType: String,
|
val transactionType: String,
|
||||||
val transactionStatus: String,
|
val transactionStatus: String,
|
||||||
@@ -77,6 +78,7 @@ data class PayverseWebhookRequest(
|
|||||||
val type: String,
|
val type: String,
|
||||||
val mid: String,
|
val mid: String,
|
||||||
val tid: String,
|
val tid: String,
|
||||||
|
val schemeGroup: String,
|
||||||
val schemeCode: String,
|
val schemeCode: String,
|
||||||
val orderId: String,
|
val orderId: String,
|
||||||
val productName: String,
|
val productName: String,
|
||||||
|
@@ -118,7 +118,12 @@ class ChargeService(
|
|||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
// payverseVerify의 226~246 라인과 동일 처리
|
// payverseVerify의 226~246 라인과 동일 처리
|
||||||
charge.payment?.receiptId = request.tid
|
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?.status = PaymentStatus.COMPLETE
|
||||||
charge.payment?.locale = request.requestCurrency
|
charge.payment?.locale = request.requestCurrency
|
||||||
|
|
||||||
@@ -280,6 +285,7 @@ class ChargeService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val body = response.body?.string() ?: throw SodaException("결제정보에 오류가 있습니다.")
|
val body = response.body?.string() ?: throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
print(body)
|
||||||
val verifyResponse = objectMapper.readValue(body, PayverseVerifyResponse::class.java)
|
val verifyResponse = objectMapper.readValue(body, PayverseVerifyResponse::class.java)
|
||||||
|
|
||||||
val isSuccess = verifyResponse.resultStatus == "SUCCESS" &&
|
val isSuccess = verifyResponse.resultStatus == "SUCCESS" &&
|
||||||
@@ -290,7 +296,12 @@ class ChargeService(
|
|||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
// verify 함수의 232~248 라인과 동일 처리
|
// verify 함수의 232~248 라인과 동일 처리
|
||||||
charge.payment?.receiptId = verifyResponse.tid
|
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?.status = PaymentStatus.COMPLETE
|
||||||
// 통화코드 설정
|
// 통화코드 설정
|
||||||
charge.payment?.locale = verifyResponse.processingCurrency
|
charge.payment?.locale = verifyResponse.processingCurrency
|
||||||
@@ -642,4 +653,13 @@ class ChargeService(
|
|||||||
throw SodaException("결제를 완료하지 못했습니다.")
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user