콘텐츠 구매

- 대여만 가능한 콘텐츠를 소장 하려는 경우 안내메시지 추가
This commit is contained in:
Klaus 2024-11-08 14:54:53 +09:00
parent 86dac7e2b4
commit cc695c115b
1 changed files with 7 additions and 6 deletions

View File

@ -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(