Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

중복 검증 코드 제거한다. #24

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ class EnrollCouponByMessageService(
private val transactionArea: TransactionArea,
private val findMember: (Long) -> Member = { loadMemberStatePort.findMember(it) },
private val useGiftCouponCode: (GiftCouponCode) -> GiftCoupon = {
val giftCoupon = loadGiftCouponStatePort.findGiftCoupon(it)
if (giftCoupon.isUsed) throw IllegalArgumentException("이미 사용된 쿠폰입니다.")
useGiftCouponCodeStatePort.useBy(it)
giftCoupon
loadGiftCouponStatePort.findGiftCoupon(it)
},
private val updateMembersCoupon: (Member) -> Unit = { updateMemberStatePort.updateMembersCoupon(it) },
) : EnrollCouponByMessageUseCase {
Expand Down
Loading