From f3a7f1a1b77b9e51bfa7f5cf3958e995fe9d9102 Mon Sep 17 00:00:00 2001
From: Fadil Zemmari <fadil.zemmari@xelians.fr>
Date: Tue, 22 Sep 2020 17:53:09 +0200
Subject: [PATCH] [US TRTL-113] Remove address type from owner

---
 .../internal/server/owner/converter/OwnerConverter.java   | 3 ---
 .../vitamui/iam/internal/server/owner/domain/Owner.java   | 4 ----
 .../server/owner/service/OwnerInternalService.java        | 5 -----
 .../java/fr/gouv/vitamui/commons/api/domain/OwnerDto.java | 4 ----
 .../src/app/modules/models/customer/owner.interface.ts    | 2 --
 .../identity/src/app/core/customer.service.spec.ts        | 1 -
 .../customer-create/customer-create.component.html        | 2 +-
 .../customer-create/customer-create.component.spec.ts     | 3 +++
 .../customer-list/customer-list.component.spec.ts         | 1 -
 .../customer/customer-list/customer-list.service.spec.ts  | 8 --------
 .../customer-list/owner-list/owner-list.component.spec.ts | 3 +--
 .../graphic-identity-tab.component.spec.ts                | 2 --
 .../graphic-identity-update.component.spec.ts             | 3 ++-
 .../src/app/customer/customer-resolver.service.spec.ts    | 3 ++-
 .../customer/owner-create/owner-create.component.spec.ts  | 3 +--
 .../src/app/customer/owner-form/owner-form.component.html | 4 ++--
 .../app/customer/owner-form/owner-form.component.spec.ts  | 7 +++----
 .../src/app/customer/owner-form/owner-form.component.ts   | 4 ++--
 .../src/app/customer/owner-resolver.service.spec.ts       | 3 +--
 .../identity/src/app/customer/owner.service.spec.ts       | 3 +--
 .../identity/src/app/customer/tenant.service.spec.ts      | 3 +--
 .../user-information-tab.component.spec.ts                | 2 --
 22 files changed, 20 insertions(+), 53 deletions(-)

diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/converter/OwnerConverter.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/converter/OwnerConverter.java
index 0bd0c1a8..fc72fbf0 100644
--- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/converter/OwnerConverter.java
+++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/converter/OwnerConverter.java
@@ -56,8 +56,6 @@ public class OwnerConverter implements Converter<OwnerDto, Owner> {
 
     public static final String COMPANY_NAME_KEY = "Raison sociale";
 
-    public static final String ADDRESS_TYPE_KEY = "Type d'adresse";
-
     public static final String INTERNAL_CODE_KEY = "Code interne";
 
     private final AddressConverter addressConverter;
@@ -72,7 +70,6 @@ public class OwnerConverter implements Converter<OwnerDto, Owner> {
         ownerLogbookData.put(CODE_KEY, LogbookUtils.getValue(owner.getCode()));
         ownerLogbookData.put(NAME_KEY, LogbookUtils.getValue(owner.getName()));
         ownerLogbookData.put(COMPANY_NAME_KEY, LogbookUtils.getValue(owner.getCompanyName()));
-        ownerLogbookData.put(ADDRESS_TYPE_KEY, LogbookUtils.getValue(owner.getAddressType()));
         ownerLogbookData.put(INTERNAL_CODE_KEY, LogbookUtils.getValue(owner.getInternalCode()));
         AddressDto address = owner.getAddress() != null ? owner.getAddress() : new AddressDto();
         addressConverter.addAddress(address, ownerLogbookData);
diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/domain/Owner.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/domain/Owner.java
index 9c6c00fd..79b677cd 100644
--- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/domain/Owner.java
+++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/domain/Owner.java
@@ -38,7 +38,6 @@ package fr.gouv.vitamui.iam.internal.server.owner.domain;
 
 import javax.validation.constraints.NotNull;
 
-import fr.gouv.vitamui.commons.api.enums.AddressType;
 import org.hibernate.validator.constraints.Length;
 import org.springframework.data.annotation.TypeAlias;
 import org.springframework.data.mongodb.core.index.Indexed;
@@ -86,8 +85,5 @@ public class Owner extends CustomerIdDocument {
 
     private String internalCode;
 
-    @NotNull
-    private AddressType addressType;
-
     private boolean readonly;
 }
diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/service/OwnerInternalService.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/service/OwnerInternalService.java
index 85f1c1f7..a23e5e20 100644
--- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/service/OwnerInternalService.java
+++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/owner/service/OwnerInternalService.java
@@ -44,7 +44,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 
-import fr.gouv.vitamui.commons.api.enums.AddressType;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -215,10 +214,6 @@ public class OwnerInternalService extends VitamUICrudService<OwnerDto, Owner> {
                     logbooks.add(new EventDiffDto(OwnerConverter.COMPANY_NAME_KEY, owner.getCompanyName(), entry.getValue()));
                     owner.setCompanyName(CastUtils.toString(entry.getValue()));
                     break;
-                case "addressType" :
-                    logbooks.add(new EventDiffDto(OwnerConverter.ADDRESS_TYPE_KEY, owner.getAddressType(), entry.getValue()));
-                    owner.setAddressType((AddressType) entry.getValue());
-                    break;
                 case "internalCode" :
                     logbooks.add(new EventDiffDto(OwnerConverter.INTERNAL_CODE_KEY, owner.getInternalCode(), entry.getValue()));
                     owner.setInternalCode(CastUtils.toString(entry.getValue()));
diff --git a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/domain/OwnerDto.java b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/domain/OwnerDto.java
index 6089a8f9..c5436955 100644
--- a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/domain/OwnerDto.java
+++ b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/domain/OwnerDto.java
@@ -38,7 +38,6 @@ package fr.gouv.vitamui.commons.api.domain;
 
 import javax.validation.constraints.NotNull;
 
-import fr.gouv.vitamui.commons.api.enums.AddressType;
 import org.hibernate.validator.constraints.Length;
 
 import lombok.EqualsAndHashCode;
@@ -73,9 +72,6 @@ public class OwnerDto extends CustomerIdDto {
 
     private String internalCode;
 
-    @NotNull
-    private AddressType addressType;
-
     private boolean readonly;
 
     // no validations for identifier. Because during the creation step, the identifier is set by the backend.
diff --git a/ui/ui-frontend-common/src/app/modules/models/customer/owner.interface.ts b/ui/ui-frontend-common/src/app/modules/models/customer/owner.interface.ts
index bd0f7f14..871f685f 100644
--- a/ui/ui-frontend-common/src/app/modules/models/customer/owner.interface.ts
+++ b/ui/ui-frontend-common/src/app/modules/models/customer/owner.interface.ts
@@ -35,7 +35,6 @@
  * knowledge of the CeCILL-C license and that you accept its terms.
  */
 import { Id } from '../id.interface';
-import { AddressType } from './address-type.enum';
 import { Address } from './address.interface';
 
 export interface Owner extends Id {
@@ -45,7 +44,6 @@ export interface Owner extends Id {
   companyName: string;
   address: Address;
   internalCode?: string;
-  addressType: AddressType;
   customerId: string;
   readonly: boolean;
 }
diff --git a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts
index 614d521b..a7d29330 100644
--- a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts
@@ -186,7 +186,6 @@ const expectedCustomer: Customer = {
     code: '666666',
     name: 'Alice Vans',
     companyName: 'Vans',
-    addressType: AddressType.POSTAL,
     address: {
       street: 'street2',
       zipCode: '43121',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html
index 1efe4678..060f9ec8 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html
@@ -258,7 +258,7 @@
         <h2 i18n="Create evidence owner title@@customerCreateTitle3">Création du propriétaire des éléments de preuve
         </h2>
         <div class="form-group">
-          <app-owner-form [formControl]="form.get(['owners', 0])" [customerInfo]="customerInfo"></app-owner-form>
+          <app-owner-form [formControl]="form.get(['owners', 0])" [customerInfo]="customerInfo" [addressType]="form.get('addressType').value"></app-owner-form>
           <p class="hint" i18n="the evidence tenant is automatically created with the owner@@customerCreateHint">Le
             coffre des éléments de preuve est créé automatiquement avec son propriétaire</p>
         </div>
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts
index 5dc2481b..a7d9b1a9 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts
@@ -35,6 +35,7 @@
  * knowledge of the CeCILL-C license and that you accept its terms.
  */
 import { EMPTY, of } from 'rxjs';
+import { AddressType } from 'ui-frontend-common';
 import { ConfirmDialogService, OtpState } from 'ui-frontend-common';
 import { VitamUICommonTestModule } from 'ui-frontend-common/testing';
 
@@ -99,12 +100,14 @@ const expectedCustomer = {
   hasCustomGraphicIdentity: false,
   passwordRevocationDelay: 3,
   otp: OtpState.OPTIONAL,
+  addressType: AddressType.POSTAL,
   address: {
     street: 'street',
     zipCode: '12345',
     city: 'New York',
     country: 'US',
   },
+  internalCode: '1',
   language: 'en',
   emailDomains: ['test.com', 'toto.co.uk'],
   defaultEmailDomain: 'test.com',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts
index 2811763e..6a679bda 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts
@@ -367,7 +367,6 @@ describe('CustomerListComponent', () => {
       customerId: customers[0].id,
       name: 'Toto',
       companyName: 'Toto & Co',
-      addressType: AddressType.POSTAL,
       address: {
         street: null,
         zipCode: null,
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts
index 425dbd15..4dac747a 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts
@@ -69,7 +69,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu
           name: 'Emmanuel Deviller',
           code: '002345',
           companyName: 'vitamui',
-          addressType: AddressType.POSTAL,
           address: {
             street: '73 rue du Faubourg Poissonnière ',
             zipCode: '75009',
@@ -85,7 +84,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu
           name: 'Julien Cornille',
           code: '002345',
           companyName: 'vitamui',
-          addressType: AddressType.POSTAL,
           address: {
             street: '73 rue du Faubourg Poissonnière ',
             zipCode: '75009',
@@ -128,7 +126,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu
           name: 'Mr Président',
           code: '022345',
           companyName: 'Electricité de france',
-          addressType: AddressType.POSTAL,
           address: {
             street: '22-30 Avenue de WAGRAM',
             zipCode: '75008',
@@ -144,7 +141,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu
           name: 'Jean Dupond',
           code: '025000',
           companyName: 'Electricité de france',
-           addressType: AddressType.POSTAL,
           address: {
             street: '22-30 Avenue de WAGRAM',
             zipCode: '75008',
@@ -195,7 +191,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha
           name: 'Emmanuel Deviller',
           code: '002345',
           companyName: 'vitamui',
-          addressType: AddressType.POSTAL,
           address: {
             street: '73 rue du Faubourg Poissonnière ',
             zipCode: '75009',
@@ -211,7 +206,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha
           name: 'Julien Cornille',
           code: '002345',
           companyName: 'vitamui',
-          addressType: AddressType.POSTAL,
           address: {
             street: '73 rue du Faubourg Poissonnière ',
             zipCode: '75009',
@@ -254,7 +248,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha
           name: 'Mr Président',
           code: '022345',
           companyName: 'Electricité de france',
-          addressType: AddressType.POSTAL,
           address: {
             street: '22-30 Avenue de WAGRAM',
             zipCode: '75008',
@@ -270,7 +263,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha
           name: 'Jean Dupond',
           code: '025000',
           companyName: 'Electricité de france',
-          addressType: AddressType.POSTAL,
           address: {
             street: '22-30 Avenue de WAGRAM',
             zipCode: '75008',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.spec.ts
index e61c59a8..3e455787 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/owner-list/owner-list.component.spec.ts
@@ -42,7 +42,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
 import { Router } from '@angular/router';
 import { of ,  Subject } from 'rxjs';
 
-import { AddressType, OtpState, Owner, Tenant } from 'ui-frontend-common';
+import { OtpState, Owner, Tenant } from 'ui-frontend-common';
 import { extend } from 'underscore';
 import { CustomerDataService } from '../../customer.data.service';
 import { OwnerCreateComponent } from '../../owner-create/owner-create.component';
@@ -265,7 +265,6 @@ describe('OwnerListComponent', () => {
       customerId: testhost.customer.id,
       name: 'Toto',
       companyName: 'Toto & Co',
-      addressType: AddressType.POSTAL,
       address: {
         street: null,
         zipCode: null,
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts
index d188fe12..ffd21301 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts
@@ -75,7 +75,6 @@ let expectedCustomer: Customer = {
     code: '254791',
     name: 'owner name',
     companyName: 'company name',
-    addressType: AddressType.POSTAL,
     address: {
       street: '85 rue des bois',
       zipCode: '75013',
@@ -138,7 +137,6 @@ describe('GraphicIdentityTabComponent', () => {
         code: '254791',
         name: 'owner name',
         companyName: 'company name',
-        addressType: AddressType.POSTAL,
         address: {
           street: '85 rue des bois',
           zipCode: '75013',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts
index 3e24ed5e..ce075c4d 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts
@@ -40,7 +40,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
 import { ReactiveFormsModule } from '@angular/forms';
 import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import { ENVIRONMENT } from 'ui-frontend-common';
+import { AddressType, ENVIRONMENT } from 'ui-frontend-common';
 import { BASE_URL, Customer, InjectorModule, LoggerModule, OtpState } from 'ui-frontend-common';
 import { VitamUICommonTestModule } from 'ui-frontend-common/testing';
 import { environment } from './../../../../../environments/environment';
@@ -61,6 +61,7 @@ const expectedCustomer: Customer = {
   passwordRevocationDelay: 6,
   otp: OtpState.DEACTIVATED,
   idp: true,
+  addressType: AddressType.POSTAL,
   address: {
     street: '85 rue des bois',
     zipCode: '75013',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts
index 52ebeee6..05cc3927 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts
@@ -40,7 +40,7 @@ import { inject, TestBed } from '@angular/core/testing';
 import { ActivatedRouteSnapshot, Router } from '@angular/router';
 import { of } from 'rxjs';
 
-import { Customer, OtpState } from 'ui-frontend-common';
+import { AddressType, Customer, OtpState } from 'ui-frontend-common';
 import { CustomerService } from '../core/customer.service';
 import { CustomerResolver } from './customer-resolver.service';
 
@@ -61,6 +61,7 @@ const expectedCustomer: Customer = {
     'kouygues.com',
   ],
   defaultEmailDomain: 'kouygues.com',
+  addressType: AddressType.POSTAL,
   address: {
     street: '13 rue faubourg',
     zipCode: '75009',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts
index 126f037b..369bf8ca 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-create/owner-create.component.spec.ts
@@ -35,7 +35,7 @@
  * knowledge of the CeCILL-C license and that you accept its terms.
  */
 import { EMPTY, of } from 'rxjs';
-import { AddressType, ConfirmDialogService, Owner } from 'ui-frontend-common';
+import { ConfirmDialogService, Owner } from 'ui-frontend-common';
 import { VitamUICommonTestModule } from 'ui-frontend-common/testing';
 
 /* tslint:disable:max-classes-per-file directive-selector */
@@ -82,7 +82,6 @@ describe('OwnerCreateComponent', () => {
       name: 'Mr Président',
       code: '02234512',
       companyName: 'Electricité de france',
-      addressType: AddressType.POSTAL,
       address: {
         street: '22-30 Avenue de WAGRAM',
         zipCode: '75008',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html
index 62756a5f..1d401e73 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html
@@ -17,12 +17,12 @@
     </vitamui-common-input>
   </div>
 
-  <div *ngIf="form.get('addressType').value === ADDRESS_TYPE.INTERNAL_CODE">
+  <div *ngIf="addressType === ADDRESS_TYPE.INTERNAL_CODE">
     <vitamui-common-input class="field-street" formControlName="internalCode" maxlength="20" placeholder="Code interne"
     i18n-placeholder="Internal code@@OwnerInternalCodePlaceholder"></vitamui-common-input>
   </div>
 
-  <ng-container formGroupName="address" *ngIf="form.get('addressType').value === ADDRESS_TYPE.POSTAL">
+  <ng-container formGroupName="address" *ngIf="addressType === ADDRESS_TYPE.POSTAL">
     <div>
       <vitamui-common-input class="field-street" formControlName="street" maxlength="250" placeholder="N° et nom de la rue" i18n-placeholder="Owner street input placeholder@@ownerFormStreetInputPlaceholder"></vitamui-common-input>
     </div>
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts
index 6c7dd2d9..33727e20 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.spec.ts
@@ -44,7 +44,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
 import { of ,  timer } from 'rxjs';
 import { map } from 'rxjs/operators';
 
-import { AddressType, Owner } from 'ui-frontend-common';
+import { Owner } from 'ui-frontend-common';
 import { VitamUICommonTestModule } from 'ui-frontend-common/testing';
 import { OwnerService } from '../owner.service';
 import { OwnerFormComponent } from './owner-form.component';
@@ -106,13 +106,13 @@ describe('OwnerFormComponent', () => {
       code: '43214345345',
       name: 'Toto',
       companyName: 'Toto & Co.',
-      addressType: AddressType.POSTAL,
       address: {
         street: 'Street name',
         zipCode: '2134',
         city: 'Paris',
         country: 'FR'
       },
+      internalCode: null,
       readonly : false
     };
 
@@ -135,7 +135,6 @@ describe('OwnerFormComponent', () => {
       code: 'invalid-code',
       name: 'Toto',
       companyName: 'Toto & Co.',
-      addressType: AddressType.POSTAL,
       address: {
         street: 'Street name',
         zipCode: '2134',
@@ -169,13 +168,13 @@ describe('OwnerFormComponent', () => {
       code: '43214345345',
       name: 'Toto',
       companyName: 'Toto & Co.',
-      addressType: AddressType.POSTAL,
       address: {
         street: 'Street name',
         zipCode: '2134',
         city: 'Paris',
         country: 'FR'
       },
+      internalCode: null,
       readonly : false
     };
 
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts
index 2c5185a9..6ec1c7af 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts
@@ -58,6 +58,8 @@ export const OWNER_FORM_VALUE_ACCESSOR: any = {
 })
 export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnInit {
 
+  @Input() addressType: AddressType;
+
   form: FormGroup;
 
   private sub: any;
@@ -113,7 +115,6 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn
       name: [null, Validators.required],
       companyName: [null, Validators.required],
       internalCode: [null],
-      addressType: [this.customerInfo.addressType],
       address: this.formBuilder.group({
         street: null,
         zipCode: null,
@@ -141,7 +142,6 @@ export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnIn
       name: null,
       companyName: null,
       internalCode: null,
-      addressType: this.customerInfo.addressType,
       address: {
         street: null,
         zipCode: null,
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts
index 9036dafb..a960aec1 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-resolver.service.spec.ts
@@ -39,7 +39,7 @@ import { inject, TestBed } from '@angular/core/testing';
 import { ActivatedRouteSnapshot, Router } from '@angular/router';
 import { of } from 'rxjs';
 
-import { AddressType, Owner } from 'ui-frontend-common';
+import { Owner } from 'ui-frontend-common';
 import { OwnerResolver } from './owner-resolver.service';
 import { OwnerService } from './owner.service';
 
@@ -50,7 +50,6 @@ const expectedOwner: Owner = {
   name: 'Julien Cornille',
   code: '10234665',
   companyName: 'vitamui',
-  addressType: AddressType.POSTAL,
   address: {
     street: '73 rue du Faubourg Poissonnière ',
     zipCode: '75009',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts
index edde01f4..0d2a3407 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/owner.service.spec.ts
@@ -39,7 +39,7 @@ import { inject, TestBed } from '@angular/core/testing';
 import { NoopAnimationsModule } from '@angular/platform-browser/animations';
 
 import { Type } from '@angular/core';
-import { AddressType, BASE_URL, Owner } from 'ui-frontend-common';
+import { BASE_URL, Owner } from 'ui-frontend-common';
 import { VitamUISnackBar, VitamUISnackBarComponent } from '../shared/vitamui-snack-bar';
 import { OwnerService } from './owner.service';
 
@@ -50,7 +50,6 @@ const expectedOwner: Owner = {
   name: 'Julien Cornille',
   code: '10234665',
   companyName: 'vitamui',
-  addressType: AddressType.POSTAL,
   address: {
     street: '73 rue du Faubourg Poissonnière ',
     zipCode: '75009',
diff --git a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts
index 84f03c1a..ce10ba65 100644
--- a/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/customer/tenant.service.spec.ts
@@ -34,7 +34,7 @@
  * The fact that you are presently reading this means that you have had
  * knowledge of the CeCILL-C license and that you accept its terms.
  */
-import { AddressType, BASE_URL, Operators, Owner, SearchQuery, Tenant } from 'ui-frontend-common';
+import { BASE_URL, Operators, Owner, SearchQuery, Tenant } from 'ui-frontend-common';
 
 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
 import { inject, TestBed } from '@angular/core/testing';
@@ -66,7 +66,6 @@ const expectedOwner: Owner = {
   code: '10234501',
   companyName: 'vitamui',
   readonly: false,
-  addressType: AddressType.POSTAL,
   address: {
     street: '73 rue du Faubourg Poissonnière ',
     zipCode: '75009',
diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts
index 27ff5195..2e6c470c 100644
--- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts
+++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts
@@ -108,7 +108,6 @@ let expectedCustomer: Customer = {
     code: '254791',
     name: 'owner name',
     companyName: 'company name',
-    addressType: AddressType.POSTAL,
     address: {
       street: '85 rue des bois',
       zipCode: '75013',
@@ -218,7 +217,6 @@ describe('UserInfoTabComponent', () => {
         code: '254791',
         name: 'owner name',
         companyName: 'company name',
-        addressType: AddressType.POSTAL,
         address: {
           street: '85 rue des bois',
           zipCode: '75013',
-- 
GitLab