Skip to content

Commit

Permalink
chore: removed deprecated - internalPartnerId and endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien authored and fabiengo committed Dec 9, 2024
1 parent 873a387 commit d6bdf1c
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import fr.dossierfacile.api.front.model.tenant.TenantModel;
import fr.dossierfacile.api.front.register.enums.StepRegister;
import fr.dossierfacile.api.front.register.form.guarantor.organism.DocumentGuaranteeProviderCertificateForm;
import fr.dossierfacile.api.front.register.form.guarantor.organism.DocumentIdentificationGuarantorOrganismForm;
import fr.dossierfacile.api.front.security.interfaces.AuthenticationFacade;
import fr.dossierfacile.api.front.service.interfaces.TenantService;
import fr.dossierfacile.api.front.validator.group.Dossier;
Expand All @@ -29,16 +28,6 @@ public class RegisterGuarantorOrganismController {
private final TenantMapper tenantMapper;
private final AuthenticationFacade authenticationFacade;

@PreAuthorize("hasPermissionOnTenant(#documentIdentificationGuarantorOrganismForm.tenantId)")
@PostMapping("/documentIdentification")
@Deprecated
public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.class) DocumentIdentificationGuarantorOrganismForm documentIdentificationGuarantorOrganismForm) {
var tenant = authenticationFacade.getTenant(documentIdentificationGuarantorOrganismForm.getTenantId());
tenantService.saveStepRegister(tenant, documentIdentificationGuarantorOrganismForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_ORGANISM);
Tenant loggedTenant = (documentIdentificationGuarantorOrganismForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant, null));
}

