feat(gift): 관리자 선물 목록과 상세에 취소 액션을 노출한다
This commit is contained in:
+2
-1
@@ -157,6 +157,7 @@ class GiftAdminQueryService(
|
||||
)
|
||||
|
||||
private fun GiftStatus.availableActions(delivery: GiftDelivery) = when (this) {
|
||||
GiftStatus.RECEIVED -> listOf("CANCEL")
|
||||
GiftStatus.TRACKING_REGISTERED -> listOf("ARRIVE_MAILBOX", "MARK_UNDELIVERABLE")
|
||||
GiftStatus.ARRIVED_AT_MAILBOX -> listOf("COMPLETE_INSPECTION", "MARK_UNDELIVERABLE")
|
||||
GiftStatus.INSPECTION_COMPLETED -> if (delivery.hasCompleteRecipientInformation()) {
|
||||
@@ -164,7 +165,7 @@ class GiftAdminQueryService(
|
||||
} else {
|
||||
listOf("MARK_UNDELIVERABLE")
|
||||
}
|
||||
GiftStatus.RECEIVED, GiftStatus.DELIVERED, GiftStatus.UNDELIVERABLE, GiftStatus.CANCELED -> emptyList()
|
||||
GiftStatus.DELIVERED, GiftStatus.UNDELIVERABLE, GiftStatus.CANCELED -> emptyList()
|
||||
}
|
||||
|
||||
private fun GiftDelivery.recipientAddressResult(): String {
|
||||
|
||||
+14
-20
@@ -125,7 +125,7 @@ class GiftAdminQueryServiceTest @Autowired constructor(
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("관리자 선물 상세는 상태별 가능한 액션을 반환하고 없는 신청번호를 거부한다")
|
||||
@DisplayName("관리자 선물 목록과 상세는 상태별 가능한 액션을 반환하고 없는 신청번호를 거부한다")
|
||||
fun shouldReturnAvailableActionsByStatusAndRejectUnknownApplicationNo() {
|
||||
val sender = saveMember("fan-alpha")
|
||||
val recipient = saveMember("creator-alpha")
|
||||
@@ -136,26 +136,20 @@ class GiftAdminQueryServiceTest @Autowired constructor(
|
||||
|
||||
val service = service()
|
||||
|
||||
assertEquals(emptyList<String>(), service.getGiftDetail("A-100260930100").availableActions)
|
||||
assertEquals(
|
||||
listOf("ARRIVE_MAILBOX", "MARK_UNDELIVERABLE"),
|
||||
service.getGiftDetail("A-100260930101").availableActions
|
||||
val expectedActions = mapOf(
|
||||
GiftStatus.RECEIVED to listOf("CANCEL"),
|
||||
GiftStatus.TRACKING_REGISTERED to listOf("ARRIVE_MAILBOX", "MARK_UNDELIVERABLE"),
|
||||
GiftStatus.ARRIVED_AT_MAILBOX to listOf("COMPLETE_INSPECTION", "MARK_UNDELIVERABLE"),
|
||||
GiftStatus.INSPECTION_COMPLETED to listOf("MARK_UNDELIVERABLE"),
|
||||
GiftStatus.DELIVERED to emptyList(),
|
||||
GiftStatus.UNDELIVERABLE to emptyList(),
|
||||
GiftStatus.CANCELED to emptyList()
|
||||
)
|
||||
assertEquals(
|
||||
listOf("COMPLETE_INSPECTION", "MARK_UNDELIVERABLE"),
|
||||
service.getGiftDetail("A-100260930102").availableActions
|
||||
)
|
||||
assertEquals(
|
||||
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)
|
||||
expectedActions.forEach { (status, actions) ->
|
||||
val item = service.getGifts(status, null, null, 0, 20).items.single()
|
||||
assertEquals(actions, service.getGiftDetail(item.applicationNo).availableActions, status.name)
|
||||
assertEquals(actions, item.availableActions, status.name)
|
||||
}
|
||||
val exception = assertThrows(SodaException::class.java) {
|
||||
service.getGiftDetail("UNKNOWN")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user