From cc695c115bf41c69da08709e67047ab764d90b98 Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 8 Nov 2024 14:54:53 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B5=AC?= =?UTF-8?q?=EB=A7=A4=20-=20=EB=8C=80=EC=97=AC=EB=A7=8C=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=9C=20=EC=BD=98=ED=85=90=EC=B8=A0=EB=A5=BC=20?= =?UTF-8?q?=EC=86=8C=EC=9E=A5=20=ED=95=98=EB=A0=A4=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EC=95=88=EB=82=B4=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/content/order/OrderService.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/order/OrderService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/order/OrderService.kt index d6c3e0e..630b22a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/order/OrderService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/order/OrderService.kt @@ -79,13 +79,14 @@ class OrderService( private fun validateOrder(memberId: Long, content: AudioContent, orderType: OrderType) { if (memberId == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.") - if (repository.isExistOrdered(memberId = memberId, contentId = content.id!!)) { - throw SodaException("이미 구매한 콘텐츠 입니다.") - } + val existOrdered = repository.isExistOrdered(memberId = memberId, contentId = content.id!!) + if (existOrdered) throw SodaException("이미 구매한 콘텐츠 입니다.") - if (content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL) { - throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.") - } + val isOnlyRental = content.purchaseOption == PurchaseOption.RENT_ONLY || content.isOnlyRental + if (isOnlyRental && orderType == OrderType.KEEP) throw SodaException("대여만 가능한 콘텐츠 입니다.") + + val isOnlyBuy = content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL + if (isOnlyBuy) throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.") } fun getAudioContentOrderList(