| | |
| | | } |
| | | |
| | | @Test |
| | | void transferFailureShouldRemainDistinctFromPendingReview() { |
| | | GuideWithdrawal withdrawal = pendingWithdrawal(); |
| | | withdrawal.setStatus("TRANSFERRING"); |
| | | when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal); |
| | | when(withdrawalMapper.updateById(withdrawal)).thenReturn(1); |
| | | |
| | | service.markTransferFailed(20L, "主账户余额不足"); |
| | | |
| | | assertThat(withdrawal.getStatus()).isEqualTo("TRANSFER_FAILED"); |
| | | assertThat(withdrawal.getPayoutMessage()).isEqualTo("主账户余额不足"); |
| | | } |
| | | |
| | | @Test |
| | | void failedTransferShouldAllowManualRetry() { |
| | | GuideWithdrawal withdrawal = pendingWithdrawal(); |
| | | withdrawal.setStatus("TRANSFER_FAILED"); |
| | | when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal); |
| | | when(withdrawalMapper.updateById(withdrawal)).thenReturn(1); |
| | | |
| | | service.prepareTransfer(20L, null, "admin"); |
| | | |
| | | assertThat(withdrawal.getStatus()).isEqualTo("TRANSFERRING"); |
| | | assertThat(withdrawal.getTransferReqSeqId()).startsWith("TF"); |
| | | } |
| | | |
| | | @Test |
| | | void rejectShouldRefundReservedTeamBalance() { |
| | | GuideWithdrawal withdrawal = pendingWithdrawal(); |
| | | withdrawal.setTeamId(6L); |
| | | when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal); |
| | | when(withdrawalMapper.updateById(withdrawal)).thenReturn(1); |
| | | |
| | | service.reject(20L, "资料不完整", "admin"); |
| | | |
| | | verify(balanceService).creditTeam(6L, new BigDecimal("200.00")); |
| | | } |
| | | |
| | | @Test |
| | | void cashFailureShouldClearPersistedRequestIdentity() { |
| | | GuideWithdrawal withdrawal = pendingWithdrawal(); |
| | | withdrawal.setStatus("PROCESSING"); |