liujie
2026-09-15 ad491191ab50a259da548863d805c57d8a95d083
backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalPayoutServiceTest.java
@@ -114,6 +114,42 @@
    }
    @Test
    void cashQueryShouldApproveWhenProviderReturnsCashStatus() {
        GuideWithdrawal processing = withdrawal("PROCESSING");
        processing.setCashReqSeqId("CW001");
        processing.setCashReqDate("20260818");
        when(stateService.find(20L)).thenReturn(processing);
        when(settlementService.requireApprovedCard(8L, 10)).thenReturn(account());
        JSONObject queryResponse = new JSONObject();
        queryResponse.put("resp_code", "00000000");
        queryResponse.put("cash_status", "S");
        when(withdrawBiz.query("HF100", "20260818", "CW001")).thenReturn(queryResponse);
        service.advance(20L);
        verify(stateService).markApproved(20L, null);
    }
    @Test
    void cashQueryShouldUseSavedHuiFuSequence() {
        GuideWithdrawal processing = withdrawal("PROCESSING");
        processing.setCashReqSeqId("CW001");
        processing.setCashReqDate("20260818");
        processing.setCashHfSeqId("HF-CASH-1");
        when(stateService.find(20L)).thenReturn(processing);
        when(settlementService.requireApprovedCard(8L, 10)).thenReturn(account());
        JSONObject queryResponse = new JSONObject();
        queryResponse.put("trans_stat", "S");
        when(withdrawBiz.query("HF100", "20260818", "CW001", "HF-CASH-1"))
                .thenReturn(queryResponse);
        service.advance(20L);
        verify(withdrawBiz).query("HF100", "20260818", "CW001", "HF-CASH-1");
        verify(stateService).markApproved(20L, null);
    }
    @Test
    void cashQueryBusinessErrorShouldRemainProcessing() {
        GuideWithdrawal processing = withdrawal("PROCESSING");
        processing.setCashReqSeqId("CW001");