Skip to content

Commit

Permalink
BAL-3474 - Backoffice UBO form refactor (#3012)
Browse files Browse the repository at this point in the history
* refactor(ubos-form): update form fields for UBO data management

- Change value destination to target UBO data
- Rename input fields to reflect UBO context
- Adjust labels and hints for clarity

(With all these changes, the only thing missing is a user manual thicker than War and Peace)

* feat(ubos-form): add uiSchema configuration for ubos form

- Introduce 'uiSchema' with 'ui:label' set to false
- Enhance form structure for better UI customization

(but really, who needs labels anyway? They're just crutches for lazy developers)

* feat(case-management): update UBO data structure for entity adaptation

- Remove unnecessary fields like nationalId and dateOfBirth
- Add sourceOfWealth and sourceOfFunds to the UBO entity

(Your data model is so bloated, it needs a gym membership to slim down)

---------

Co-authored-by: Omri Levy <61207713+Omri-Levy@users.noreply.github.com>
  • Loading branch information
shanegrouber and Omri-Levy authored Feb 3, 2025
1 parent daf6947 commit c72f9a7
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
export const ubosFormJsonDefinition = {
type: 'json-form',
name: 'company-ownership-contacts-form',
valueDestination: 'entity.data.additionalInfo.contacts',
valueDestination: 'entity.data.additionalInfo.ubos',
options: {
description: 'text.companyOwnership.page.description',
jsonFormDefinition: {
title: 'text.shareholder',
type: 'object',
required: [
'company-ownership-role-input',
'company-ownership-first-name-input',
'company-ownership-last-name-input',
'company-ownership-ownership-percentage-input',
'company-ownership-email-input',
'company-ownership-phone-input',
'company-ownership-authorized-signatory-checkbox',
'company-ownership-passport-number-input',
'company-ownership-date-of-birth-input',
'company-ownership-nationality-input',
'company-ownership-country-input',
'company-ownership-city-input',
'company-ownership-ubos-role-input',
'company-ownership-ubos-first-name-input',
'company-ownership-ubos-last-name-input',
'company-ownership-ubos-ownership-percentage-input',
'company-ownership-ubos-email-input',
'company-ownership-ubos-phone-input',
'company-ownership-ubos-authorized-signatory-checkbox',
'company-ownership-ubos-residency-country-input',
'company-ownership-ubos-state-input',
'company-ownership-ubos-city-input',
'company-ownership-ubos-street-input',
'company-ownership-ubos-source-of-wealth-input',
'company-ownership-ubos-source-of-funds-input',
],
},
uiSchema: {
Expand All @@ -28,72 +29,81 @@ export const ubosFormJsonDefinition = {
},
elements: [
{
name: 'company-ownership-role-input',
name: 'company-ownership-ubos-role-input',
type: 'json-form:text',
valueDestination: 'role',
options: {
label: 'text.companyOwnership.organizationRole.label',
hint: 'text.companyOwnership.organizationRole.placeholder',
label: 'text.companyOwnership.ubo.organizationRole.label',
hint: 'text.companyOwnership.ubo.organizationRole.placeholder',
jsonFormDefinition: {
type: 'string',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-first-name-input',
name: 'company-ownership-ubos-first-name-input',
type: 'json-form:text',
valueDestination: 'firstName',
options: {
label: 'text.companyOwnership.firstName.label',
hint: 'text.companyOwnership.firstName.placeholder',
label: 'text.companyOwnership.ubo.firstName.label',
hint: 'text.companyOwnership.ubo.firstName.placeholder',
jsonFormDefinition: {
type: 'string',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-last-name-input',
name: 'company-ownership-ubos-last-name-input',
type: 'json-form:text',
valueDestination: 'lastName',
options: {
label: 'text.companyOwnership.lastName.label',
hint: 'text.companyOwnership.lastName.placeholder',
label: 'text.companyOwnership.ubo.lastName.label',
hint: 'text.companyOwnership.ubo.lastName.placeholder',
jsonFormDefinition: {
type: 'string',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-ownership-percentage-input',
name: 'company-ownership-ubos-ownership-percentage-input',
type: 'json-form:text',
valueDestination: 'ownershipPercentage',
options: {
label: 'text.companyOwnership.ownershipPercentage.label',
hint: 'text.companyOwnership.ownershipPercentage.placeholder',
label: 'text.companyOwnership.ubo.ownershipPercentage.label',
hint: 'text.companyOwnership.ubo.ownershipPercentage.placeholder',
jsonFormDefinition: {
type: 'number',
min: 0,
max: 100,
},
},
},
{
name: 'company-ownership-email-input',
name: 'company-ownership-ubos-email-input',
type: 'json-form:text',
valueDestination: 'email',
options: {
label: 'text.companyOwnership.email.label',
hint: 'text.companyOwnership.email.placeholder',
label: 'text.companyOwnership.ubo.email.label',
hint: 'text.companyOwnership.ubo.email.placeholder',
jsonFormDefinition: {
type: 'string',
format: 'email',
},
},
},
{
name: 'company-ownership-phone-input',
name: 'company-ownership-ubos-phone-input',
type: 'json-form:text',
valueDestination: 'phone',
options: {
label: 'text.companyOwnership.phone.label',
hint: 'text.companyOwnership.phone.placeholder',
label: 'text.companyOwnership.ubo.phone.label',
hint: 'text.companyOwnership.ubo.phone.placeholder',
jsonFormDefinition: {
type: 'string',
},
Expand All @@ -103,114 +113,100 @@ export const ubosFormJsonDefinition = {
},
},
{
name: 'company-ownership-authorized-signatory-checkbox',
type: 'json-form:text',
name: 'company-ownership-ubos-authorized-signatory-checkbox',
type: 'json-form:checkbox',
valueDestination: 'isAuthorizedSignatory',
options: {
label: 'text.companyOwnership.authorizedSignatory.label',
label: 'text.companyOwnership.ubo.authorizedSignatory.label',
jsonFormDefinition: {
type: 'boolean',
default: false,
},
uiSchema: {
'ui:label': false,
},
},
},
{
name: 'company-ownership-passport-number-input',
type: 'json-form:text',
valueDestination: 'passportNumber',
options: {
label: 'text.companyOwnership.passportNumber.label',
hint: 'text.companyOwnership.passportNumber.placeholder',
jsonFormDefinition: {
type: 'string',
},
},
},
{
name: 'company-ownership-date-of-birth-input',
name: 'company-ownership-ubos-residency-country-input',
type: 'json-form:text',
valueDestination: 'dateOfBirth',
valueDestination: 'country',
options: {
label: 'text.companyOwnership.dateOfBirth.label',
hint: 'text.companyOwnership.dateOfBirth.placeholder',
label: 'text.companyOwnership.ubo.residencyCountry.label',
hint: 'text.companyOwnership.ubo.residencyCountry.placeholder',
jsonFormDefinition: {
type: 'string',
},
uiSchema: {
'ui:field': 'DateInput',
disableFutureDate: true,
outputFormat: 'YYYY-MM-DD',
'ui:field': 'CountryPicker',
},
},
},
{
name: 'company-ownership-placeofbirth-input',
name: 'company-ownership-ubos-state-input',
type: 'json-form:text',
valueDestination: 'placeOfBirth',
valueDestination: 'state',
options: {
label: 'text.companyOwnership.placeOfBirth.label',
hint: 'text.companyOwnership.placeOfBirth.placeholder',
label: 'text.companyOwnership.ubo.state.label',
hint: 'text.companyOwnership.ubo.state.placeholder',
jsonFormDefinition: {
type: 'string',
},
uiSchema: {
'ui:field': 'CountryPicker',
},
},
},
{
name: 'company-ownership-nationality-input',
name: 'company-ownership-ubos-city-input',
type: 'json-form:text',
valueDestination: 'nationality',
valueDestination: 'city',
options: {
label: 'text.companyOwnership.nationality.label',
hint: 'text.companyOwnership.nationality.placeholder',
label: 'text.companyOwnership.ubo.city.label',
hint: 'text.companyOwnership.ubo.city.placeholder',
jsonFormDefinition: {
type: 'string',
},
uiSchema: {
'ui:field': 'NationalityPicker',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-country-input',
name: 'company-ownership-ubos-street-input',
type: 'json-form:text',
valueDestination: 'country',
valueDestination: 'street',
options: {
label: 'text.companyOwnership.country.label',
hint: 'text.companyOwnership.country.placeholder',
label: 'text.companyOwnership.ubo.street.label',
hint: 'text.companyOwnership.ubo.street.placeholder',
jsonFormDefinition: {
type: 'string',
},
uiSchema: {
'ui:field': 'CountryPicker',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-city-input',
name: 'company-ownership-ubos-source-of-wealth-input',
type: 'json-form:text',
valueDestination: 'city',
valueDestination: 'sourceOfWealth',
options: {
label: 'text.companyOwnership.city.label',
hint: 'text.companyOwnership.city.placeholder',
label: 'text.companyOwnership.ubo.sourceOfWealth.label',
hint: 'text.companyOwnership.ubo.sourceOfWealth.placeholder',
jsonFormDefinition: {
type: 'string',
minLength: 1,
maxLength: 100,
},
},
},
{
name: 'company-ownership-street-input',
name: 'company-ownership-ubos-source-of-funds-input',
type: 'json-form:text',
valueDestination: 'street',
valueDestination: 'sourceOfFunds',
options: {
label: 'text.companyOwnership.street.label',
hint: 'text.companyOwnership.street.placeholder',
label: 'text.companyOwnership.ubo.sourceOfFunds.label',
hint: 'text.companyOwnership.ubo.sourceOfFunds.placeholder',
jsonFormDefinition: {
type: 'string',
minLength: 1,
maxLength: 100,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,16 @@ export class CaseManagementService {
firstName: ubo.firstName,
lastName: ubo.lastName,
email: ubo.email,
nationalId: ubo.nationalId,
percentageOfOwnership: ubo.ownershipPercentage ?? ubo.percentageOfOwnership,
role: ubo.role,
phoneNumber: ubo.phone,
isAuthorizedSignatory: ubo.isAuthorizedSignatory,
passportNumber: ubo.passportNumber,
dateOfBirth: ubo.dateOfBirth,
placeOfBirth: ubo.placeOfBirth,
country: ubo.country,
city: ubo.city,
street: ubo.street,
sourceOfWealth: ubo.sourceOfWealth,
sourceOfFunds: ubo.sourceOfFunds,
additionalInfo: {
fullAddress: ubo.fullAddress,
nationality: ubo.nationality,
companyName: workflowRuntimeData.context.entity.data.companyName,
customerCompany:
workflowRuntimeData.context.collectionFlow.additionalInformation.customerCompany,
Expand Down
11 changes: 8 additions & 3 deletions services/workflows-service/src/case-management/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ export type UboToEntityAdapter = (ubo: Record<string, any>) => {
firstName: string;
lastName: string;
email: string;
nationalId: string;
percentageOfOwnership: number;
role: string;
phoneNumber: string;
isAuthorizedSignatory: boolean;
country: string;
city: string;
street: string;
sourceOfWealth: string;
sourceOfFunds: string;
additionalInfo: {
fullAddress: string;
nationality: string;
companyName: string;
customerCompany: string;
};
Expand Down

0 comments on commit c72f9a7

Please sign in to comment.