Skip to content

Commit

Permalink
Merge branch 'release/2023.12.05'
Browse files Browse the repository at this point in the history
  • Loading branch information
juliette-derancourt committed Dec 5, 2023
2 parents 74088ec + 02df5a3 commit ba7763c
Show file tree
Hide file tree
Showing 79 changed files with 223 additions and 1,171 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public ResponseEntity<TenantModel> honorDeclaration(@Validated(Dossier.class) @R
@PostMapping(value = "/documentIdentification", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.class) DocumentIdentificationForm documentIdentificationForm) {
Tenant tenant = authenticationFacade.getTenant(documentIdentificationForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationForm, StepRegister.DOCUMENT_IDENTIFICATION);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationForm, StepRegister.DOCUMENT_IDENTIFICATION);
Tenant loggedTenant = (documentIdentificationForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -113,8 +112,7 @@ public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.cla
@PostMapping(value = "/documentResidency", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TenantModel> documentResidency(@Validated(Dossier.class) DocumentResidencyForm documentResidencyForm) {
Tenant tenant = authenticationFacade.getTenant(documentResidencyForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentResidencyForm, StepRegister.DOCUMENT_RESIDENCY);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentResidencyForm, StepRegister.DOCUMENT_RESIDENCY);
Tenant loggedTenant = (documentResidencyForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -123,8 +121,7 @@ public ResponseEntity<TenantModel> documentResidency(@Validated(Dossier.class) D
@PostMapping(value = "/documentProfessional", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TenantModel> documentProfessional(@Validated(Dossier.class) DocumentProfessionalForm documentProfessionalForm) {
Tenant tenant = authenticationFacade.getTenant(documentProfessionalForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentProfessionalForm, StepRegister.DOCUMENT_PROFESSIONAL);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentProfessionalForm, StepRegister.DOCUMENT_PROFESSIONAL);
Tenant loggedTenant = (documentProfessionalForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -133,8 +130,7 @@ public ResponseEntity<TenantModel> documentProfessional(@Validated(Dossier.class
@PostMapping(value = "/documentFinancial", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TenantModel> documentFinancial(@Validated(Dossier.class) DocumentFinancialForm documentFinancialForm) {
Tenant tenant = authenticationFacade.getTenant(documentFinancialForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentFinancialForm, StepRegister.DOCUMENT_FINANCIAL);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentFinancialForm, StepRegister.DOCUMENT_FINANCIAL);
Tenant loggedTenant = (documentFinancialForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -143,8 +139,7 @@ public ResponseEntity<TenantModel> documentFinancial(@Validated(Dossier.class) D
@PostMapping(value = "/documentTax", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TenantModel> documentTax(@Validated(Dossier.class) DocumentTaxForm documentTaxForm) {
Tenant tenant = authenticationFacade.getTenant(documentTaxForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentTaxForm, StepRegister.DOCUMENT_TAX);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentTaxForm, StepRegister.DOCUMENT_TAX);
Tenant loggedTenant = (documentTaxForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public ResponseEntity<TenantModel> guarantorName(@Validated(Dossier.class) NameG
@PostMapping("/documentIdentification")
public ResponseEntity<TenantModel> documentIdentification(@Validated({Dossier.class, DocumentIdentificationGuarantor.class}) DocumentIdentificationGuarantorLegalPersonForm documentIdentificationGuarantorLegalPersonForm) {
Tenant tenant = authenticationFacade.getTenant(documentIdentificationGuarantorLegalPersonForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationGuarantorLegalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_LEGAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationGuarantorLegalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_LEGAL_PERSON);
Tenant loggedTenant = (documentIdentificationGuarantorLegalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -58,8 +57,7 @@ public ResponseEntity<TenantModel> documentIdentification(@Validated({Dossier.cl
@PostMapping("/documentRepresentantIdentification")
public ResponseEntity<TenantModel> documentIdentificationRepresentant(@Validated({Dossier.class, DocumentIdentificationGuarantor.class}) DocumentIdentificationRepresentanGuarantorLegalPersonForm documentIdentificationRepresentantGuarantorLegalPersonForm) {
Tenant tenant = authenticationFacade.getTenant(documentIdentificationRepresentantGuarantorLegalPersonForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationRepresentantGuarantorLegalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_REPRESENTANT_GUARANTOR_LEGAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationRepresentantGuarantorLegalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_REPRESENTANT_GUARANTOR_LEGAL_PERSON);
Tenant loggedTenant = (documentIdentificationRepresentantGuarantorLegalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public class RegisterGuarantorNaturalPersonController {
@PostMapping("/documentIdentification")
public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.class) DocumentIdentificationGuarantorNaturalPersonForm documentIdentificationGuarantorNaturalPersonForm) {
var tenant = authenticationFacade.getTenant(documentIdentificationGuarantorNaturalPersonForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationGuarantorNaturalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_NATURAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationGuarantorNaturalPersonForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_NATURAL_PERSON);
Tenant loggedTenant = (documentIdentificationGuarantorNaturalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -50,8 +49,7 @@ public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.cla
@PostMapping("/documentIdentification/v2")
public ResponseEntity<TenantModel> documentIdentificationFile(@Validated(Dossier.class) DocumentIdentificationGuarantorNaturalPersonFileForm documentIdentificationGuarantorNaturalPersonFileForm) {
var tenant = authenticationFacade.getTenant(documentIdentificationGuarantorNaturalPersonFileForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationGuarantorNaturalPersonFileForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_NATURAL_PERSON_FILE);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationGuarantorNaturalPersonFileForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_NATURAL_PERSON_FILE);
Tenant loggedTenant = (documentIdentificationGuarantorNaturalPersonFileForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -70,8 +68,7 @@ public ResponseEntity<TenantModel> guarantorName(NameGuarantorNaturalPersonForm
@PostMapping("/documentResidency")
public ResponseEntity<TenantModel> documentResidency(@Validated(Dossier.class) DocumentResidencyGuarantorNaturalPersonForm documentResidencyGuarantorNaturalPersonForm) {
Tenant tenant = authenticationFacade.getTenant(documentResidencyGuarantorNaturalPersonForm.getTenantId());
TenantModel tenantModel = tenantService.saveStepRegister(tenant, documentResidencyGuarantorNaturalPersonForm, StepRegister.DOCUMENT_RESIDENCY_GUARANTOR_NATURAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentResidencyGuarantorNaturalPersonForm, StepRegister.DOCUMENT_RESIDENCY_GUARANTOR_NATURAL_PERSON);
Tenant loggedTenant = (documentResidencyGuarantorNaturalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -80,8 +77,7 @@ public ResponseEntity<TenantModel> documentResidency(@Validated(Dossier.class) D
@PostMapping("/documentProfessional")
public ResponseEntity<TenantModel> documentProfessional(@Validated(Dossier.class) DocumentProfessionalGuarantorNaturalPersonForm documentProfessionalGuarantorNaturalPersonForm) {
var tenant = authenticationFacade.getTenant(documentProfessionalGuarantorNaturalPersonForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentProfessionalGuarantorNaturalPersonForm, StepRegister.DOCUMENT_PROFESSIONAL_GUARANTOR_NATURAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentProfessionalGuarantorNaturalPersonForm, StepRegister.DOCUMENT_PROFESSIONAL_GUARANTOR_NATURAL_PERSON);
Tenant loggedTenant = (documentProfessionalGuarantorNaturalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -90,8 +86,7 @@ public ResponseEntity<TenantModel> documentProfessional(@Validated(Dossier.class
@PostMapping("/documentFinancial")
public ResponseEntity<TenantModel> documentFinancial(@Validated(Dossier.class) DocumentFinancialGuarantorNaturalPersonForm documentFinancialGuarantorNaturalPersonForm) {
var tenant = authenticationFacade.getTenant(documentFinancialGuarantorNaturalPersonForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentFinancialGuarantorNaturalPersonForm, StepRegister.DOCUMENT_FINANCIAL_GUARANTOR_NATURAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentFinancialGuarantorNaturalPersonForm, StepRegister.DOCUMENT_FINANCIAL_GUARANTOR_NATURAL_PERSON);
Tenant loggedTenant = (documentFinancialGuarantorNaturalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand All @@ -100,8 +95,7 @@ public ResponseEntity<TenantModel> documentFinancial(@Validated(Dossier.class) D
@PostMapping("/documentTax")
public ResponseEntity<TenantModel> documentTax(@Validated(Dossier.class) DocumentTaxGuarantorNaturalPersonForm documentTaxGuarantorNaturalPersonForm) {
var tenant = authenticationFacade.getTenant(documentTaxGuarantorNaturalPersonForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentTaxGuarantorNaturalPersonForm, StepRegister.DOCUMENT_TAX_GUARANTOR_NATURAL_PERSON);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentTaxGuarantorNaturalPersonForm, StepRegister.DOCUMENT_TAX_GUARANTOR_NATURAL_PERSON);
Tenant loggedTenant = (documentTaxGuarantorNaturalPersonForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import fr.dossierfacile.api.front.service.interfaces.TenantService;
import fr.dossierfacile.api.front.validator.group.Dossier;
import fr.dossierfacile.common.entity.Tenant;
import fr.dossierfacile.common.enums.LogType;
import fr.dossierfacile.common.service.interfaces.LogService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -28,14 +26,12 @@ public class RegisterGuarantorOrganismController {
private final TenantService tenantService;
private final TenantMapper tenantMapper;
private final AuthenticationFacade authenticationFacade;
private final LogService logService;

@PreAuthorize("hasPermissionOnTenant(#documentIdentificationGuarantorOrganismForm.tenantId)")
@PostMapping("/documentIdentification")
public ResponseEntity<TenantModel> documentIdentification(@Validated(Dossier.class) DocumentIdentificationGuarantorOrganismForm documentIdentificationGuarantorOrganismForm) {
var tenant = authenticationFacade.getTenant(documentIdentificationGuarantorOrganismForm.getTenantId());
var tenantModel = tenantService.saveStepRegister(tenant, documentIdentificationGuarantorOrganismForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_ORGANISM);
logService.saveLog(LogType.ACCOUNT_EDITED, tenantModel.getId());
tenantService.saveStepRegister(tenant, documentIdentificationGuarantorOrganismForm, StepRegister.DOCUMENT_IDENTIFICATION_GUARANTOR_ORGANISM);
Tenant loggedTenant = (documentIdentificationGuarantorOrganismForm.getTenantId() == null) ? tenant : authenticationFacade.getLoggedTenant();
return ok(tenantMapper.toTenantModel(loggedTenant));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import fr.dossierfacile.api.front.security.interfaces.AuthenticationFacade;
import fr.dossierfacile.api.front.service.interfaces.TenantService;
import fr.dossierfacile.api.front.service.interfaces.UserService;
import fr.dossierfacile.api.front.util.SentryUtil;
import fr.dossierfacile.common.entity.Tenant;
import io.sentry.SentryLevel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -38,7 +36,7 @@ public ResponseEntity<ConnectedTenantModel> profilePartner() {
String partner = authenticationFacade.getKeycloakClientId();
Tenant tenant = tenantService.findByKeycloakId(authenticationFacade.getKeycloakUserId());
if (tenant == null) {
log.error(SentryUtil.captureMessage("User try to connect with not found keycloakId " + authenticationFacade.getUserEmail(), SentryLevel.ERROR));
log.error("User try to connect with not found keycloakId " + authenticationFacade.getUserEmail());
tenant = tenantService.findByEmail(authenticationFacade.getUserEmail()).orElse(null);
}

Expand Down

This file was deleted.

Loading

0 comments on commit ba7763c

Please sign in to comment.