fix(gift): 전달 완료 가능 액션의 수취인 조건을 반영한다

This commit is contained in:
2026-10-02 20:07:06 +09:00
parent 0bbb9e4fc7
commit 112ad755e5
2 changed files with 40 additions and 5 deletions
@@ -146,9 +146,13 @@ class GiftAdminQueryServiceTest @Autowired constructor(
service.getGiftDetail("A-100260930102").availableActions
)
assertEquals(
listOf("COMPLETE_DELIVERY", "MARK_UNDELIVERABLE"),
listOf("MARK_UNDELIVERABLE"),
service.getGiftDetail("A-100260930103").availableActions
)
assertEquals(
listOf("MARK_UNDELIVERABLE"),
service.getGifts(GiftStatus.INSPECTION_COMPLETED, null, null, 0, 20).items.single().availableActions
)
assertEquals(emptyList<String>(), service.getGiftDetail("A-100260930104").availableActions)
assertEquals(emptyList<String>(), service.getGiftDetail("A-100260930105").availableActions)
assertEquals(emptyList<String>(), service.getGiftDetail("A-100260930106").availableActions)
@@ -158,6 +162,33 @@ class GiftAdminQueryServiceTest @Autowired constructor(
assertEquals("common.error.invalid_request", exception.messageKey)
}
@Test
@DisplayName("수취인 정보가 입력된 검수 완료 선물만 전달 완료 액션을 반환한다")
fun shouldReturnCompleteDeliveryActionOnlyWithRecipientAddress() {
val sender = saveMember("fan-alpha")
val recipient = saveMember("creator-alpha")
val category = saveCategory()
val gift = saveGift(
applicationNo = "A-1002609300001",
sender = sender,
recipient = recipient,
category = category,
status = GiftStatus.INSPECTION_COMPLETED
)
requireNotNull(deliveryRepository.findByGiftId(requireNotNull(gift.id))).apply {
recipientName = "김소다"
recipientPhoneNumber = "01098765432"
recipientZipCode = "04524"
recipientAddress = "서울시 중구"
}
val detail = service().getGiftDetail(gift.applicationNo)
val listItem = service().getGifts(GiftStatus.INSPECTION_COMPLETED, null, null, 0, 20).items.single()
assertEquals(listOf("COMPLETE_DELIVERY", "MARK_UNDELIVERABLE"), detail.availableActions)
assertEquals(listOf("COMPLETE_DELIVERY", "MARK_UNDELIVERABLE"), listItem.availableActions)
}
private fun service() = GiftAdminQueryService(
giftRepository = giftRepository,
deliveryRepository = deliveryRepository,