This commit is contained in:
2026-08-04 14:15:55 +08:00
parent 694425690c
commit cd540f9b3e
6 changed files with 19 additions and 16 deletions
@@ -134,7 +134,7 @@ class TenantServiceTest {
}
@Test
void explicitSubmissionRequiresAllPrototypeQualificationsAndCreatesReview() {
void explicitSubmissionRequiresOnlyBusinessLicenseAndLegalPersonIdAndCreatesReview() {
TenantRepository repository = mock(TenantRepository.class);
ProfileResourceRepository profileRepository = mock(ProfileResourceRepository.class);
TenantService service = new TenantService();
@@ -143,8 +143,7 @@ class TenantServiceTest {
IamTenant tenant = merchant(10001L, "PROFILE_REQUIRED");
when(repository.findTenantForUpdate(10001L)).thenReturn(tenant);
when(profileRepository.findQualifications(10001L)).thenReturn(List.of(
qualification("BUSINESS_LICENSE"), qualification("LEGAL_PERSON_ID"),
qualification("FREIGHT_FORWARDER_CERTIFICATE"), qualification("BANK_ACCOUNT_LICENSE")));
qualification("BUSINESS_LICENSE"), qualification("LEGAL_PERSON_ID")));
var submitted = service.submitMerchantReview(10001L);
@@ -162,7 +161,7 @@ class TenantServiceTest {
ReflectionTestUtils.setField(service, "profileRepository", profileRepository);
when(repository.findTenantForUpdate(10001L)).thenReturn(merchant(10001L, "PROFILE_REQUIRED"));
when(profileRepository.findQualifications(10001L)).thenReturn(List.of(
qualification("BUSINESS_LICENSE"), qualification("LEGAL_PERSON_ID")));
qualification("BUSINESS_LICENSE")));
BizException exception = assertThrows(BizException.class, () -> service.submitMerchantReview(10001L));
@@ -205,8 +204,7 @@ class TenantServiceTest {
when(repository.findReviewForUpdate(71L)).thenReturn(review);
when(repository.findTenant(10001L)).thenReturn(tenant);
when(profileRepository.findQualifications(10001L)).thenReturn(List.of(
qualification("BUSINESS_LICENSE"), qualification("LEGAL_PERSON_ID"),
qualification("FREIGHT_FORWARDER_CERTIFICATE"), qualification("BANK_ACCOUNT_LICENSE")));
qualification("BUSINESS_LICENSE"), qualification("LEGAL_PERSON_ID")));
when(provisioning.initialize(any())).thenReturn(
TenantAdministratorProvisioningService.ProvisioningResult.created(
81L, "merchant_10001", "Password1234"));
@@ -285,7 +283,7 @@ class TenantServiceTest {
}
@Test
void 企业激活不等于具备下单资格仍需四类资质全部审核通过() {
void 企业激活后仅需两类必填资质审核通过即可下单() {
TenantRepository repository = mock(TenantRepository.class);
ProfileResourceRepository profileRepository = mock(ProfileResourceRepository.class);
TenantService service = new TenantService();
@@ -295,8 +293,7 @@ class TenantServiceTest {
when(profileRepository.findQualifications(10001L)).thenReturn(
List.of(approvedQualification("BUSINESS_LICENSE")),
List.of(approvedQualification("BUSINESS_LICENSE"), approvedQualification("LEGAL_PERSON_ID"),
approvedQualification("FREIGHT_FORWARDER_CERTIFICATE"),
approvedQualification("BANK_ACCOUNT_LICENSE")));
rejectedQualification("FREIGHT_FORWARDER_CERTIFICATE")));
var withoutQualification = service.orderEligibility(10001L);
var withQualification = service.orderEligibility(10001L);
@@ -332,6 +329,12 @@ class TenantServiceTest {
return item;
}
private IamTenantQualification rejectedQualification(String type) {
IamTenantQualification item = qualification(type);
item.setStatus("REJECTED");
return item;
}
private IamTenantReview review(long id, long tenantId) {
IamTenantReview review = new IamTenantReview();
review.setId(id); review.setTenantId(tenantId); review.setStatus("PENDING");