@PreAuthorize("hasPermissionOnTenant(#form.tenantId)")
@PostMapping("/documentCertificate")
public ResponseEntity<TenantModel> documentCertificate(@Validated(Dossier.class) DocumentGuaranteeProviderCertificateForm form) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import fr.dossierfacile.api.front.model.tenant.TenantModel;
import fr.dossierfacile.api.front.register.enums.StepRegister;
import fr.dossierfacile.api.front.register.form.guarantor.organism.DocumentGuaranteeProviderCertificateForm;
import fr.dossierfacile.api.front.register.form.guarantor.organism.DocumentIdentificationGuarantorOrganismForm;
import fr.dossierfacile.api.front.service.interfaces.TenantService;
import fr.dossierfacile.api.front.validator.group.ApiPartner;
import fr.dossierfacile.api.front.validator.group.DocumentIdentificationGuarantor;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,15 +23,6 @@ public class ApiPartnerRegisterGuarantorOrganismController {

private final TenantService tenantService;

@PreAuthorize("hasPermissionOnTenant(#documentIdentificationGuarantorOrganismForm.tenantId)")
@PostMapping("/documentIdentification")
@Deprecated
public ResponseEntity<TenantModel> documentIdentification(@Validated({ApiPartner.class, DocumentIdentificationGuarantor.class}) DocumentIdentificationGuarantorOrganismForm documentIdentificationGuarantorOrganismForm) {
var tenant = tenantService.findById(documentIdentificationGuarantorOrganismForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationGuarantorOrganismForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_ORGANISM);
return ok(tenantModel);
}

@PreAuthorize("hasPermissionOnTenant(#form.tenantId)")
@PostMapping("/documentCertificate")
public ResponseEntity<TenantModel> documentCertificate(@Validated({ApiPartner.class}) DocumentGuaranteeProviderCertificateForm form) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import fr.dossierfacile.api.front.register.guarantor.natural_person.DocumentTaxGuarantorNaturalPerson;
import fr.dossierfacile.api.front.register.guarantor.natural_person.NameGuarantorNaturalPerson;
import fr.dossierfacile.api.front.register.guarantor.organism.DocumentGuaranteeProviderCertificate;
import fr.dossierfacile.api.front.register.guarantor.organism.DocumentIdentificationGuarantorOrganism;
import fr.dossierfacile.api.front.register.tenant.AccountApiPartner;
import fr.dossierfacile.api.front.register.tenant.Application;
import fr.dossierfacile.api.front.register.tenant.DocumentFinancial;
Expand Down Expand Up @@ -43,7 +42,6 @@ public enum StepRegister {
DOCUMENT_PROFESSIONAL_GUARANTOR_NATURAL_PERSON(DocumentProfessionalGuarantorNaturalPerson.class),
DOCUMENT_FINANCIAL_GUARANTOR_NATURAL_PERSON(DocumentFinancialGuarantorNaturalPerson.class),
DOCUMENT_TAX_GUARANTOR_NATURAL_PERSON(DocumentTaxGuarantorNaturalPerson.class),
DOCUMENT_IDENTIFICATION_GUARANTOR_ORGANISM(DocumentIdentificationGuarantorOrganism.class),
DOCUMENT_GUARANTEE_PROVIDER_CERTIFICATE(DocumentGuaranteeProviderCertificate.class),
DOCUMENT_IDENTIFICATION_GUARANTOR_LEGAL_PERSON(DocumentIdentificationGuarantorLegalPerson.class),
DOCUMENT_IDENTIFICATION_REPRESENTANT_GUARANTOR_LEGAL_PERSON(DocumentIdentificationRepresentanGuarantorLegalPerson.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
public class DocumentResidencyGuarantorNaturalPersonForm extends DocumentGuarantorFormAbstract {

@NotNull
@DocumentSubcategorySubset(anyOf =
{TENANT, OWNER, GUEST, GUEST_PARENTS, GUEST_ORGANISM, SHORT_TERM_RENTAL, OTHER_RESIDENCY}, groups = ApiVersion.V3.class)
@DocumentSubcategorySubset(anyOf =
{TENANT, OWNER, GUEST, GUEST_COMPANY, GUEST_ORGANISM, SHORT_TERM_RENTAL, OTHER_RESIDENCY}, groups = ApiVersion.V4.class)
private DocumentSubCategory typeDocumentResidency;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ public class AccountPartnerForm {
@UniqueEmailActiveAccount
@JsonDeserialize(using = EmailDeserializer.class)
private String email;

private String internalPartnerId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
public class DocumentResidencyForm extends DocumentForm {

@NotNull
@DocumentSubcategorySubset(anyOf =
{TENANT, OWNER, GUEST, GUEST_PARENTS, GUEST_ORGANISM, SHORT_TERM_RENTAL, OTHER_RESIDENCY}, groups = ApiVersion.V3.class)
@DocumentSubcategorySubset(anyOf =
{TENANT, OWNER, GUEST, GUEST_COMPANY, GUEST_ORGANISM, SHORT_TERM_RENTAL, OTHER_RESIDENCY}, groups = ApiVersion.V4.class)
private DocumentSubCategory typeDocumentResidency;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public TenantModel saveStep(Tenant t, AccountPartnerForm accountForm) {
String email = accountForm.getEmail().toLowerCase();
Tenant tenant = findDisabledTenantOrCreateTenant(email);
UserApi userApi = clientAuthenticationFacade.getClient();
partnerCallBackService.registerTenant(accountForm.getInternalPartnerId(), tenant, userApi);
partnerCallBackService.registerTenant(tenant, userApi);

mailService.sendEmailWelcomeForPartnerUser(tenantMapperForMail.toDto(tenant), userApiMapperForMail.toDto(userApi));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ private void createCoTenants(Tenant tenantCreate, List<CoTenantForm> tenants, Ap

if (apartmentSharing.getApplicationType() == ApplicationType.COUPLE) {
if (!CollectionUtils.isEmpty(tenantCreate.getTenantsUserApi())) {
tenantCreate.getTenantsUserApi().stream()
tenantCreate.getTenantsUserApi()
.forEach(tenantUserApi -> {
partnerCallBackService.registerTenant(null, joinTenant, tenantUserApi.getUserApi());
partnerCallBackService.registerTenant(joinTenant, tenantUserApi.getUserApi());
});
}
}
Expand All @@ -206,7 +206,7 @@ private void createCoTenants(Tenant tenantCreate, List<CoTenantForm> tenants, Ap
// Relating all the clients related to tenant CREATE to tenant JOIN
Optional.ofNullable(tenantCreate.getTenantsUserApi())
.orElse(new ArrayList<>())
.forEach(tenantUserApi -> partnerCallBackService.registerTenant(null, joinTenant, tenantUserApi.getUserApi()));
.forEach(tenantUserApi -> partnerCallBackService.registerTenant(joinTenant, tenantUserApi.getUserApi()));

logService.saveLog(LogType.ACCOUNT_CREATED, joinTenant.getId());
return joinTenant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public Tenant registerFromKeycloakUser(KeycloakUser kcUser, String partner, Acqu
}
if (partner != null) {
userApiService.findByName(partner)
.ifPresent(userApi -> partnerCallBackService.registerTenant(null, tenant, userApi));
.ifPresent(userApi -> partnerCallBackService.registerTenant(tenant, userApi));
}

tenant.lastUpdateDateProfile(LocalDateTime.now(), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ public void linkTenantToPartner(Tenant tenant, String partner, String internalPa
.ifPresent(userApi -> {
if (tenant.getApartmentSharing().getApplicationType() == ApplicationType.COUPLE) {
tenant.getApartmentSharing().getTenants()
.stream()
.forEach(t -> partnerCallBackService.registerTenant(
(tenant.getId() == t.getId()) ? internalPartnerId : null, t, userApi));
.forEach(t -> partnerCallBackService.registerTenant(t, userApi));
} else {
partnerCallBackService.registerTenant(internalPartnerId, tenant, userApi);
partnerCallBackService.registerTenant(tenant, userApi);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fr.gouv.bo.configuration;

import fr.dossierfacile.common.config.ApiVersion;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
Expand All @@ -15,7 +14,7 @@ public class MessageSourceConfig {
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasenames(ApiVersion.V3.is(apiVersion) ? "messages_v3" : "messages");
messageSource.setBasenames("messages");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
}
Expand Down
Loading

0 comments on commit d6bdf1c

Please sign in to comment.