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(