콘텐츠 구매 - 소장만 추가 #234

Merged
klaus merged 7 commits from test into main 2024-11-08 12:40:30 +00:00
1 changed files with 7 additions and 6 deletions
Showing only changes of commit cc695c115b - Show all commits

View File

@ -79,13 +79,14 @@ class OrderService(
private fun validateOrder(memberId: Long, content: AudioContent, orderType: OrderType) { private fun validateOrder(memberId: Long, content: AudioContent, orderType: OrderType) {
if (memberId == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.") if (memberId == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.")
if (repository.isExistOrdered(memberId = memberId, contentId = content.id!!)) { val existOrdered = repository.isExistOrdered(memberId = memberId, contentId = content.id!!)
throw SodaException("이미 구매한 콘텐츠 입니다.") if (existOrdered) throw SodaException("이미 구매한 콘텐츠 입니다.")
}
if (content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL) { val isOnlyRental = content.purchaseOption == PurchaseOption.RENT_ONLY || content.isOnlyRental
throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.") if (isOnlyRental && orderType == OrderType.KEEP) throw SodaException("대여만 가능한 콘텐츠 입니다.")
}
val isOnlyBuy = content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL
if (isOnlyBuy) throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.")
} }
fun getAudioContentOrderList( fun getAudioContentOrderList(