收口V4 OWNER RATE目录数据

This commit is contained in:
andy
2026-07-21 19:11:57 +07:00
parent f3b6adda17
commit 6e97778633
19 changed files with 520 additions and 188 deletions

View File

@@ -555,10 +555,10 @@ class ReservationFrontendQueryControllerTest {
"arrival_date": "2026-07-26",
"departure_date": "2026-07-29",
"nights": 3,
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"room_items": [
{"room_type_code": "RM1", "room_count": 2},
{"room_type_code": "RM2", "room_count": 1}
{"room_type_code": "RM2", "room_count": 2},
{"room_type_code": "RM3", "room_count": 1}
]
}
}
@@ -591,9 +591,9 @@ class ReservationFrontendQueryControllerTest {
.andExpect(jsonPath("$.order_overview.source_code").value("TRAVEL_AGENT"))
.andExpect(jsonPath("$.order_overview.arrival_date").value("2026-07-26"))
.andExpect(jsonPath("$.order_overview.departure_date").value("2026-07-29"))
.andExpect(jsonPath("$.order_overview.rate_code").value("BAR"))
.andExpect(jsonPath("$.order_overview.rate_code").value("GRPA2-850UP"))
.andExpect(jsonPath("$.order_overview.room_items.length()").value(2))
.andExpect(jsonPath("$.order_overview.room_items[0].room_type_code").value("RM1"))
.andExpect(jsonPath("$.order_overview.room_items[0].room_type_code").value("RM2"))
.andExpect(jsonPath("$.order_overview.room_items[0].room_count").value(2))
.andExpect(jsonPath("$.order_overview.room_items[?(@.room_type_code=='SHOULD_NOT_APPEAR')]")
.isEmpty())

View File

@@ -2,6 +2,8 @@ package cn.nianxx.thhotel.workflows.reservation.control;
import static cn.nianxx.thhotel.support.MockMvcAuthTestSupport.loginToken;
import static cn.nianxx.thhotel.support.MockMvcAuthTestSupport.performAuthorized;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -47,5 +49,20 @@ class ReservationV4CatalogBootstrapRunnerTest {
.andExpect(jsonPath("$.catalog_source").value("FIXED_SEED_IMPORT"))
.andExpect(jsonPath("$.catalog_version").value("seed-20260719-v1"))
.andExpect(jsonPath("$.items[0].code").value("QBD_TRAVEL"));
performAuthorized(mockMvc, token, get("/api/reservation/lookups/room-types")
.param("hotel_id", HOTEL_ID)
.param("page_size", "20"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.items", hasSize(6)))
.andExpect(jsonPath("$.items[*].code", contains("RM2", "RM3", "RM4", "SU1", "SU2", "SU3")));
performAuthorized(mockMvc, token, get("/api/reservation/lookups/rate-codes")
.param("hotel_id", HOTEL_ID)
.param("page_size", "100"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.items", hasSize(40)))
.andExpect(jsonPath("$.items[0].code").value("GRPA2-850UP"))
.andExpect(jsonPath("$.items[39].code").value("WHO3-2400"));
}
}

View File

@@ -2,6 +2,8 @@ package cn.nianxx.thhotel.workflows.reservation.control;
import static cn.nianxx.thhotel.support.MockMvcAuthTestSupport.loginToken;
import static cn.nianxx.thhotel.support.MockMvcAuthTestSupport.performAuthorized;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -98,24 +100,30 @@ class ReservationV4CatalogLookupControllerTest {
}
@Test
void shouldReturnRoomTypeAndRateCodeLookupFromDatabaseSeed() throws Exception {
void shouldReturnOwnerRateRoomTypeAndRateCodeLookupFromDatabaseSeed() throws Exception {
performAuthorized(mockMvc, adminToken(), get("/api/reservation/lookups/room-types")
.param("hotel_id", HOTEL_ID)
.param("keyword", "RM2"))
.param("page_size", "20"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.catalog_type").value("ROOM_TYPE"))
.andExpect(jsonPath("$.catalog_source").value("FIXED_SEED_IMPORT"))
.andExpect(jsonPath("$.items[0].code").value("RM2"))
.andExpect(jsonPath("$.items[0].status").value("ACTIVE"));
.andExpect(jsonPath("$.items", hasSize(6)))
.andExpect(jsonPath("$.items[*].code", contains("RM2", "RM3", "RM4", "SU1", "SU2", "SU3")))
.andExpect(jsonPath("$.page.total").value(6));
performAuthorized(mockMvc, adminToken(), get("/api/reservation/lookups/rate-codes")
.param("hotel_id", HOTEL_ID)
.param("keyword", "GROUP"))
.param("page_size", "100"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.catalog_type").value("RATE_CODE"))
.andExpect(jsonPath("$.catalog_source").value("FIXED_SEED_IMPORT"))
.andExpect(jsonPath("$.items[0].code").value("GROUP"))
.andExpect(jsonPath("$.items[0].pricing_available").value(false));
.andExpect(jsonPath("$.items", hasSize(40)))
.andExpect(jsonPath("$.items[0].code").value("GRPA2-850UP"))
.andExpect(jsonPath("$.items[20].code").value("GRPA4-2400*B'FAST LEELA"))
.andExpect(jsonPath("$.items[21].code").value("WHO1-850UP"))
.andExpect(jsonPath("$.items[39].code").value("WHO3-2400"))
.andExpect(jsonPath("$.items[0].pricing_available").value(false))
.andExpect(jsonPath("$.page.total").value(40));
}
@Test
@@ -134,9 +142,9 @@ class ReservationV4CatalogLookupControllerTest {
performAuthorized(mockMvc, adminToken(), get("/api/reservation/lookups/rate-codes")
.param("hotel_id", HOTEL_ID)
.param("keyword", "group"))
.param("keyword", "grpa2-850up"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.items[0].code").value("GROUP"));
.andExpect(jsonPath("$.items[0].code").value("GRPA2-850UP"));
}
@Test

View File

@@ -141,7 +141,7 @@ class ReservationV4CommandControllerTest {
{
"version": 0,
"confirmed_payload": {
"room_items": [{"room_type_code": "TWN", "room_count": 2}]
"room_items": [{"room_type_code": "RM2", "room_count": 2}]
}
}
"""))
@@ -192,7 +192,7 @@ class ReservationV4CommandControllerTest {
{
"version": 0,
"confirmed_payload": {
"room_items": [{"room_type_code": "TWN", "room_count": 2}],
"room_items": [{"room_type_code": "RM2", "room_count": 2}],
"injected_debug_field": "SHOULD-NOT-PERSIST"
}
}
@@ -201,7 +201,7 @@ class ReservationV4CommandControllerTest {
.andExpect(jsonPath("$.order_task.order_task_status").value("COMPLETED"))
.andExpect(jsonPath("$.business_cards[0].card_status").value("CONFIRMED"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_items[0].room_type_code")
.value("TWN"))
.value("RM2"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.injected_debug_field").doesNotExist())
.andExpect(jsonPath("$.business_cards[0].availability.confirmable").value(false))
.andExpect(jsonPath("$.business_cards[0].availability.readonly_reason_code").value("CARD_LOCKED"));
@@ -427,7 +427,7 @@ class ReservationV4CommandControllerTest {
ReservationV4CardType.ROOM_INFORMATION.name(),
"NEW_BOOKING",
"""
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","guest_name":"FIT Guest","room_items":[{"room_type_code":"KING","room_count":1}]}
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","guest_name":"FIT Guest","room_items":[{"room_type_code":"RM3","room_count":1}]}
""");
confirmBasicCard(roomInformation);
confirmRoomInformationBusinessCard(roomInformation, null);
@@ -624,7 +624,7 @@ class ReservationV4CommandControllerTest {
ReservationV4CardType.TRACE_RESERVATION_NOTES.name(),
"TRACE_RESERVATION_NOTES",
"""
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":"TWN","extra_bed_room_count":0,"department_code":"FO+HSK"}]}}
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":"RM2","extra_bed_room_count":0,"department_code":"FO+HSK"}]}}
""");
confirmBasicCard(seeded);
@@ -655,7 +655,7 @@ class ReservationV4CommandControllerTest {
ReservationV4CardType.TRACE_RESERVATION_NOTES.name(),
"TRACE_RESERVATION_NOTES",
"""
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":"TWN","extra_bed_room_count":1.5,"department_code":"FO+HSK"}]}}
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":"RM2","extra_bed_room_count":1.5,"department_code":"FO+HSK"}]}}
""");
confirmBasicCard(seeded);
@@ -686,7 +686,7 @@ class ReservationV4CommandControllerTest {
ReservationV4CardType.TRACE_RESERVATION_NOTES.name(),
"TRACE_RESERVATION_NOTES",
"""
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":" TWN ","extra_bed_room_count":1,"department_code":" FO+HSK "}]}}
{"card_type":"TRACE_RESERVATION_NOTES","event_type":"TRACE_RESERVATION_NOTES","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"TRACE_RESERVATION_NOTES","trace_items":[{"item_type":"EXTRA_BED","target_room_type_code":" RM2 ","extra_bed_room_count":1,"department_code":" FO+HSK "}]}}
""");
confirmBasicCard(seeded);
@@ -701,7 +701,7 @@ class ReservationV4CommandControllerTest {
"trace_items": [
{
"item_type": "EXTRA_BED",
"target_room_type_code": " DBL ",
"target_room_type_code": " RM3 ",
"extra_bed_room_count": 2,
"department_code": " FO "
}
@@ -711,7 +711,7 @@ class ReservationV4CommandControllerTest {
"""))
.andExpect(status().isOk())
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[0].target_room_type_code")
.value("DBL"))
.value("RM3"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[0].department_code")
.value("FO"));
}
@@ -736,7 +736,7 @@ class ReservationV4CommandControllerTest {
"business_fields":{
"trace_items":[
{"item_type":"GENERAL","text":"Original trace","department_code":"FO","content":"SHOULD-NOT-PERSIST-CONTENT"},
{"item_type":"EXTRA_BED","target_room_type_code":"TWN","extra_bed_room_count":1,"department_code":"FO+HSK","content":"SHOULD-NOT-PERSIST-EXTRA-CONTENT","attachment_url":"https://oss.example.test/trace-confirm-secret.png"}
{"item_type":"EXTRA_BED","target_room_type_code":"RM2","extra_bed_room_count":1,"department_code":"FO+HSK","content":"SHOULD-NOT-PERSIST-EXTRA-CONTENT","attachment_url":"https://oss.example.test/trace-confirm-secret.png"}
]
}
}
@@ -761,7 +761,7 @@ class ReservationV4CommandControllerTest {
},
{
"item_type": "EXTRA_BED",
"target_room_type_code": "DBL",
"target_room_type_code": "RM3",
"extra_bed_room_count": 2,
"department_code": "FO",
"content": "SHOULD-NOT-PERSIST-SUBMITTED-EXTRA-CONTENT",
@@ -777,7 +777,7 @@ class ReservationV4CommandControllerTest {
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[0].department_code")
.value("HSK"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[1].target_room_type_code")
.value("DBL"))
.value("RM3"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[1].extra_bed_room_count")
.value(2))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.trace_items[1].department_code")
@@ -798,7 +798,7 @@ class ReservationV4CommandControllerTest {
Instant.parse("2026-07-19T01:13:10Z"),
null,
"""
{"card_type":"ROOM_INFORMATION","event_type":"UPDATE_BOOKING","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"UPDATE_BOOKING","after":{"room_items":[{"room_type_code":"TWN","room_count":2}]}}}
{"card_type":"ROOM_INFORMATION","event_type":"UPDATE_BOOKING","business_fields":{"order_ref":"ORDER-COMMAND","event_type":"UPDATE_BOOKING","after":{"room_items":[{"room_type_code":"RM2","room_count":2}]}}}
""");
confirmBasicCard(seeded);
@@ -816,7 +816,7 @@ class ReservationV4CommandControllerTest {
"after": {
"room_items": [
{
"room_type_code": "DBL",
"room_type_code": "RM3",
"room_count": 1,
"injected_debug_field": "SHOULD-NOT-PERSIST"
}
@@ -833,7 +833,7 @@ class ReservationV4CommandControllerTest {
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.business_fields.event_type")
.value("UPDATE_BOOKING"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.business_fields.after.room_items[0].room_type_code")
.value("DBL"))
.value("RM3"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.business_fields.after.room_items[0].room_count")
.value(1))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.business_fields.after.room_items[0].injected_debug_field")
@@ -861,8 +861,8 @@ class ReservationV4CommandControllerTest {
"pms_raw_response":{"debug":"NESTED-COMMAND-SHOULD-NOT-PERSIST"},
"arrival_date":"2026-07-26",
"departure_date":"2026-07-29",
"rate_code":"GROUP",
"room_items":[{"room_type_code":"TWN","room_count":2,"raw_evidence":"NESTED-ROOM-RAW","pms_room_type_code":"NESTED-PMS-SHOULD-NOT-PERSIST"}]
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"RM2","room_count":2,"raw_evidence":"NESTED-ROOM-RAW","pms_room_type_code":"NESTED-PMS-SHOULD-NOT-PERSIST"}]
}
}
""");
@@ -882,12 +882,12 @@ class ReservationV4CommandControllerTest {
"arrival_date": "2026-07-27",
"departure_date": "2026-07-30",
"nights": 99,
"rate_code": "GROUP",
"rate_code": "GRPA2-850UP",
"breakfast_included": false,
"group_booking_status": "DEF",
"room_items": [
{
"room_type_code": "DBL",
"room_type_code": "RM3",
"room_count": 3,
"pms_room_type_code": "SHOULD-NOT-PERSIST"
}
@@ -915,7 +915,7 @@ class ReservationV4CommandControllerTest {
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_information.final_values.group_booking_status")
.value("DEF"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_information.final_values.room_items[0].room_type_code")
.value("DBL"))
.value("RM3"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_information.final_values.room_items[0].room_count")
.value(3))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_information.final_values.room_items[0].pms_room_type_code")
@@ -959,8 +959,8 @@ class ReservationV4CommandControllerTest {
"event_type":"NEW_BOOKING",
"arrival_date":"2026-07-26",
"departure_date":"2026-07-29",
"rate_code":"GROUP",
"room_items":[{"room_type_code":"TWN","room_count":2}]
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"RM2","room_count":2}]
}
}
""");
@@ -978,10 +978,10 @@ class ReservationV4CommandControllerTest {
"final_values": {
"arrival_date": "2026-07-30",
"departure_date": "2026-07-29",
"rate_code": "GROUP",
"rate_code": "GRPA2-850UP",
"group_block_name": "GRP-V4-COMMAND-RI-DATE-001",
"room_items": [
{"room_type_code": "TWN", "room_count": 2}
{"room_type_code": "RM2", "room_count": 2}
]
}
}
@@ -1011,8 +1011,8 @@ class ReservationV4CommandControllerTest {
"guest_name":"LI CHUNHONG",
"arrival_date":"2026-07-26",
"departure_date":"2026-07-29",
"rate_code":"FIT",
"room_items":[{"room_type_code":"KING","room_count":1}]
"rate_code":"WHO1-850UP",
"room_items":[{"room_type_code":"RM3","room_count":1}]
}
}
""");
@@ -1030,9 +1030,9 @@ class ReservationV4CommandControllerTest {
"final_values": {
"arrival_date": "2026-07-26",
"departure_date": "2026-07-29",
"rate_code": "FIT",
"rate_code": "WHO1-850UP",
"room_items": [
{"room_type_code": "KING", "room_count": 1}
{"room_type_code": "RM3", "room_count": 1}
]
}
}
@@ -1247,7 +1247,7 @@ class ReservationV4CommandControllerTest {
"field_overrides": [
{
"field_pointer": "/business_fields/room_items/0/room_type_code",
"value": "TWN"
"value": "RM2"
}
]
}
@@ -1255,7 +1255,7 @@ class ReservationV4CommandControllerTest {
.andExpect(status().isOk())
.andExpect(jsonPath("$.business_cards[0].card_status").value("CONFIRMED"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.business_fields.room_items[0].room_type_code")
.value("TWN"))
.value("RM2"))
.andExpect(jsonPath("$.business_cards[0].review_resolution.reason").value("修正房型目录"));
}
@@ -1277,7 +1277,7 @@ class ReservationV4CommandControllerTest {
"event_type":"NEW_BOOKING",
"arrival_date":"2026-08-01",
"departure_date":"2026-08-03",
"rate_code":"GROUP",
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"UNKNOWN_TYPE","room_count":2}]
}
}
@@ -1636,7 +1636,7 @@ class ReservationV4CommandControllerTest {
ArrayNode overrides = request.putArray("field_overrides");
ObjectNode override = overrides.addObject();
override.put("field_pointer", editableField.path("field_pointer").asText());
override.put("value", "TWN");
override.put("value", "RM2");
performAuthorized(mockMvc, adminToken(), post(
"/api/reservation/order-tasks/{orderTaskId}/cards/{cardId}/review-resolution",
@@ -1647,7 +1647,7 @@ class ReservationV4CommandControllerTest {
.andExpect(status().isOk())
.andExpect(jsonPath("$.business_cards[0].card_status").value("CONFIRMED"))
.andExpect(jsonPath("$.business_cards[0].confirmed_payload.room_information.final_values.room_items[0].room_type_code")
.value("TWN"));
.value("RM2"));
}
@Test
@@ -1736,8 +1736,8 @@ class ReservationV4CommandControllerTest {
"event_type":"NEW_BOOKING",
"arrival_date":"2026-08-01",
"departure_date":"2026-08-03",
"rate_code":"GROUP",
"room_items":[{"room_type_code":"TWN","room_count":2}]
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"RM2","room_count":2}]
}
}
""",
@@ -1810,7 +1810,7 @@ class ReservationV4CommandControllerTest {
"arrival_date":"2026-08-01",
"departure_date":"2026-08-03",
"rate_code":"FIT-RB",
"room_items":[{"room_type_code":"TWN","room_count":1}]
"room_items":[{"room_type_code":"RM2","room_count":1}]
}
}
""",
@@ -2448,10 +2448,10 @@ class ReservationV4CommandControllerTest {
"final_values": {
"arrival_date": "2026-07-26",
"departure_date": "2026-07-29",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"fit_name": "FIT Guest",
"breakfast_included": true,
"room_items": [{"room_type_code": "TWN", "room_count": 2}]%s
"room_items": [{"room_type_code": "RM2", "room_count": 2}]%s
}
}
}
@@ -2512,7 +2512,7 @@ class ReservationV4CommandControllerTest {
Instant receivedAt,
Long orderId) {
return seedOrderTaskWithBusinessCard(hotelId, externalMessageId, receivedAt, orderId, """
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"TWN","room_count":2}]}
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"RM2","room_count":2}]}
""");
}
@@ -2641,7 +2641,7 @@ class ReservationV4CommandControllerTest {
basicStatus,
businessStatus,
"""
{"event_type":"NEW_BOOKING","route_code":"S01","business_fields":{"order_ref":"ORDER-REVIEW","event_type":"NEW_BOOKING","manual_review":true,"room_items":[{"room_type_code":"TWN","room_count":2,"pms_room_type_code":null}]}}
{"event_type":"NEW_BOOKING","route_code":"S01","business_fields":{"order_ref":"ORDER-REVIEW","event_type":"NEW_BOOKING","manual_review":true,"room_items":[{"room_type_code":"RM2","room_count":2,"pms_room_type_code":null}]}}
""",
null);
}

View File

@@ -295,8 +295,8 @@ class ReservationV4QueryControllerTest {
"pms_raw_response":{"debug":"NESTED-SHOULD-NOT-LEAK"},
"arrival_date":"2026-07-26",
"departure_date":"2026-07-29",
"rate_code":"GROUP",
"room_items":[{"room_type_code":"TWN","room_count":2,"pms_room_type_code":"NESTED-PMS-SHOULD-NOT-LEAK","raw_evidence":"NESTED-ROOM-RAW"}]
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"RM2","room_count":2,"pms_room_type_code":"NESTED-PMS-SHOULD-NOT-LEAK","raw_evidence":"NESTED-ROOM-RAW"}]
}
}
""",
@@ -318,7 +318,7 @@ class ReservationV4QueryControllerTest {
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.nights")
.value(3))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.rate_code")
.value("GROUP"))
.value("GRPA2-850UP"))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.breakfast_included")
.value(true))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.group_booking_status")
@@ -371,10 +371,10 @@ class ReservationV4QueryControllerTest {
"arrival_date":"2026-07-26",
"departure_date":"2026-07-29",
"nights":3,
"rate_code":"GROUP",
"rate_code":"GRPA2-850UP",
"breakfast_included":true,
"group_booking_status":"TEN",
"room_items":[{"room_type_code":"TWN","room_count":2}]
"room_items":[{"room_type_code":"RM2","room_count":2}]
}
}
}
@@ -398,8 +398,8 @@ class ReservationV4QueryControllerTest {
"after":{
"arrival_date":"2026-07-27",
"departure_date":"2026-07-31",
"rate_code":"BAR",
"room_items":[{"room_type_code":"DBL","room_count":3}]
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"RM3","room_count":3}]
}
}
}
@@ -420,7 +420,7 @@ class ReservationV4QueryControllerTest {
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.nights")
.value(4))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.rate_code")
.value("GROUP"))
.value("GRPA2-850UP"))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.change_summary[?(@.field=='rate_code')]")
.doesNotExist())
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.change_summary[?(@.field=='nights')].before")
@@ -452,7 +452,7 @@ class ReservationV4QueryControllerTest {
"event_type":"NEW_BOOKING",
"arrival_date":"2026-08-01",
"departure_date":"2026-08-03",
"rate_code":"GROUP",
"rate_code":"GRPA2-850UP",
"room_items":[{"room_type_code":"UNKNOWN_TYPE","room_count":2}]
}
}
@@ -498,7 +498,7 @@ class ReservationV4QueryControllerTest {
ReservationV4CardStatus.PENDING_CONFIRM.name(),
ReservationV4CardStatus.PENDING_CONFIRM.name(),
"""
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"TWN","room_count":2}]}
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"RM2","room_count":2}]}
""",
null);
ReservationV4TaskCardSnapshot basicCard = workflowRepository.findTaskCardsByOrderTaskId(HOTEL_ID, orderTask.id())
@@ -819,7 +819,7 @@ class ReservationV4QueryControllerTest {
{
"item_type":"EXTRA_BED",
"content":"SHOULD-NOT-LEAK-EXTRA-BED-CONTENT",
"target_room_type_code":"TWN",
"target_room_type_code":"RM2",
"extra_bed_room_count":1,
"department_code":"FO+HSK",
"raw_evidence":"SHOULD-NOT-LEAK-RAW",
@@ -837,7 +837,7 @@ class ReservationV4QueryControllerTest {
.andExpect(jsonPath("$.business_cards[0].display_payload.trace_items[0].text")
.value("Guest requests quiet rooms."))
.andExpect(jsonPath("$.business_cards[0].display_payload.trace_items[1].target_room_type_code")
.value("TWN"))
.value("RM2"))
.andExpect(jsonPath("$.business_cards[0].display_payload.trace_items[1].extra_bed_room_count")
.value(1))
.andExpect(jsonPath("$.business_cards[0].display_payload.business_fields").doesNotExist())
@@ -875,10 +875,10 @@ class ReservationV4QueryControllerTest {
"arrival_date":"2026-08-01",
"departure_date":"2026-08-05",
"nights":4,
"rate_code":"GROUP",
"rate_code":"GRPA2-850UP",
"breakfast_included":true,
"group_booking_status":"DEF",
"room_items":[{"room_type_code":"KING","room_count":1}]
"room_items":[{"room_type_code":"RM3","room_count":1}]
}
}
}
@@ -910,7 +910,7 @@ class ReservationV4QueryControllerTest {
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.current_values.arrival_date")
.value("2026-08-01"))
.andExpect(jsonPath("$.business_cards[0].display_payload.room_information.final_values.room_items[0].room_type_code")
.value("KING"))
.value("RM3"))
.andExpect(jsonPath("$.business_cards[0].fields.length()").value(0))
.andExpect(jsonPath("$.business_cards[0].availability.confirmable").value(true));
}
@@ -1248,7 +1248,7 @@ class ReservationV4QueryControllerTest {
ReservationV4CardStatus.PENDING_CONFIRM.name(),
ReservationV4CardStatus.PENDING_CONFIRM.name(),
"""
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"TWN","room_count":2}]}
{"card_type":"ROOM_INFORMATION","event_type":"NEW_BOOKING","room_items":[{"room_type_code":"RM2","room_count":2}]}
""",
null);
}

