优化
This commit is contained in:
@@ -72,4 +72,26 @@ class MerchantQualificationUploadTest {
|
||||
assertEquals("91310101ABCDE12345", tenant.getUnifiedSocialCreditCode());
|
||||
verify(tenantRepository).saveTenant(tenant);
|
||||
}
|
||||
|
||||
@Test
|
||||
void businessLicenseCannotOverwriteAnEstablishedCreditCode() {
|
||||
TenantRepository tenantRepository = mock(TenantRepository.class);
|
||||
ProfileResourceRepository profileRepository = mock(ProfileResourceRepository.class);
|
||||
ProfileResourceService service = new ProfileResourceService();
|
||||
ReflectionTestUtils.setField(service, "tenantRepository", tenantRepository);
|
||||
ReflectionTestUtils.setField(service, "repository", profileRepository);
|
||||
IamTenant tenant = new IamTenant();
|
||||
tenant.setId(10001L);
|
||||
tenant.setTenantType("MERCHANT");
|
||||
tenant.setStatus("REJECTED");
|
||||
tenant.setUnifiedSocialCreditCode("91330100EXAMPLE001");
|
||||
when(tenantRepository.findTenantForUpdate(10001L)).thenReturn(tenant);
|
||||
|
||||
assertThrows(BizException.class, () -> service.submitQualification(new QualificationSubmissionRequest(
|
||||
10001L, "BUSINESS_LICENSE", "91310101ABCDE12345",
|
||||
"/api/merchant/v1/files/qualifications/license.png", null, true)));
|
||||
|
||||
verify(profileRepository, never()).insertQualification(any());
|
||||
verify(tenantRepository, never()).saveTenant(tenant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,21 @@ class TenantServiceTest {
|
||||
verify(repository, never()).insertReview(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void platformRegistrationAllowsCreditCodeToBeCompletedWithQualificationsLater() {
|
||||
TenantRepository repository = mock(TenantRepository.class);
|
||||
TenantService service = new TenantService();
|
||||
ReflectionTestUtils.setField(service, "repository", repository);
|
||||
|
||||
var created = service.register(new RegisterRequest(
|
||||
"Example Merchant", "Example Merchant Ltd", "Bob", null, "Alice", "13800138000",
|
||||
"alice@example.com", "基础版", null, null, 30, null,
|
||||
null, null, "CNY", null, null), 9001L);
|
||||
|
||||
assertEquals(null, created.unifiedSocialCreditCode());
|
||||
verify(repository).insertTenant(argThat(tenant -> tenant.getUnifiedSocialCreditCode() == null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void explicitSubmissionRequiresOnlyBusinessLicenseAndLegalPersonIdAndCreatesReview() {
|
||||
TenantRepository repository = mock(TenantRepository.class);
|
||||
|
||||
Reference in New Issue
Block a user