콘텐츠 구매
- 소장만 가능한 콘텐츠를 대여 하려는 경우 안내메시지 추가
This commit is contained in:
		| @@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.can.use.CanUsage | ||||
| import kr.co.vividnext.sodalive.common.SodaException | ||||
| import kr.co.vividnext.sodalive.content.AudioContent | ||||
| import kr.co.vividnext.sodalive.content.AudioContentRepository | ||||
| import kr.co.vividnext.sodalive.content.PurchaseOption | ||||
| import kr.co.vividnext.sodalive.content.comment.AudioContentCommentRepository | ||||
| import kr.co.vividnext.sodalive.content.like.AudioContentLikeRepository | ||||
| import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem | ||||
| @@ -31,7 +32,7 @@ class OrderService( | ||||
|     fun order(contentId: Long, orderType: OrderType, container: String, member: Member) { | ||||
|         val content = audioContentRepository.findByIdAndActive(contentId) | ||||
|             ?: throw SodaException("잘못된 콘텐츠 입니다\n다시 시도해 주세요.") | ||||
|         validateOrder(memberId = member.id!!, content = content) | ||||
|         validateOrder(memberId = member.id!!, content = content, orderType = orderType) | ||||
|  | ||||
|         val order = if (content.limited != null && content.remaining != null) { | ||||
|             if (content.remaining!! <= 0) throw SodaException("해당 콘텐츠가 매진되었습니다.") | ||||
| @@ -75,11 +76,16 @@ class OrderService( | ||||
|         return order | ||||
|     } | ||||
|  | ||||
|     private fun validateOrder(memberId: Long, content: AudioContent) { | ||||
|     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("이미 구매한 콘텐츠 입니다.") | ||||
|         } | ||||
|  | ||||
|         if (content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL) { | ||||
|             throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.") | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     fun getAudioContentOrderList( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user