View File

@@ -1314,7 +1314,7 @@ class SuperAgentTaskResultControllerTest {
void shouldMarkV4BusinessCardReviewRequiredWhenRoomTypeCodeUnknown() throws Exception {
SourceMessageCaptureResult source = captureSourceMessage("mail-v4-unknown-room-type-001");
String body = v4BusinessRootBody("mail-v4-unknown-room-type-001")
.replace("\"room_type_code\": \"TWN\"", "\"room_type_code\": \"UNKNOWN_ROOM\"")
.replace("\"room_type_code\": \"RM2\"", "\"room_type_code\": \"UNKNOWN_ROOM\"")
.replace("GRP-V4-001", "GRP-V4-UNKNOWN-ROOM-001");
mockMvc.perform(signedPost(body, "nonce-v4-unknown-room-type-001"))
@@ -1335,6 +1335,34 @@ class SuperAgentTaskResultControllerTest {
.contains("房型代码不在第一版目录中");
}
@Test
void shouldMarkV4BusinessCardReviewRequiredWhenLegacyCatalogCodesSubmitted() throws Exception {
SourceMessageCaptureResult source = captureSourceMessage("mail-v4-legacy-catalog-code-001");
String body = v4BusinessRootBody("mail-v4-legacy-catalog-code-001")
.replace("\"rate_code\": \"GRPA2-850UP\"", "\"rate_code\": \"BAR\"")
.replace("\"room_type_code\": \"RM2\"", "\"room_type_code\": \"TWN\"")
.replace("GRP-V4-001", "GRP-V4-LEGACY-CATALOG-001");
mockMvc.perform(signedPost(body, "nonce-v4-legacy-catalog-code-001"))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.accepted_count").value(2));
String roomValidationErrors = jdbcTemplate.queryForObject("""
SELECT validation_errors_json
FROM workflow_reservation_v4_task_card
WHERE source_message_id = ?
AND card_type = 'ROOM_INFORMATION'
AND card_status = 'REVIEW_REQUIRED'
AND review_status = 'PENDING'
LIMIT 1
""", String.class, source.inboxId());
assertThat(roomValidationErrors)
.contains("business_fields.rate_code")
.contains("Rate Code 不在第一版目录中")
.contains("business_fields.room_items.0.room_type_code")
.contains("房型代码不在第一版目录中");
}
@Test
void shouldMarkV4UpdateBookingReviewRequiredWhenNestedRoomTypeCodeUnknown() throws Exception {
SourceMessageCaptureResult source = captureSourceMessage("mail-v4-update-unknown-nested-room-001");
@@ -1419,7 +1447,7 @@ class SuperAgentTaskResultControllerTest {
.replace("GRP-V4-CTR-001", "GRP-V4-TRACE-INVALID-EXTRA-BED-COUNT-001")
.replace("\"item_type\": \"GENERAL\"", "\"item_type\": \"EXTRA_BED\"")
.replace("\"text\": \"Guest requests quiet rooms.\"", "\"text\": \"Please add one extra bed.\"")
.replace("\"department_code\": \"FO\"", "\"target_room_type_code\": \"TWN\",\n"
.replace("\"department_code\": \"FO\"", "\"target_room_type_code\": \"RM2\",\n"
+ " \"extra_bed_room_count\": 0,\n"
+ " \"department_code\": \"FO\"");
@@ -3993,11 +4021,11 @@ class SuperAgentTaskResultControllerTest {
},
"arrival_date": "2026-07-26",
"departure_date": "2026-07-29",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"booking_scenario": "STANDARD",
"room_items": [
{
"room_type_code": "TWN",
"room_type_code": "RM2",
"room_count": 2
}
],
@@ -4067,11 +4095,11 @@ class SuperAgentTaskResultControllerTest {
},
"arrival_date": "2026-08-01",
"departure_date": "2026-08-03",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"booking_scenario": "STANDARD",
"room_items": [
{
"room_type_code": "TWN",
"room_type_code": "RM2",
"room_count": 2
}
],
@@ -4087,12 +4115,12 @@ class SuperAgentTaskResultControllerTest {
},
"arrival_date": "2026-08-05",
"departure_date": "2026-08-06",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"booking_scenario": "STANDARD",
"guest_name": "TEST GUEST",
"room_items": [
{
"room_type_code": "KING",
"room_type_code": "RM3",
"room_count": 1
}
],
@@ -4137,12 +4165,12 @@ class SuperAgentTaskResultControllerTest {
},
"arrival_date": "2026-08-05",
"departure_date": "2026-08-06",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"booking_scenario": "STANDARD",
"guest_name": "BOOKING CODE GUEST",
"room_items": [
{
"room_type_code": "KING",
"room_type_code": "RM3",
"room_count": 1
}
],
@@ -4248,11 +4276,11 @@ class SuperAgentTaskResultControllerTest {
},
"arrival_date": "2026-08-01",
"departure_date": "2026-08-03",
"rate_code": "BAR",
"rate_code": "GRPA2-850UP",
"booking_scenario": "STANDARD",
"room_items": [
{
"room_type_code": "TWN",
"room_type_code": "RM2",
"room_count": 2
}
],
@@ -4538,7 +4566,7 @@ class SuperAgentTaskResultControllerTest {
},
"after": {
"arrival_date": "2026-08-01",
"rate_code": "BAR"
"rate_code": "GRPA2-850UP"
},
"manual_review": null
}