|
|
@@ -77,8 +77,6 @@ class AlipayBatchPayServiceTest {
|
|
|
EnterpriseEntity ent = new EnterpriseEntity();
|
|
|
ent.setEnterpriseId("E100");
|
|
|
lenient().when(enterpriseMapper.selectByEnterpriseIdIgnoreTenant("E100")).thenReturn(ent);
|
|
|
- // 反馈轮 5: 制单预检 — 默认该付款方已有 AUTHED 授权记录(无授权用例单独 stub 0)
|
|
|
- lenient().when(batchAuthorizeMapper.selectCount(any())).thenReturn(1L);
|
|
|
// 初始化 MyBatis-Plus lambda 元数据缓存,使 LambdaQueryWrapper.getSqlSegment() 可在无 Spring 上下文的单测中工作
|
|
|
MybatisConfiguration configuration = new MybatisConfiguration();
|
|
|
TableInfoHelper.initTableInfo(new MapperBuilderAssistant(configuration, ""), BatchOrderEntity.class);
|
|
|
@@ -183,12 +181,16 @@ class AlipayBatchPayServiceTest {
|
|
|
resp.setBatchTransId("BT1");
|
|
|
resp.setStatus("INIT");
|
|
|
when(alipayClient.certificateExecute(any(AlipayFundBatchCreateRequest.class))).thenReturn(resp);
|
|
|
+ // 制单预检: 已有 AUTHED 授权(协议号由系统自动带出,不接受客户端指定)
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("AUTHED");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
dto.setOutBatchNo("B1");
|
|
|
dto.setOrderTitle("202608报销");
|
|
|
- dto.setAgreementNo("AGMT001");
|
|
|
dto.setTransferSceneName("佣金报酬");
|
|
|
dto.setTransferSceneReportInfos(List.of(Map.of("info_type", "佣金报酬说明", "info_content", "8月家政服务报酬")));
|
|
|
BatchCreateDTO.BatchDetailDTO detail = new BatchCreateDTO.BatchDetailDTO();
|
|
|
@@ -265,6 +267,10 @@ class AlipayBatchPayServiceTest {
|
|
|
existing.setBatchTransId("BT1");
|
|
|
existing.setStatus("INIT");
|
|
|
when(batchOrderMapper.selectOne(any())).thenReturn(existing);
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("AUTHED");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
@@ -413,6 +419,11 @@ class AlipayBatchPayServiceTest {
|
|
|
resp.setSubCode("AUTH_INFO_NOT_EXISTS");
|
|
|
resp.setMsg("Business Failed");
|
|
|
when(alipayClient.certificateExecute(any(AlipayFundBatchCreateRequest.class))).thenReturn(resp);
|
|
|
+ // 本地预检通过(有 AUTHED 记录)后仍触发支付宝侧 AUTH_INFO_NOT_EXISTS 兜底路径
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("AUTHED");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
@@ -895,6 +906,10 @@ class AlipayBatchPayServiceTest {
|
|
|
AlipayFundBatchCreateResponse resp = new AlipayFundBatchCreateResponse();
|
|
|
resp.setOutBatchNo("B1");
|
|
|
when(alipayClient.certificateExecute(any(AlipayFundBatchCreateRequest.class))).thenReturn(resp);
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("AUTHED");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
@@ -924,7 +939,7 @@ class AlipayBatchPayServiceTest {
|
|
|
@Test
|
|
|
void batchCreate_notAuthorized_throws() throws AlipayApiException {
|
|
|
// 反馈轮 5: 未完成授权不允许制单 — 该付款方无 AUTHED 授权记录 → 本地预检拦截,不调支付宝
|
|
|
- when(batchAuthorizeMapper.selectCount(any())).thenReturn(0L);
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(null);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
@@ -953,6 +968,10 @@ class AlipayBatchPayServiceTest {
|
|
|
AlipayFundBatchCreateResponse resp = new AlipayFundBatchCreateResponse();
|
|
|
resp.setOutBatchNo("B1");
|
|
|
when(alipayClient.certificateExecute(any(AlipayFundBatchCreateRequest.class))).thenReturn(resp);
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("NORMAL");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|
|
|
@@ -983,6 +1002,10 @@ class AlipayBatchPayServiceTest {
|
|
|
AlipayFundBatchCreateResponse resp = new AlipayFundBatchCreateResponse();
|
|
|
resp.setOutBatchNo("B1");
|
|
|
when(alipayClient.certificateExecute(any(AlipayFundBatchCreateRequest.class))).thenReturn(resp);
|
|
|
+ BatchAuthorizeEntity authed = new BatchAuthorizeEntity();
|
|
|
+ authed.setStatus("AUTHED");
|
|
|
+ authed.setAgreementNo("AGMT001");
|
|
|
+ when(batchAuthorizeMapper.selectOne(any())).thenReturn(authed);
|
|
|
|
|
|
BatchCreateDTO dto = new BatchCreateDTO();
|
|
|
dto.setEnterpriseId("E100");
|