Skip to content

Commit

Permalink
feat: added end user creation skip for created entities in kyb
Browse files Browse the repository at this point in the history
  • Loading branch information
chesterkmr committed Feb 11, 2025
1 parent badfb02 commit 1cb204d
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ export class CollectionFlowController {

const directors = await Promise.all(
workflowRuntimeData.context.entity.data.additionalInfo.directors?.map(
async (director: { firstName: string; lastName: string; email: string }) => {
async (director: { id?: string; firstName: string; lastName: string; email: string }) => {
// If ID is present then entity been created in KYB
if (director.id) {
return {
ballerineEntityId: director.id,
...director,
};
}

const { id } = await this.endUserService.create({
data: {
firstName: director.firstName,
Expand All @@ -175,7 +183,15 @@ export class CollectionFlowController {

const ubos = await Promise.all(
workflowRuntimeData.context.entity.data.additionalInfo.ubos?.map(
async (ubo: { firstName: string; lastName: string; email: string }) => {
async (ubo: { id?: string; firstName: string; lastName: string; email: string }) => {
// If ID is present then entity been created in KYB
if (ubo.id) {
return {
ballerineEntityId: ubo.id,
...ubo,
};
}

const { id } = await this.endUserService.create({
data: {
firstName: ubo.firstName,
Expand Down

0 comments on commit 1cb204d

Please sign in to comment.