From 0952830b6e699e7577632a77e5b20cd43a00f911 Mon Sep 17 00:00:00 2001 From: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:59:32 +0530 Subject: [PATCH] merge: develop to qa (17-07-2024) (#833) * fix: create organisation changes and added geo-location attribute in response Signed-off-by: Ganesh Nawle * fix: send email verification issue (#823) Signed-off-by: bhavanakarwade * refactor: bulk issuance template list response changes (#824) * refactor: updated schema response for get API Signed-off-by: tipusinghaw * fix: schema already exist logic Signed-off-by: tipusinghaw * fix: schema attribute while w3c schema creation Signed-off-by: tipusinghaw --------- Signed-off-by: tipusinghaw * feat: batch bulk issunace (#826) * feat: batch bulk issuance Signed-off-by: tipusinghaw * stoped queue to remove issuance data Signed-off-by: tipusinghaw * feat: added delay for 1 min Signed-off-by: tipusinghaw * refactor: changed batch config Signed-off-by: tipusinghaw * feat: changed delay time for batch Signed-off-by: tipusinghaw * feat: added batch for retry Signed-off-by: tipusinghaw * refactor: added common constant in libs Signed-off-by: tipusinghaw * refactor: removed duplicate value from schema DTO Signed-off-by: tipusinghaw --------- Signed-off-by: tipusinghaw * fix: constant issue for bulk issunace (#827) * feat: batch bulk issuance Signed-off-by: tipusinghaw * stoped queue to remove issuance data Signed-off-by: tipusinghaw * feat: added delay for 1 min Signed-off-by: tipusinghaw * refactor: changed batch config Signed-off-by: tipusinghaw * feat: changed delay time for batch Signed-off-by: tipusinghaw * feat: added batch for retry Signed-off-by: tipusinghaw * refactor: added common constant in libs Signed-off-by: tipusinghaw * refactor: removed duplicate value from schema DTO Signed-off-by: tipusinghaw * fix: constent issue Signed-off-by: tipusinghaw --------- Signed-off-by: tipusinghaw * refactor: schema endorsement flow (#828) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fix: delete organization bugs (#829) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * feature:added schema details in file_upload data and fix minor changes Signed-off-by: Ganesh Nawle * feature:added schema details in file_upload data,fix minor exception changes and resovle PR conflict Signed-off-by: Ganesh Nawle * feat: added schema details in table Signed-off-by: Ganesh Nawle * refactor: endorsement flow for key and web method (#831) * refactor: endorsement flow for key and web method Signed-off-by: bhavanakarwade * refactor: send email for issuance Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fix: prisma model issue and refactored file_upload model Signed-off-by: Ganesh Nawle * fix: prisma migration issue Signed-off-by: Ganesh Nawle * fix: prisma migration issue (#835) Signed-off-by: Ganesh Nawle * fix: prisma migration issue Signed-off-by: Ganesh Nawle * fix: parameter and response related bugs (#837) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade * fix: cred def id space fixes Signed-off-by: bhavanakarwade * fix: create organization bug Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fix:rollback statistics changes Signed-off-by: Ganesh Nawle * Fix/bugs (#839) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade * fix: cred def id space fixes Signed-off-by: bhavanakarwade * fix: create organization bug Signed-off-by: bhavanakarwade * fix: pagination issue for preview file Signed-off-by: bhavanakarwade * fix: pagination issue Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fix: imageurl issue for verification process (#840) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade * fix: cred def id space fixes Signed-off-by: bhavanakarwade * fix: create organization bug Signed-off-by: bhavanakarwade * fix: pagination issue for preview file Signed-off-by: bhavanakarwade * fix: pagination issue Signed-off-by: bhavanakarwade * fix: imageurl issue in verification Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fix: made reuqest Id parameter optional (#841) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade * fix: cred def id space fixes Signed-off-by: bhavanakarwade * fix: create organization bug Signed-off-by: bhavanakarwade * fix: pagination issue for preview file Signed-off-by: bhavanakarwade * fix: pagination issue Signed-off-by: bhavanakarwade * fix: imageurl issue in verification Signed-off-by: bhavanakarwade * fix: made request if parameter optional Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * refactor: added temaplateId column in file_upload table (#842) * fix: send email verification issue Signed-off-by: bhavanakarwade * refcator: schema endorsement flow Signed-off-by: bhavanakarwade * fix: resolved sonar lint issues Signed-off-by: bhavanakarwade * fix: worked on sonarcloud issues Signed-off-by: bhavanakarwade * fix: delete organization bugs Signed-off-by: bhavanakarwade * fix: cred def id space fixes Signed-off-by: bhavanakarwade * fix: create organization bug Signed-off-by: bhavanakarwade * fix: pagination issue for preview file Signed-off-by: bhavanakarwade * fix: pagination issue Signed-off-by: bhavanakarwade * fix: imageurl issue in verification Signed-off-by: bhavanakarwade * fix: made request if parameter optional Signed-off-by: bhavanakarwade * refactor: added templateId mapping in file upload functionality Signed-off-by: bhavanakarwade * refactor: interface types Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * feat: changed issuance email template for EDUCRED Signed-off-by: Ganesh Nawle * fix:refactored preview uploaded file api changed query Param to path param Signed-off-by: Ganesh Nawle * added-logger statement Signed-off-by: Ganesh Nawle * fix:Minor fixes Signed-off-by: Ganesh Nawle * fix:removed all console logs Signed-off-by: Ganesh Nawle * feat:refactored api to add dynamic support to email template Signed-off-by: Ganesh Nawle --------- Signed-off-by: Ganesh Nawle Signed-off-by: bhavanakarwade Signed-off-by: tipusinghaw Co-authored-by: Ganesh Nawle Co-authored-by: ganesh_nawle <155989339+ganeshawle25@users.noreply.github.com> Co-authored-by: tipusinghaw <126460794+tipusinghaw@users.noreply.github.com> Co-authored-by: shitrerohit <37360542+shitrerohit@users.noreply.github.com> Signed-off-by: KulkarniShashank --- .../src/ecosystem/ecosystem.controller.ts | 1 + .../src/ecosystem/ecosystem.service.ts | 1 + .../src/issuance/dtos/issuance.dto.ts | 63 +-- .../src/issuance/issuance.controller.ts | 5 +- .../src/issuance/issuance.service.ts | 4 +- .../dtos/create-organization-dto.ts | 96 ++-- .../interfaces/ecosystem.interfaces.ts | 69 +++ apps/ecosystem/src/ecosystem.controller.ts | 6 +- apps/ecosystem/src/ecosystem.service.ts | 75 ++- .../interfaces/issuance.interfaces.ts | 21 +- apps/issuance/src/issuance.repository.ts | 1 + apps/issuance/src/issuance.service.ts | 45 +- .../credential-definition.repository.ts | 3 +- .../schema/repositories/schema.repository.ts | 9 +- apps/ledger/src/schema/schema.controller.ts | 8 +- apps/ledger/src/schema/schema.service.ts | 63 ++- .../repositories/organization.repository.ts | 186 +++++-- apps/user/interfaces/user.interface.ts | 53 +- apps/user/src/user.service.ts | 6 +- apps/verification/src/verification.service.ts | 1 + libs/common/src/cast.helper.ts | 12 +- .../common/src/interfaces/schema.interface.ts | 23 + libs/common/src/response-messages/index.ts | 505 ++++++++---------- 23 files changed, 680 insertions(+), 576 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index 036bb2bed..7a405de48 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -27,6 +27,7 @@ import { CreateEcosystemDto } from './dtos/create-ecosystem-dto'; import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; import { IEcosystemInvitations, IEditEcosystem, IEndorsementTransaction } from 'apps/ecosystem/interfaces/ecosystem.interfaces'; import { AddOrganizationsDto } from './dtos/add-organizations.dto'; +import { TrimStringParamPipe } from '@credebl/common/cast.helper'; @UseFilters(CustomExceptionFilter) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.service.ts b/apps/api-gateway/src/ecosystem/ecosystem.service.ts index 1fec48606..e2e645d7c 100644 --- a/apps/api-gateway/src/ecosystem/ecosystem.service.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.service.ts @@ -14,6 +14,7 @@ import { IEcosystemDashboard, IEcosystemInvitation, IEcosystemInvitations, IEcos import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; import { IEcosystemDetails } from '@credebl/common/interfaces/ecosystem.interface'; import { AddOrganizationsDto } from './dtos/add-organizations.dto'; +import { user } from '@prisma/client'; @Injectable() export class EcosystemService extends BaseService { diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index c90a7c444..fd5470c7b 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -1,20 +1,5 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { - ArrayMaxSize, - ArrayMinSize, - IsArray, - IsBoolean, - IsDefined, - IsEmail, - IsEnum, - IsNotEmpty, - IsObject, - IsOptional, - IsString, - IsUrl, - MaxLength, - ValidateNested -} from 'class-validator'; +import { ArrayMaxSize, ArrayMinSize, IsArray, IsBoolean, IsDefined, IsEmail, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, IsUrl, MaxLength, ValidateNested } from 'class-validator'; import { IsCredentialJsonLdContext, SingleOrArray } from '../utils/helper'; import { IssueCredentialType, @@ -509,17 +494,6 @@ export class OOBCredentialDtoWithEmail { @IsOptional() credentialType: IssueCredentialType; - @ApiPropertyOptional({ default: true }) - @IsOptional() - @IsNotEmpty({ message: 'please provide valid value for isReuseConnection' }) - @IsBoolean({ message: 'isReuseConnection must be a boolean' }) - isReuseConnection?: boolean; - - imageUrl?: string; - - orgId: string; -} - export class PreviewFileDetails { @ApiProperty({ required: false, example: '1' }) @IsOptional() @@ -585,20 +559,18 @@ export class ClientDetails { @Type(() => Boolean) isSelectiveIssuance?: boolean = false; - userId?: string; + userId?: string; @ApiPropertyOptional({ example: 'https://example.com/logo.png' }) @Transform(({ value }) => trim(value)) @IsOptional() - @IsUrl( - { - // eslint-disable-next-line camelcase - require_protocol: true, - // eslint-disable-next-line camelcase + @IsUrl({ + // eslint-disable-next-line camelcase + require_protocol: true, + // eslint-disable-next-line camelcase require_tld: true }, - { message: 'brandLogoUrl should be a valid URL' } - ) + { message: 'brandLogoUrl should be a valid URL' }) organizationLogoUrl?: string; @ApiPropertyOptional({ example: 'MyPlatform' }) @@ -606,24 +578,7 @@ export class ClientDetails { @IsOptional() @IsString({ message: 'platformName should be string' }) platformName?: string; - - @ApiPropertyOptional() - @Transform(({ value }) => trim(value)) - @IsOptional() - @IsString({ message: 'Certificate should be string' }) - certificate?: string; - - @ApiPropertyOptional({ example: 'a4' }) - @Transform(({ value }) => trim(value)) - @IsOptional() - @IsString({ message: 'Size should be string' }) - size?: string; - - @ApiPropertyOptional({ example: 'landscape' }) - @Transform(({ value }) => trim(value)) - @IsOptional() - @IsString({ message: 'Orientation should be string' }) - orientation?: string; + } export class TemplateDetails { @@ -652,7 +607,7 @@ export class CredentialQuery { @IsString({ message: 'Cred def Id should be string' }) @IsNotEmpty({ message: 'Cred def Id is required' }) @Transform(({ value }) => trim(value)) - credDefId?: string; + credDefId?: string; } export class TemplateQuery { diff --git a/apps/api-gateway/src/issuance/issuance.controller.ts b/apps/api-gateway/src/issuance/issuance.controller.ts index 1e1573996..f05d7ad4d 100644 --- a/apps/api-gateway/src/issuance/issuance.controller.ts +++ b/apps/api-gateway/src/issuance/issuance.controller.ts @@ -20,7 +20,9 @@ import { Logger, BadRequestException, NotFoundException, - ParseUUIDPipe + ParseUUIDPipe, + Delete, + ValidationPipe } from '@nestjs/common'; import { ApiTags, @@ -411,7 +413,6 @@ async downloadBulkIssuanceCSVTemplate( @Param('orgId') orgId: string, @User() user: user, @Query(new ValidationPipe({ transform: true })) query: CredentialQuery, - @Res() res: Response, @Body() fileDetails?: object, @UploadedFile() file?: Express.Multer.File ): Promise { diff --git a/apps/api-gateway/src/issuance/issuance.service.ts b/apps/api-gateway/src/issuance/issuance.service.ts index 957317f99..f9e615ada 100644 --- a/apps/api-gateway/src/issuance/issuance.service.ts +++ b/apps/api-gateway/src/issuance/issuance.service.ts @@ -122,9 +122,9 @@ export class IssuanceService extends BaseService { return this.sendNatsMessage(this.issuanceProxy, 'issue-bulk-credentials', payload); } - async retryBulkCredential(fileId: string, orgId: string, clientDetails: ClientDetails): Promise { + async retryBulkCredential(fileId: string, orgId: string, clientDetails: ClientDetails): Promise<{ response: object }> { const payload = { fileId, orgId, clientDetails }; - return this.sendNatsMessage(this.issuanceProxy, 'retry-bulk-credentials', payload); + return this.sendNats(this.issuanceProxy, 'retry-bulk-credentials', payload); } async _getWebhookUrl(tenantId?: string, orgId?: string): Promise { diff --git a/apps/api-gateway/src/organization/dtos/create-organization-dto.ts b/apps/api-gateway/src/organization/dtos/create-organization-dto.ts index f61c1aae1..820394d91 100644 --- a/apps/api-gateway/src/organization/dtos/create-organization-dto.ts +++ b/apps/api-gateway/src/organization/dtos/create-organization-dto.ts @@ -15,45 +15,59 @@ export class CreateOrganizationDto { @IsNotSQLInjection({ message: 'Organization name is required.' }) name: string; - @ApiProperty() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'Organization name is required.' }) - @MinLength(2, { message: 'Organization name must be at least 2 characters.' }) - @MaxLength(50, { message: 'Organization name must be at most 50 characters.' }) - @IsString({ message: 'Organization name must be in string format.' }) - @IsNotSQLInjection({ message: 'Organization name is required.' }) - name: string; - - @ApiPropertyOptional() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'Description is required.' }) - @MinLength(2, { message: 'Description must be at least 2 characters.' }) - @MaxLength(255, { message: 'Description must be at most 255 characters.' }) - @IsString({ message: 'Description must be in string format.' }) - description: string; - - @ApiPropertyOptional() - @IsOptional() - @Transform(({ value }) => trim(value)) - website?: string; - - @ApiPropertyOptional() - @IsOptional() - @Transform(({ value }) => trim(value)) - @IsNotEmpty({ message: 'notificationWebhook is required.' }) - @IsString({ message: 'notificationWebhook must be in string format.' }) - @IsUrl({ - // eslint-disable-next-line camelcase - require_protocol: true, // require URL protocol (e.g., http:// or https://) - // eslint-disable-next-line camelcase - require_tld: true // require top-level domain (e.g., .com, .net) - - }) - notificationWebhook?: string; - - @ApiPropertyOptional() - @IsOptional() - @Transform(({ value }) => trim(value)) - @IsString({ message: 'logo must be in string format.' }) - logo?: string = ''; + @ApiProperty() + @Transform(({ value }) => trim(value)) + @IsNotEmpty({ message: 'Description is required.' }) + @MinLength(2, { message: 'Description must be at least 2 characters.' }) + @MaxLength(255, { message: 'Description must be at most 255 characters.' }) + @IsString({ message: 'Description must be in string format.' }) + description: string; + + @ApiPropertyOptional() + @IsOptional() + @Transform(({ value }) => trim(value)) + website?: string; + + @ApiPropertyOptional() + @IsOptional() + @Transform(({ value }) => trim(value)) + @IsNotEmpty({ message: 'notificationWebhook is required.' }) + @IsString({ message: 'notificationWebhook must be in string format.' }) + @IsUrl({ + // eslint-disable-next-line camelcase + require_protocol: true, // require URL protocol (e.g., http:// or https://) + // eslint-disable-next-line camelcase + require_tld: true // require top-level domain (e.g., .com, .net) + }) + notificationWebhook?: string; + + @ApiPropertyOptional() + @IsOptional() + @Transform(({ value }) => trim(value)) + @IsString({ message: 'logo must be in string format.' }) + logo?: string = ''; + + @ApiPropertyOptional() + @IsOptional() + @Transform(({ value }) => trim(value)) + @IsString({ message: 'registrationNumber must be in string format.' }) + registrationNumber?: string; + + @ApiPropertyOptional({ example: 101 }) + @IsOptional() + @IsNotEmpty({ message: 'country is required' }) + @IsNumber({}, { message: 'countryId must be a number' }) + countryId?: number; + + @ApiPropertyOptional({ example: 4008 }) + @IsOptional() + @IsNotEmpty({ message: 'state is required' }) + @IsNumber({}, { message: 'stateId must be a number' }) + stateId?: number; + + @ApiPropertyOptional({ example: 1000 }) + @IsOptional() + @IsNotEmpty({ message: 'city is required' }) + @IsNumber({}, { message: 'cityId must be a number' }) + cityId?: number; } diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index 4bcced39a..4b23303a9 100644 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -416,3 +416,72 @@ export interface IEcosystemOrgDetails { count: Prisma.BatchPayload; ecosystemOrgs: IEcosystemOrgsData[]; } + +export interface IEcosystemEndorsementFlag { + autoEndorsement: boolean; +} + + +interface IEcosystemRole { + id: string; + name: string; + description: string; + createDateTime: Date; + lastChangedDateTime: Date; + deletedAt: Date; +} + +interface IEcosystemMemberOrgs extends IEcosystemOrgs{ + id: string; + createDateTime: Date; + lastChangedDateTime: Date; + deletedAt: Date; + ecosystemRole: IEcosystemRole; +} + +export interface IEcosystemData { + id: string; + name: string; + description: string; + tags: string; + createDateTime: Date; + createdBy: string; + lastChangedDateTime: Date; + lastChangedBy: string; + deletedAt: Date; + logoUrl: string; + autoEndorsement: boolean; + ledgers: Prisma.JsonValue; + ecosystemOrgs: IEcosystemMemberOrgs[]; +} + +interface IW3CAttributeValue { + attributeName: string; + schemaDataType: W3CSchemaDataType; + displayName: string; + isRequired: boolean; +} + +export interface ISubmitIndySchema { + schemaVersion?: string; + schemaName: string; + attributes: IAttributeValue[]; + orgId?: string; + orgDid?: string; +} +export interface ISubmitW3CSchema { + attributes: IW3CAttributeValue[]; + schemaName: string; + description: string; + schemaType: JSONSchemaType; +} +export interface ISubmitSchemaEndorsement { + type: SchemaTypeEnum; + schemaPayload: ISubmitIndySchema | ISubmitW3CSchema; +} + +export interface IschemaPayload { + schemaDetails: ISubmitSchemaEndorsement, + user: IUserRequestInterface, + orgId: string +} diff --git a/apps/ecosystem/src/ecosystem.controller.ts b/apps/ecosystem/src/ecosystem.controller.ts index 0c1a1a819..f0032497b 100644 --- a/apps/ecosystem/src/ecosystem.controller.ts +++ b/apps/ecosystem/src/ecosystem.controller.ts @@ -6,8 +6,10 @@ import { AcceptRejectEcosystemInvitationDto } from '../dtos/accept-reject-ecosys import { FetchInvitationsPayload } from '../interfaces/invitations.interface'; import { EcosystemMembersPayload } from '../interfaces/ecosystemMembers.interface'; import { GetEndorsementsPayload, ISchemasResponse } from '../interfaces/endorsements.interface'; -import { IEcosystemDashboard, RequestCredDeffEndorsement, RequestSchemaEndorsement, IEcosystem, IEcosystemInvitation, IEcosystemInvitations, IEditEcosystem, IEndorsementTransaction, IEcosystemList, IEcosystemLeadOrgs } from '../interfaces/ecosystem.interfaces'; -import { IEcosystemDetails } from '@credebl/common/interfaces/ecosystem.interface'; +import { IEcosystemDashboard, RequestCredDeffEndorsement, IEcosystem, IEcosystemInvitation, IEcosystemInvitations, IEditEcosystem, IEndorsementTransaction, IEcosystemList, IEcosystemLeadOrgs, IRequestSchemaEndorsement } from '../interfaces/ecosystem.interfaces'; +import { IEcosystemDataDeletionResults, IEcosystemDetails } from '@credebl/common/interfaces/ecosystem.interface'; +import { user } from '@prisma/client'; +import { IUserRequestInterface } from 'apps/ledger/src/credential-definition/interfaces'; // eslint-disable-next-line camelcase @Controller() diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 432690337..66d6357db 100644 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -20,7 +20,7 @@ import { EcosystemInviteTemplate } from '../templates/EcosystemInviteTemplate'; import { EmailDto } from '@credebl/common/dtos/email.dto'; import { sendEmail } from '@credebl/common/send-grid-helper-file'; import { AcceptRejectEcosystemInvitationDto } from '../dtos/accept-reject-ecosysteminvitation.dto'; -import { EcosystemConfigSettings, Invitation, OrgAgentType, SchemaType } from '@credebl/enum/enum'; +import { EcosystemConfigSettings, Invitation, LedgerLessConstant, OrgAgentType, SchemaType, SchemaTypeEnum } from '@credebl/enum/enum'; import { DeploymentModeType, EcosystemOrgStatus, @@ -48,7 +48,12 @@ import { IEditEcosystem, IEndorsementTransaction, IEcosystemList, - IEcosystemLeadOrgs + IEcosystemLeadOrgs, + IRequestW3CSchemaEndorsement, + ITransactionData, + IRequestIndySchemaEndorsement, + IRequestSchemaEndorsement, + IschemaPayload } from '../interfaces/ecosystem.interfaces'; import { GetAllSchemaList, GetEndorsementsPayload, ISchemasResponse } from '../interfaces/endorsements.interface'; import { CommonConstants } from '@credebl/common/common.constant'; @@ -440,12 +445,21 @@ export class EcosystemService { message: string; }> { try { - const ecosystemRoleDetails = await this.ecosystemRepository.getEcosystemRole(EcosystemRoles.ECOSYSTEM_MEMBER); + const [ecosystemRoleDetails, ecosystemDetails, userOrganizations, allOrgRoles] = await Promise.all([ + this.ecosystemRepository.getEcosystemRole(EcosystemRoles.ECOSYSTEM_MEMBER), + this.ecosystemRepository.getEcosystemLeadDetails(ecosystemLeadOrgs.ecosystemId), + this.ecosystemRepository.getAllOrganizationsByUserId(ecosystemLeadOrgs.userId), + this.ecosystemRepository.getAllOrgRoles() + ]); + + const ecosystemLeadOrg = ecosystemDetails?.orgId; + const ecosystemLeadOrgLedgerDetails = await this.ecosystemRepository.getAgentDetails(ecosystemLeadOrg); + const ecosystemLeadOrgLedgerId = ecosystemLeadOrgLedgerDetails?.ledgerId; - const getEcosystemDetails = await this.ecosystemRepository.getEcosystemLeadDetails(ecosystemLeadOrgs.ecosystemId); - const getEcosystemLeadOrg = getEcosystemDetails?.orgId; - const getEcosystemLeadOrgLedgerDetails = await this.ecosystemRepository.getAgentDetails(getEcosystemLeadOrg); - const getEcosystemLeadOrgLedgerId = getEcosystemLeadOrgLedgerDetails?.ledgerId; + const ownerRoleId = allOrgRoles.find((role) => OrgRoles.OWNER === role.name)?.id; + const ownerOrganizations = userOrganizations + .filter((org) => org.orgRoleId === ownerRoleId) + .map((org) => org.orgId); const { organizationIds } = ecosystemLeadOrgs; const errorOrgs: { statusCode: number; message: string; error?: string; data?: { orgId: string } }[] = []; @@ -460,24 +474,33 @@ export class EcosystemService { }; const orgAgentDetails = await this.ecosystemRepository.getAgentDetails(orgId); - const getOrgLedgerId = orgAgentDetails?.ledgerId; - if (orgAgentDetails?.orgDid) { - const existingOrg = await this.ecosystemRepository.checkOrgExistsInEcosystem( - orgId, - ecosystemLeadOrgs.ecosystemId - ); - if (getOrgLedgerId === getEcosystemLeadOrgLedgerId) { - if (!existingOrg) { - addedOrgs.push({ - orgId, - ecosystemId: ecosystemLeadOrgs.ecosystemId, - ecosystemRoleId: ecosystemRoleDetails.id, - status: EcosystemOrgStatus.ACTIVE, - deploymentMode: DeploymentModeType.PROVIDER_HOSTED, - createdBy: ecosystemLeadOrgs.userId, - lastChangedBy: ecosystemLeadOrgs.userId - }); - successCount++; + const orgLedgerId = orgAgentDetails?.ledgerId; + + if (ownerOrganizations.includes(orgId)) { + if (orgAgentDetails?.orgDid) { + const existingOrg = await this.ecosystemRepository.checkOrgExistsInEcosystem( + orgId, + ecosystemLeadOrgs.ecosystemId + ); + if (orgLedgerId === ecosystemLeadOrgLedgerId) { + if (!existingOrg) { + addedOrgs.push({ + orgId, + ecosystemId: ecosystemLeadOrgs.ecosystemId, + ecosystemRoleId: ecosystemRoleDetails.id, + status: EcosystemOrgStatus.ACTIVE, + deploymentMode: DeploymentModeType.PROVIDER_HOSTED, + createdBy: ecosystemLeadOrgs.userId, + lastChangedBy: ecosystemLeadOrgs.userId + }); + successCount++; + } else { + result.statusCode = HttpStatus.CONFLICT; + result.message = ResponseMessages.ecosystem.error.orgAlreadyExists; + result.error = ResponseMessages.errorMessages.conflict; + result.data = { orgId }; + errorCount++; + } } else { result.statusCode = HttpStatus.CONFLICT; result.message = `${ResponseMessages.ecosystem.error.orgAlreadyExists}`; @@ -508,7 +531,7 @@ export class EcosystemService { let getOrgs = []; if (0 < addedOrgs?.length) { - const orgs = addedOrgs.map((item) => item.orgId); + const orgs = addedOrgs?.map((item) => item.orgId); await this.ecosystemRepository.addOrganizationInEcosystem(addedOrgs); //need to discuss diff --git a/apps/issuance/interfaces/issuance.interfaces.ts b/apps/issuance/interfaces/issuance.interfaces.ts index 8df753f27..f70873cc0 100644 --- a/apps/issuance/interfaces/issuance.interfaces.ts +++ b/apps/issuance/interfaces/issuance.interfaces.ts @@ -242,9 +242,6 @@ export interface IClientDetails { fileName?: string; organizationLogoUrl?: string; platformName?: string; - certificate?: string; - size?: string; - orientation?: string; } export interface IIssuedCredentialsSearchInterface { issuedCredentialsSearchCriteria: IIssuedCredentialsSearchCriteria; @@ -295,7 +292,6 @@ export interface SendEmailCredentialOffer { organizationDetails: organisation; platformName?: string, organizationLogoUrl?: string; - prettyVc?: IPrettyVc; } export interface TemplateDetailsInterface { @@ -340,10 +336,6 @@ export interface IQueuePayload{ isLastData: boolean; organizationLogoUrl?: string; platformName?: string; - certificate?: string; - size?: string; - orientation?: string; - isReuseConnection?: boolean; } interface FileDetails { @@ -376,13 +368,10 @@ export interface IDeletedFileUploadRecords { } export interface BulkPayloadDetails { - clientId: string; - orgId: string; - requestId?: string; - isRetry: boolean; - organizationLogoUrl?: string; + clientId: string, + orgId: string, + requestId?: string, + isRetry: boolean + organizationLogoUrl?: string, platformName?: string; - certificate?: string; - size?: string; - orientation?: string; } diff --git a/apps/issuance/src/issuance.repository.ts b/apps/issuance/src/issuance.repository.ts index 1ebfe7545..746b8410f 100644 --- a/apps/issuance/src/issuance.repository.ts +++ b/apps/issuance/src/issuance.repository.ts @@ -298,6 +298,7 @@ export class IssuanceRepository { this.logger.error(`Error in getCredentialDefinitionDetails: ${error.message}`); throw new InternalServerErrorException(error.message); } + } async getSchemaDetailsBySchemaIdentifier(schemaIdentifier: string): Promise { const schemaDetails = await this.prisma.schema.findFirstOrThrow({ diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index 1793f45d8..b84594261 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -10,7 +10,7 @@ import { ResponseMessages } from '@credebl/common/response-messages'; import { ClientProxy, RpcException } from '@nestjs/microservices'; import { map } from 'rxjs'; import { BulkPayloadDetails, CredentialOffer, FileUpload, FileUploadData, IAttributes, IBulkPayloadObject, IClientDetails, ICreateOfferResponse, ICredentialPayload, IIssuance, IIssueData, IPattern, IQueuePayload, ISchemaAttributes, ISendOfferNatsPayload, ImportFileDetails, IssueCredentialWebhookPayload, OutOfBandCredentialOfferPayload, PreviewRequest, SchemaDetails, SendEmailCredentialOffer, TemplateDetailsInterface } from '../interfaces/issuance.interfaces'; -import { AutoAccept, IssuanceProcessState, OrgAgentType, PromiseResult, SchemaType, TemplateIdentifier, W3CSchemaDataType} from '@credebl/enum/enum'; +import { IssuanceProcessState, OrgAgentType, PromiseResult, SchemaType, TemplateIdentifier} from '@credebl/enum/enum'; import * as QRCode from 'qrcode'; import { OutOfBandIssuance } from '../templates/out-of-band-issuance.template'; import { EmailDto } from '@credebl/common/dtos/email.dto'; @@ -463,7 +463,7 @@ export class IssuanceService { } } -async outOfBandCredentialOffer(outOfBandCredential: OutOfBandCredentialOfferPayload, platformName?: string, organizationLogoUrl?: string, prettyVc?: IPrettyVc): Promise { +async outOfBandCredentialOffer(outOfBandCredential: OutOfBandCredentialOfferPayload, platformName?: string, organizationLogoUrl?: string): Promise { try { const { credentialOffer, @@ -566,7 +566,6 @@ async outOfBandCredentialOffer(outOfBandCredential: OutOfBandCredentialOfferPayl organizationDetails: organisation; platformName?: string; organizationLogoUrl?: string; - prettyVc?: IPrettyVc; } = { credentialType, protocolVersion, @@ -584,12 +583,7 @@ async outOfBandCredentialOffer(outOfBandCredential: OutOfBandCredentialOfferPayl emailId: emailId || '', index: 0, platformName: platformName || null, - organizationLogoUrl: organizationLogoUrl || null, - prettyVc: { - certificate: prettyVc?.certificate, - size: prettyVc?.size, - orientation: prettyVc?.orientation - } + organizationLogoUrl: organizationLogoUrl || null }; if (credentialOffer) { @@ -654,22 +648,12 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO orgId, organizationDetails, platformName, - organizationLogoUrl, - isReuseConnection + organizationLogoUrl } = sendEmailCredentialOffer; const iterationNo = index + 1; try { - let invitationDid: string | undefined; - if (true === isReuseConnection) { - const data: agent_invitations[] = await this.issuanceRepository.getInvitationDidByOrgId(orgId); - if (data && 0 < data.length) { - const [firstElement] = data; - invitationDid = firstElement?.invitationDid ?? undefined; - } - } - let outOfBandIssuancePayload; if (IssueCredentialType.INDY === credentialType) { @@ -732,7 +716,9 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO } const invitationUrl: string = credentialCreateOfferDetails.response?.invitationUrl; + const shortenUrl: string = await this.storeIssuanceObjectReturnUrl(invitationUrl); + const deeplLinkURL = convertUrlToDeepLinkUrl(shortenUrl); if (!invitationUrl) { @@ -1243,10 +1229,7 @@ return newCacheKey; isRetry, isLastData: false, organizationLogoUrl: bulkPayloadDetails?.organizationLogoUrl, - platformName: bulkPayloadDetails?.platformName, - certificate: bulkPayloadDetails?.certificate, - size: bulkPayloadDetails?.size, - orientation: bulkPayloadDetails?.orientation + platformName: bulkPayloadDetails?.platformName } })); @@ -1361,10 +1344,7 @@ return newCacheKey; requestId, isRetry: false, organizationLogoUrl: clientDetails?.organizationLogoUrl, - platformName: clientDetails?.platformName, - certificate: clientDetails?.certificate, - size: clientDetails?.size, - orientation: clientDetails?.orientation + platformName: clientDetails?.platformName }; this.processInBatches(bulkPayload, bulkPayloadDetails); @@ -1404,10 +1384,7 @@ return newCacheKey; orgId, isRetry: true, organizationLogoUrl: clientDetails?.organizationLogoUrl, - platformName: clientDetails?.platformName, - certificate: clientDetails?.certificate, - size: clientDetails?.size, - orientation: clientDetails?.orientation + platformName: clientDetails?.platformName }; this.processInBatches(bulkpayloadRetry, bulkPayloadDetails); } catch (error) { @@ -1496,7 +1473,9 @@ return newCacheKey; } const oobCredentials = await this.outOfBandCredentialOffer( - oobIssuancepayload, jobDetails?.platformName, jobDetails?.organizationLogoUrl, prettyVc); + oobIssuancepayload, jobDetails?.platformName, jobDetails?.organizationLogoUrl + ); + if (oobCredentials) { await this.issuanceRepository.deleteFileDataByJobId(jobDetails.id); } diff --git a/apps/ledger/src/credential-definition/repositories/credential-definition.repository.ts b/apps/ledger/src/credential-definition/repositories/credential-definition.repository.ts index 073edcf59..8c193e3a4 100644 --- a/apps/ledger/src/credential-definition/repositories/credential-definition.repository.ts +++ b/apps/ledger/src/credential-definition/repositories/credential-definition.repository.ts @@ -6,7 +6,8 @@ import { Injectable, Logger } from '@nestjs/common'; import { ResponseMessages } from '@credebl/common/response-messages'; import { BulkCredDefSchema, CredDefSchema } from '../interfaces/credential-definition.interface'; import { ICredDefData, IPlatformCredDefDetails } from '@credebl/common/interfaces/cred-def.interface'; -import { SortValue } from '@credebl/enum/enum'; +import { SchemaType, SortValue } from '@credebl/enum/enum'; +import { ISchemaResponse } from '../interfaces'; @Injectable() export class CredentialDefinitionRepository { diff --git a/apps/ledger/src/schema/repositories/schema.repository.ts b/apps/ledger/src/schema/repositories/schema.repository.ts index edc81e8e0..5e9d51dd5 100644 --- a/apps/ledger/src/schema/repositories/schema.repository.ts +++ b/apps/ledger/src/schema/repositories/schema.repository.ts @@ -5,7 +5,7 @@ import { ledgers, org_agents, org_agents_type, organisation, schema } from '@pri import { ISchema, ISchemaExist, ISchemaSearchCriteria } from '../interfaces/schema-payload.interface'; import { ResponseMessages } from '@credebl/common/response-messages'; import { AgentDetails, ISchemasWithCount } from '../interfaces/schema.interface'; -import { SortValue } from '@credebl/enum/enum'; +import { SchemaType, SortValue } from '@credebl/enum/enum'; import { ICredDefWithCount, IPlatformSchemas } from '@credebl/common/interfaces/schema.interface'; @Injectable() @@ -135,13 +135,6 @@ export class SchemaRepository { schemaLedgerId: { in: templateIds } - }, - include: { - organisation: { - select: { - name: true - } - } } }); return schemasResult; diff --git a/apps/ledger/src/schema/schema.controller.ts b/apps/ledger/src/schema/schema.controller.ts index 4c8edca4b..f2592fd18 100644 --- a/apps/ledger/src/schema/schema.controller.ts +++ b/apps/ledger/src/schema/schema.controller.ts @@ -26,10 +26,10 @@ export class SchemaController { return this.schemaService.createSchema(schemaDetails, user, orgId); } - @MessagePattern({ cmd: 'create-w3c-schema' }) - async createW3CSchema(payload: W3CSchemaPayload): Promise { - const {orgId, schemaPayload, user} = payload; - return this.schemaService.createW3CSchema(orgId, schemaPayload, user); + @MessagePattern({ cmd: 'get-schemas-details' }) + async getSchemasDetails(payload: {templateIds: string[]}): Promise { + const { templateIds } = payload; + return this.schemaService.getSchemaDetails(templateIds); } @MessagePattern({ cmd: 'get-schema-by-id' }) diff --git a/apps/ledger/src/schema/schema.service.ts b/apps/ledger/src/schema/schema.service.ts index f465f4b80..83c0c6e0d 100644 --- a/apps/ledger/src/schema/schema.service.ts +++ b/apps/ledger/src/schema/schema.service.ts @@ -264,13 +264,9 @@ export class SchemaService extends BaseService { async createW3CSchema(orgId:string, schemaPayload: SchemaPayload, user: IUserRequestInterface): Promise { try { - const isSchemaExist = await this.schemaRepository.schemaExists(schemaPayload.schemaName, W3CSchemaVersion.W3C_SCHEMA_VERSION); - - if (0 !== isSchemaExist.length) { - throw new ConflictException(ResponseMessages.schema.error.exists); - } - - const { description, did, schemaAttributes, schemaName} = schemaPayload; + let createSchema; + + const { description, attributes, schemaName} = schemaPayload; const agentDetails = await this.schemaRepository.getAgentDetailsByOrgId(orgId); if (!agentDetails) { throw new NotFoundException(ResponseMessages.schema.error.agentDetailsNotFound, { @@ -314,9 +310,25 @@ export class SchemaService extends BaseService { orgId, schemaRequestPayload: agentSchemaPayload }; - const createSchema = await this._createW3CSchema(W3cSchemaPayload); - - const storeW3CSchema = await this.storeW3CSchemas(createSchema.response, user, orgId); + if (schemaPayload.schemaType === JSONSchemaType.POLYGON_W3C) { + const createSchemaPayload = await this._createW3CSchema(W3cSchemaPayload); + createSchema = createSchemaPayload.response; + createSchema.type = JSONSchemaType.POLYGON_W3C; + } else { + const createSchemaPayload = await this._createW3CledgerAgnostic(schemaObject); + if (!createSchemaPayload) { + throw new BadRequestException(ResponseMessages.schema.error.schemaUploading, { + cause: new Error(), + description: ResponseMessages.errorMessages.badRequest + }); + } + createSchema = createSchemaPayload.data; + createSchema.did = agentDetails.orgDid; + createSchema.type = JSONSchemaType.LEDGER_LESS; + createSchema.schemaUrl = `${process.env.SCHEMA_FILE_SERVER_URL}${createSchemaPayload.data.schemaId}`; + } + + const storeW3CSchema = await this.storeW3CSchemas(createSchema, user, orgId, attributes); if (!storeW3CSchema) { throw new ConflictException(ResponseMessages.schema.error.storeW3CSchema, { @@ -515,9 +527,8 @@ export class SchemaService extends BaseService { return W3CSchema; } - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type - private async storeW3CSchemas(schemaDetails, user, orgId) { - + private async storeW3CSchemas(schemaDetails, user, orgId, attributes): Promise { + let ledgerDetails; const schemaServerUrl = `${process.env.SCHEMA_FILE_SERVER_URL}${schemaDetails.schemaId}`; const schemaRequest = await this.commonService @@ -530,26 +541,24 @@ export class SchemaService extends BaseService { description: ResponseMessages.errorMessages.notFound }); } - const schemaAttributeJson = schemaRequest.definitions.credentialSubject.properties; - const extractedData = []; - - for (const key in schemaAttributeJson) { - if (2 < Object.keys(schemaAttributeJson[key]).length) { - const { type, title } = schemaAttributeJson[key]; - const schemaDataType = type; - const displayName = title; - const isRequired = false; - extractedData.push({ 'attributeName': title, schemaDataType, displayName, isRequired }); - } + const indyNamespace = await networkNamespace(schemaDetails?.did); + if (indyNamespace === LedgerLessMethods.WEB || indyNamespace === LedgerLessMethods.KEY) { + ledgerDetails = await this.schemaRepository.getLedgerByNamespace(LedgerLessConstant.NO_LEDGER); + } else { + ledgerDetails = await this.schemaRepository.getLedgerByNamespace(indyNamespace); } - const indyNamespace = schemaDetails?.did.includes(':testnet:') ? 'polygon:testnet' : 'polygon'; - const getLedgerId = await this.schemaRepository.getLedgerByNamespace(indyNamespace); + if (!ledgerDetails) { + throw new NotFoundException(ResponseMessages.schema.error.networkNotFound, { + cause: new Error(), + description: ResponseMessages.errorMessages.notFound + }); + } const storeSchemaDetails = { schema: { schemaName: schemaRequest.title, schemaVersion: W3CSchemaVersion.W3C_SCHEMA_VERSION, - attributes:extractedData, + attributes, id: schemaDetails.schemaUrl }, diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 3b13946e3..19b7fe233 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -621,6 +621,9 @@ export class OrganizationRepository { logoUrl: true, orgSlug: true, createDateTime: true, + countryId:true, + stateId: true, + cityId: true, ecosystemOrgs: { select: { ecosystemId: true @@ -874,7 +877,7 @@ export class OrganizationRepository { createDateTime: true, did: true, lastChangedDateTime: true, - isPrimaryDid: true + isPrimaryDid: true } }); } catch (error) { @@ -891,69 +894,158 @@ export class OrganizationRepository { where: { id }, - data: { - isPrimaryDid: true - } - }), - this.prisma.org_agents.update({ - where: { - orgId - }, - data: { - orgDid: did, - didDocument - } - }) - ]); - return ResponseMessages.organisation.success.didDetails; + data: { + isPrimaryDid: true + } + }), + this.prisma.org_agents.update({ + where: { + orgId + }, + data: { + orgDid: did, + didDocument, + ledgerId: networkId + } + }) + ]); + return ResponseMessages.organisation.success.didDetails; } catch (error) { - this.logger.error(`[setOrgsPrimaryDid] - Update DID details: ${JSON.stringify(error)}`); - throw error; + this.logger.error(`[setOrgsPrimaryDid] - Update DID details: ${JSON.stringify(error)}`); + throw error; } -} + } async getDidDetailsByDid(did:string): Promise { - try { - return this.prisma.org_dids.findFirstOrThrow({ - where: { - did - } - }); - } catch (error) { + try { + return this.prisma.org_dids.findFirstOrThrow({ + where: { + did + } + }); + } catch (error) { this.logger.error(`[getDidDetailsByDid] - get DID details: ${JSON.stringify(error)}`); throw error; + } } - } async getPerviousPrimaryDid(orgId:string): Promise { - try { - return this.prisma.org_dids.findFirstOrThrow({ - where: { - orgId, - isPrimaryDid: true - } - }); - } catch (error) { + try { + return this.prisma.org_dids.findFirstOrThrow({ + where: { + orgId, + isPrimaryDid: true + } + }); + } catch (error) { this.logger.error(`[getPerviousPrimaryDid] - get DID details: ${JSON.stringify(error)}`); throw error; + } + } + + async getDids(orgId:string): Promise { + try { + return this.prisma.org_dids.findMany({ + where: { + orgId + } + }); + } catch (error) { + this.logger.error(`[getDids] - get all DIDs: ${JSON.stringify(error)}`); + throw error; + } } - } async setPreviousDidFlase(id:string): Promise { - try { - return this.prisma.org_dids.update({ - where: { - id - }, - data: { - isPrimaryDid: false - } - }); - } catch (error) { + try { + return this.prisma.org_dids.update({ + where: { + id + }, + data: { + isPrimaryDid: false + } + }); + } catch (error) { this.logger.error(`[setPreviousDidFlase] - Update DID details: ${JSON.stringify(error)}`); throw error; + } + } + + async getOrgInvitationsByOrg(orgId: string): Promise { + try { + return this.prisma.org_invitations.findMany({ + where: { + orgId + } + }); + } catch (error) { + this.logger.error(`[getOrgInvitationsByOrg] - get organization invitations: ${JSON.stringify(error)}`); + throw error; + } + } + + async getNetworkByNameSpace(nameSpace: string): Promise { + try { + return this.prisma.ledgers.findFirstOrThrow({ + where: { + indyNamespace: nameSpace + } + }); + } catch (error) { + this.logger.error(`[getNetworkByIndyNameSpace] - get network by namespace: ${JSON.stringify(error)}`); + throw error; + } + } + + async getLedger(name: string): Promise { + try { + const ledgerData = await this.prisma.ledgers.findFirstOrThrow({ + where: { + name + } + }); + return ledgerData; + } catch (error) { + this.logger.error(`[getLedger] - get ledger details: ${JSON.stringify(error)}`); + throw error; + } + } + + async getOrgRole(id: string[]): Promise { + try { + const orgRoleData = await this.prisma.org_roles.findMany({ + where: { + id: { + in: id + } + } + }); + return orgRoleData; + } catch (error) { + this.logger.error(`[getOrgRole] - get org role details: ${JSON.stringify(error)}`); + throw error; + } } - } + async getUserOrgRole(userId: string, orgId: string): Promise { + try { + const userOrgRoleDetails = await this.prisma.user_org_roles.findMany({ + where: { + userId, + orgId + }, + select:{ + orgRoleId: true + } + }); + // Map the result to an array of orgRoleId + const orgRoleIds = userOrgRoleDetails.map(role => role.orgRoleId); + return orgRoleIds; + } catch (error) { + this.logger.error(`[getUserOrgRole] - get user org role details: ${JSON.stringify(error)}`); + throw error; + } + } } diff --git a/apps/user/interfaces/user.interface.ts b/apps/user/interfaces/user.interface.ts index 9fabb6f4b..c64af0ed2 100644 --- a/apps/user/interfaces/user.interface.ts +++ b/apps/user/interfaces/user.interface.ts @@ -1,4 +1,4 @@ -import { $Enums, Prisma, RecordType } from '@prisma/client'; +import { Prisma, RecordType } from '@prisma/client'; export interface IUsersProfile { id: string; @@ -61,7 +61,6 @@ export interface IUserInformation { firstName: string; lastName: string; isPasskey: boolean; - isHolder?: boolean; } export interface AddPasskeyDetails { @@ -120,31 +119,31 @@ export interface IUserCredentials { export interface IOrgUsers { totalPages: number, users: OrgUser[] - } - - export interface IDidList { - id: string; - createDateTime: Date; - did: string; - lastChangedDateTime: Date; - isPrimaryDid: boolean; - } - - interface OrgUser { - id: string; - username: string; - email: string; - firstName: string; - lastName: string; - isEmailVerified: boolean; - userOrgRoles: UserOrgRoles[]; - } - - interface UserOrgRoles { - id: string; - orgId: string; - orgRoleId: string; - orgRole: OrgRole; +} + +export interface IDidList { + id: string; + createDateTime: Date; + did: string; + lastChangedDateTime: Date; + isPrimaryDid: boolean; +} + +interface OrgUser { + id: string; + username: string; + email: string; + firstName: string; + lastName: string; + isEmailVerified: boolean; + userOrgRoles: UserOrgRoles[]; +} + +interface UserOrgRoles { + id: string; + orgId: string; + orgRoleId: string; + orgRole: OrgRole; organisation: Organization } interface OrgRole { diff --git a/apps/user/src/user.service.ts b/apps/user/src/user.service.ts index 366bf979f..695dfc704 100644 --- a/apps/user/src/user.service.ts +++ b/apps/user/src/user.service.ts @@ -115,12 +115,10 @@ export class UserService { const verifyCode = uuidv4(); let sendVerificationMail: boolean; - + try { - const token = await this.clientRegistrationService.getManagementToken(clientId, clientSecret); const getClientData = await this.clientRegistrationService.getClientRedirectUrl(clientId, token); - const [redirectUrl] = getClientData[0]?.redirectUris || []; if (!redirectUrl) { @@ -135,8 +133,6 @@ export class UserService { if (sendVerificationMail) { const uniqueUsername = await this.createUsername(email, verifyCode); userEmailVerification.username = uniqueUsername; - userEmailVerification.clientId = clientId; - userEmailVerification.clientSecret = clientSecret; const resUser = await this.userRepository.createUser(userEmailVerification, verifyCode); return resUser; } diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts index 4744893a7..ae879af1e 100644 --- a/apps/verification/src/verification.service.ts +++ b/apps/verification/src/verification.service.ts @@ -429,6 +429,7 @@ export class VerificationService { if (ProofRequestType.INDY === type) { updateOutOfBandRequestProof.protocolVersion = updateOutOfBandRequestProof.protocolVersion || 'v1'; updateOutOfBandRequestProof.invitationDid = invitationDid || undefined; + updateOutOfBandRequestProof.imageUrl = getOrganization?.logoUrl || undefined; payload = { orgId: user.orgId, url, diff --git a/libs/common/src/cast.helper.ts b/libs/common/src/cast.helper.ts index 2d041ac34..4afbac93d 100644 --- a/libs/common/src/cast.helper.ts +++ b/libs/common/src/cast.helper.ts @@ -91,13 +91,19 @@ export const IsNotSQLInjection = validate(value) { // Check if the value contains any common SQL injection keywords const sqlKeywords = ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'UNION', 'WHERE', 'AND', 'OR']; + if ('string' === typeof value) { + // Convert the value to upper case for case-insensitive comparison + const upperCaseValue = value.toUpperCase(); + // Use a regular expression to check for whole words for (const keyword of sqlKeywords) { - if (value.includes(keyword)) { + const regex = new RegExp(`\\b${keyword}\\b`, 'i'); + if (regex.test(upperCaseValue)) { return false; // Value contains a SQL injection keyword } } - return true; // Value does not contain any SQL injection keywords - }, + } + return true; // Value does not contain any SQL injection keywords + }, defaultMessage(args: ValidationArguments) { return `${args.property} contains SQL injection keywords.`; } diff --git a/libs/common/src/interfaces/schema.interface.ts b/libs/common/src/interfaces/schema.interface.ts index 2918884a7..0da8565f3 100644 --- a/libs/common/src/interfaces/schema.interface.ts +++ b/libs/common/src/interfaces/schema.interface.ts @@ -40,6 +40,29 @@ export interface ISchemasWithPagination extends IPaginationDetails{ issuerId: string; } + interface Attribute { + attributeName: string; + schemaDataType: string; + displayName: string; + isRequired: boolean; + } + + export interface ISchemaDetail { + id: string; + createDateTime: string; + createdBy: string; + lastChangedDateTime: string; + lastChangedBy: string; + name: string; + version: string; + attributes: Attribute[]; + schemaLedgerId: string; + publisherDid: string; + issuerId: string; + orgId: string; + ledgerId: string; + type: string; + } export interface IPlatformSchemas { schemasCount: number; diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 395edd043..c802c6571 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -17,79 +17,91 @@ export const ResponseMessages = { userCredentials: 'User credentials fetched successfully', platformEcosystemettings: 'Platform and ecosystem settings updated', fetchPlatformSettings: 'Platform settings fetched', - signUpUser:'User created successfully', - shareUserCertificate:'Certificate URL generated successfully', - updateUserProfile:'User profile updated successfully', + signUpUser: 'User created successfully', + shareUserCertificate: 'Certificate URL generated successfully', + updateUserProfile: 'User profile updated successfully', resetPassword: 'Password reset successfully', degreeCertificate: 'Degree Certificate shared successfully', resetPasswordLink: 'Reset password link has been sent to your mail', - refreshToken: 'Token details fetched successfully' + refreshToken: 'Token details fetched successfully', + countriesVerificationCode: 'All countries has been fetched successfully', + stateVerificationCode: 'All states has been fetched successfully', + cityVerificationCode: 'All cities has been fetched successfully' }, - organisation: { - success: { - create: 'Organization created successfully', - update: 'Organization updated successfully', - fetchProfile: 'Organization profile fetched successfully', - fetchOrgRoles: 'Organization roles fetched successfully', - createInvitation: 'Organization invitations sent', - getInvitation: 'Organization invitations fetched successfully', - getOrganization: 'Organization details fetched successfully', - getOrgDashboard: 'Organization dashboard details fetched', - getOrganizations: 'Organizations details fetched successfully', - updateUserRoles: 'User roles updated successfully', - delete: 'Organization deleted successfully', - orgInvitationDeleted: 'Organization invitation deleted successfully', - orgCredentials: 'Organization credentials created successfully', - fetchedOrgCredentials: 'Organization credentials fetched successfully', - clientCredentials: 'Client credentials fetched successfully', - deleteCredentials:'Organization client credentials deleted', - orgDids: 'Organization DIDs fetched successfully', - primaryDid: 'Primary DID updated successfully', - didDetails: 'DID Details updated sucessfully' - - }, - error: { - exists: 'An organization name is already exist', - orgProfileNotFound: 'Organization public profile not found', - orgSlugIsRequired: 'orgSlug is required', - invitationIdIsRequired:'Invitation Id is required', - userIdIsRequired:'UserId is required', - rolesNotExist: 'Provided roles not exists in the platform', - orgProfile: 'Organization profile not found', - userNotFound: 'User not found for the given organization', - orgRoleIdNotFound:'Provided roles not exists for this organization', - updateUserRoles: 'Unable to update user roles', - deleteOrg: 'Organization not found', - deleteOrgInvitation: 'Organization does not have access to delete this invitation', - notFound: 'Organization agent not found', - orgNotFound: 'Organization not found', - orgNotMatch: 'Organization does not have access', - invitationStatusInvalid: 'Unable to delete invitation with accepted/rejected status', - credentialsNotUpdate: 'Unable to update organization credentials', - invalidOrgId:'Invalid format for orgId', - orgIdIsRequired:'OrgId is required', - clientIdRequired:'clientId is required', - notExistClientCred: 'Organization does not have client credentials', - invalidUserId:'Invalid format of userId', - invalidInvitationId:'Invalid format for invitation id', - ecosystemIdIsRequired:'ecosystemId is required', - roleNotMatch: 'User does not have access', - orgDoesNotMatch: 'Organization does not match', - invalidClient: 'Invalid client credentials', - primaryDid: 'This DID is already set to primary DID', - didNotFound: 'DID does not exist in organiation' - } + error: { + exists: 'User already exists', + profileNotFound: 'User public profile not found', + notUpdatePlatformSettings: 'Unable to update platform config settings', + platformSetttingsNotFound: 'Unable to get platform settings', + ecosystemSetttingsNotFound: 'Unable to get ecosystem settings', + notUpdateEcosystemSettings: 'Unable to update ecosystem config settings', + verificationAlreadySent: 'The verification link has already been sent to your email address', + emailSend: 'Unable to send email to the user', + redirectUrlNotFound: 'Redirect URL not found', + invalidEmailUrl: 'Invalid verification code or EmailId!', + verifiedEmail: 'Email already verified', + notFound: 'User not found', + verifyMail: 'Please verify your email', + invalidCredentials: 'Invalid Credentials', + registerFido: 'Please complete your fido registration', + invitationNotFound: 'Invitation not found for this user', + invitationAlreadyAccepted: 'Organization invitation already accepted', + invitationAlreadyRejected: 'Organization invitation already rejected', + invalidInvitationStatus: 'Invalid invitation status', + invalidKeycloakId: 'keycloakId is invalid', + invalidEmail: 'Invalid Email Id!', + adduser: 'Unable to add user details', + verifyEmail: 'The verification link has already been sent to your email address. please verify', + emailNotVerified: 'The verification link has already been sent to your email address. please verify', + userNotRegisterd: 'The user has not yet completed the registration process', + InvalidEmailDomain: 'Email from this domain is not allowed', + credentialNotFound: 'User credentials not found', + invalidOrgId: 'Organization does not exist', + invalidInvitationId: 'Organization invitation does not exist', + invitationAlreadyPending: 'Organization invitation is already in pending state', + emailIsNotVerified: 'Email is not verified', + invitationStatusUpdateInvalid: 'Status update is invalid. Request is already', + resetSamePassword: 'New password should not be the current password', + resetPasswordLink: 'Unable to create reset password token', + invalidResetLink: 'Invalid or expired reset password link', + invalidAccessToken: 'Authentication failed', + invalidRefreshToken: 'Invalid refreshToken provided', + userOrgsLimit: 'Limit reached: You can be associated with or create maximum 10 organizations.' + } + }, + organisation: { + success: { + create: 'Organization created successfully', + update: 'Organization updated successfully', + fetchProfile: 'Organization profile fetched successfully', + fetchOrgRoles: 'Organization roles fetched successfully', + createInvitation: 'Organization invitations sent', + getInvitation: 'Organization invitations fetched successfully', + getOrganization: 'Organization details fetched successfully', + getOrgDashboard: 'Organization dashboard details fetched', + getOrganizations: 'Organizations details fetched successfully', + updateUserRoles: 'User roles updated successfully', + delete: 'Organization deleted successfully', + orgInvitationDeleted: 'Organization invitation deleted successfully', + orgCredentials: 'Organization credentials created successfully', + fetchedOrgCredentials: 'Organization credentials fetched successfully', + clientCredentials: 'Client credentials fetched successfully', + deleteCredentials: 'Organization client credentials deleted', + orgDids: 'Organization DIDs fetched successfully', + primaryDid: 'Primary DID updated successfully', + didDetails: 'DID Details updated sucessfully', + getOrganizationActivity: 'Organization activity count fetched successfully' }, error: { exists: 'An organization name is already exist', orgProfileNotFound: 'Organization public profile not found', orgSlugIsRequired: 'orgSlug is required', - invitationIdIsRequired:'Invitation Id is required', - userIdIsRequired:'UserId is required', + invitationIdIsRequired: 'Invitation Id is required', + userIdIsRequired: 'UserId is required', rolesNotExist: 'Provided roles not exists in the platform', orgProfile: 'Organization profile not found', userNotFound: 'User not found for the given organization', - orgRoleIdNotFound:'Provided roles not exists for this organization', + orgRoleIdNotFound: 'Provided roles not exists for this organization', updateUserRoles: 'Unable to update user roles', deleteOrg: 'Organization not found', deleteOrgInvitation: 'Organization does not have access to delete this invitation', @@ -99,19 +111,19 @@ export const ResponseMessages = { orgNotMatch: 'Organization does not have access', invitationStatusInvalid: 'Unable to delete invitation with accepted/rejected status', credentialsNotUpdate: 'Unable to update organization credentials', - invalidOrgId:'Invalid format for orgId', - orgIdIsRequired:'OrgId is required', - clientIdRequired:'clientId is required', + invalidOrgId: 'Invalid format for orgId', + orgIdIsRequired: 'OrgId is required', + clientIdRequired: 'clientId is required', notExistClientCred: 'Organization does not have client credentials', - invalidUserId:'Invalid format of userId', - invalidInvitationId:'Invalid format for invitation id', - ecosystemIdIsRequired:'ecosystemId is required', + invalidUserId: 'Invalid format of userId', + invalidInvitationId: 'Invalid format for invitation id', + ecosystemIdIsRequired: 'ecosystemId is required', roleNotMatch: 'User does not have access', orgDoesNotMatch: 'Organization does not match', invalidClient: 'Invalid client credentials', primaryDid: 'This DID is already set to primary DID', didNotFound: 'DID does not exist in organiation', - MaximumOrgsLimit:'Limit reached: You can be associated with or create maximum 10 organizations.', + MaximumOrgsLimit: 'Limit reached: You can be associated with or create maximum 10 organizations.', organizationEcosystemValidate: 'This organization is an ecosystem lead or ecosystem owner.' } }, @@ -139,58 +151,43 @@ export const ResponseMessages = { } }, - schema: { - success: { - fetch: 'Schema retrieved successfully.', - create: 'Schema created successfully.' - }, - error: { - invalidSchemaId: 'Invalid schema Id provided.', - invalidData: 'Invalid data provided.', - nameNotEmpty: 'Schema name is required', - versionNotEmpty: 'Schema version is required', - invalidVersion: 'Invalid schema version provided.', - insufficientAttributes: 'Please provide at least one attribute.', - uniqueAttributesnames: 'Please provide unique attribute names', - uniqueAttributesDisplaynames: 'Please provide unique display names for attributes', - emptyData: 'Please provide data for creating schema.', - exists: 'Schema already exists', - notCreated: 'Schema not created', - notFound: 'Schema records not found', - schemaIdNotFound: 'SchemaLedgerId not found', - credentialDefinitionNotFound: 'No credential definition exist', - notStoredCredential: 'User credential not stored', - agentDetailsNotFound: 'Agent details not found', - failedFetchSchema: 'Failed to fetch schema data', - atLeastOneRequired: 'At least one of the attributes should have isReuired as `true`', - schemaBuilder: 'Error while creating schema JSON', - W3CSchemaNotFOund: 'Error while resolving W3C schema', - storeW3CSchema: 'Error while storing W3C schema' - } - }, - credentialDefinition: { - success: { - fetch: 'Credential definition fetched successfully.', - create: 'Credential definition created successfully.' - }, - error: { - NotFound: 'No credential definitions found.', - NotSaved: 'Error in saving credential definition.', - Conflict: 'Credential definition already exists', - schemaIdNotFound: 'SchemaLedgerId not found', - isRequired: 'Credential definition Id is required', - OrgDidNotFound: 'OrgDid not found', - credDefIdNotFound: 'Credential Definition Id not found' - } + schema: { + success: { + fetch: 'Schema retrieved successfully.', + create: 'Schema created successfully.' }, - ledger: { - success: { - fetch: 'Ledger details retrieved successfully.', - fetchNetworkUrl: 'Network url retrieved successfully' - }, - error: { - NotFound: 'No ledgers found.' - } + error: { + invalidSchemaId: 'Invalid schema Id provided.', + invalidData: 'Invalid data provided.', + nameNotEmpty: 'Schema name is required', + versionNotEmpty: 'Schema version is required', + invalidVersion: 'Invalid schema version provided.', + insufficientAttributes: 'Please provide at least one attribute.', + uniqueAttributesnames: 'Please provide unique attribute names', + uniqueAttributesDisplaynames: 'Please provide unique display names for attributes', + emptyData: 'Please provide data for creating schema.', + exists: 'Schema already exists', + notCreated: 'Schema not created', + notFound: 'Schema records not found', + schemaIdNotFound: 'SchemaLedgerId not found', + credentialDefinitionNotFound: 'No credential definition exist', + notStoredCredential: 'User credential not stored', + agentDetailsNotFound: 'Agent details not found', + failedFetchSchema: 'Failed to fetch schema data', + atLeastOneRequired: 'At least one of the attributes should have isReuired as `true`', + schemaBuilder: 'Error while creating schema JSON', + schemaUploading: 'Error while uploading schema JSON', + W3CSchemaNotFOund: 'Error while resolving W3C schema', + storeW3CSchema: 'Error while storing W3C schema', + networkNotFound: 'Error while fetching network', + orgDidAndSchemaType: 'Organization DID and schema type does not match' + } + }, + credentialDefinition: { + success: { + fetch: 'Credential definition fetched successfully.', + create: 'Credential definition created successfully.', + template: 'Credential template fetched successfully.' }, agent: { success: { @@ -255,50 +252,65 @@ export const ResponseMessages = { createDid: 'Did created successfully', health: 'Agent health details retrieved successfully.', ledgerConfig: 'Ledger config details fetched successfully.', - webhookUrlRegister:'Webhook Url registered successfully', - getWebhookUrl:'Webhook Url fetched successfully', - createKeys:'Key-pair created successfully', + webhookUrlRegister: 'Webhook Url registered successfully', + getWebhookUrl: 'Webhook Url fetched successfully', + createKeys: 'Key-pair created successfully', walletDelete: 'The wallet has been deleted.' }, - issuance: { - success: { - create: 'Credentials offer created successfully', - createOOB: 'Out-of-band credentials offer created successfully', - fetch: 'Issued Credential details fetched successfully', - importCSV: 'File imported successfully', - previewCSV: 'File details fetched successfully', - bulkIssuance: 'Issuance process started. It will take some time', - notFound: 'Schema records not found' - }, - error: { - exists: 'Credentials is already exist', - credentialsNotFound: 'Credentials not found', - agentEndPointNotFound: 'Agent details not found', - organizationNotFound: 'organization Not Found', - agentUrlNotFound: 'agent url not found', - notFound: 'History not found', - credentialOfferNotFound: 'Credential offer not found', - invitationNotFound: 'Invitation not found', - unableToCreateOOBOffer: 'Unable to create out-of-band credential offer', - platformConfigNotFound: 'Platform config details not found', - emailSend: 'Unable to send email to the user', - previewFile: 'Error while fetching file details', - previewCachedData: 'Error while fetching cached data', - emptyFileData: 'File details does not exit or removed', - cacheTimeOut: 'Timeout for reviewing data, re-upload your file and generate new request', - fileNotFound: 'File details not found', - fileData: 'File data does not exist for the specific file', - retry: 'Credentials do not exist for retry', - walletError: 'Credential Issuance failed due to error in Wallet Agent', - emailIdNotPresent: 'EmailId is empty or not present', - attributesNotPresent: 'Attributes are not present or not empty', - unableToCreateOffer: 'Unable to create offer', - orgAgentTypeNotFound: 'Organization agent type not found', - credentialNotPresent: 'credential is required', - optionsNotPresent:'options are required', - attributesAreRequired: 'attributes are required', - invalidCredentialType:'invalid credential type' - } + error: { + exists: 'An agent name is already exist', + orgNotFound: 'Organization not found', + apiEndpointNotFound: 'apiEndpoint not found', + notAbleToSpinUpAgent: 'Agent not able to spin up', + alreadySpinUp: 'Agent already spun up', + agentUrl: 'Agent url not exist', + apiKeyNotExist: 'API key is not found', + walletNotDeleted: 'Wallet is not deleted, Please check', + seedChar: 'seed must be at most 32 characters', + validWalletName: 'Please enter valid wallet name. It allows only alphanumeric values', + platformConfiguration: 'Platform configuration is missing or invalid', + apiEndpoint: 'API endpoint is missing in the platform configuration', + externalIp: 'External IP is missing in the platform configuration', + stringExternalIp: 'External IP must be a string', + agentProcess: 'Agent process is invalid or not in a completed state', + notAbleToSpinup: 'Agent not able to spun up', + ledgerNotFound: 'Ledgers not found', + agentNotExists: 'Agent not spun up for this organization', + agentDown: 'Agent is down or not spun up', + walletAlreadyCreated: 'Your wallet is already been created', + walletAlreadyProcessing: 'Your wallet is already processing', + notAbleToSpinp: 'Agent not able to spun up', + platformAdminNotAbleToSpinp: 'Platform admin agent is not spun up', + invalidLedger: 'Invalid ledger name', + seedCharCount: 'seed must be at most 32 characters', + nullTenantId: 'TenantId must not be null', + tenantIdNotFound: 'TenantId not found', + invalidTenantIdIdFormat: 'Invalid tenantId format', + requiredTenantId: 'Tenant Id is required', + createDid: 'Error while creating DID', + networkMismatch: 'The network is mismatched.', + didAlreadyExist: 'DID already exist', + storeDid: 'Error while storing DID', + noLedgerFound: 'No ledger data not found.', + agentSpinupError: 'Agent endpoint unreachable', + agentEndpointRequired: 'Agent endpoint is required', + failedAgentType: 'Agent endpoint is required', + failedApiKey: 'Failed to encrypt API key', + failedOrganization: 'Failed to fetch organization agent type details', + promiseReject: 'One or more promises were rejected.', + orgAgentNotFound: 'Org agent type not found', + walletDoesNotExists: 'Organization wallet does not exists' + } + }, + connection: { + success: { + create: 'Connection created successfully', + receivenvitation: 'Invitation received successfully', + fetchConnection: 'Connection details fetched successfully', + fetch: 'Connections details fetched successfully', + questionAnswerRecord: 'Question Answer record fetched successfully', + questionSend: 'Question sent successfully', + deleteConnectionRecord: 'Connection records deleted' }, error: { exists: 'Connection is already exist', @@ -322,78 +334,50 @@ export const ResponseMessages = { bulkProcess: 'Process initiated for bulk issuance', deleteIssuanceRecords: 'Issuance records deleted' }, - ecosystem: { - success: { - create: 'Ecosystem created successfully', - update: 'Ecosystem details updated successfully', - add: 'Organization added successfully', - delete: 'Ecosystem invitations deleted successfully', - fetch: 'Ecosystem fetched successfully', - getEcosystemDashboard: 'Ecosystem dashboard details fetched successfully', - getInvitation: 'Ecosystem invitations fetched successfully', - createInvitation: 'Ecosystem invitations sent', - schemaRequest: 'Schema transaction request created successfully', - credDefRequest: 'Credential definition transaction request created successfully', - sign: 'Endorsement request approved', - submit: 'Endorsement request submitted to ledger', - invitationReject: 'Ecosystem invitation rejected', - invitationAccept: 'Ecosystem invitation accepted successfully', - fetchEndorsors: 'Endorser transactions fetched successfully', - DeclineEndorsementTransaction: 'Endorsement request declined', - AutoEndorsementTransaction: 'The flag for transactions has been successfully set', - fetchMembers: 'Ecosystem members fetched successfully', - allschema: 'Schema details fetched successfully', - AutoSignAndSubmit: 'Endorsement request approved & submitted to ledger' - }, - error: { - notCreated: 'Error while creating ecosystem', - agentNotSpunUp: 'Agent is not spun up for this organization', - orgAlreadyExists: 'Organization is already exists in ecosystem', - unableToAdd: 'Unable to add organization', - partiallyAdded: 'Organization(s) are partially added', - orgNotExist: 'Organization does not exist', - orgDidNotExist: 'Organization did does not exist', - exists: 'An ecosystem name is already exist', - update: 'Error while updating ecosystem', - invalidInvitationStatus: 'Invalid invitation status', - invitationNotFound: 'Ecosystem Invitation not found', - invitationNotUpdate: 'Ecosystem Invitation not updated', - ledgerNotMatch: 'Organization ledger network not matched with Ecosystem', - orgsNotUpdate: 'Ecosystem Orgs not updated', - ecosystemNotEnabled: 'Ecosystem service is not enabled', - sumbitTransaction: 'Error while submitting transaction', - requestSchemaTransaction: 'Error while request schema transaction', - requestCredDefTransaction: 'Error while submitting transaction', - notFound: 'Organization not found', - platformConfigNotFound: 'Platform configurations not found', - schemaNotFound: 'Schema not found', - ecosystemNotFound: 'Ecosystem not found', - ecosystemOrgNotFound: 'Ecosystem org not found', - ecosystemConfigNotFound: 'Ecosystem config not found', - credentialDefinitionNotFound: 'Credential definition found', - leadNotFound: 'Lead details not found', - signRequestError: 'Error while signing the transaction', - updateTransactionError: 'Error while update the transaction', - schemaAlreadyExist: 'Schema name and schema version already exist', - credDefAlreadyExist: 'Credential definition already exist', - saveSchema: 'Error while storing the schema details', - saveCredDef: 'Error while storing the credential-definition details', - invalidOrgId: 'Invalid organization Id', - invalidEcosystemId: 'Invalid ecosystem Id', - invalidTransaction: 'Transaction does not exist', - transactionSubmitted: 'Transaction already submitted', - transactionNotSigned: 'Transaction request is not signed', - invalidAgentUrl: 'Invalid agent url', - EndorsementTransactionNotFoundException: 'Endorsement transaction with status requested not found', - OrgOrEcosystemNotFoundExceptionForEndorsementTransaction: 'The endorsement transaction status cant be updated', - ecosystemOrgAlready: 'Organization is already part of the ecosystem. Please ensure that the organization is not duplicated.', - updateSchemaId: 'Error while updating the schema id', - updateCredDefId: 'Error while updating the credential-definition', - invalidMessage: 'Invalid transaction details. Missing "message" property.', - invalidTransactionMessage: 'Invalid transaction details', - ecosystemRoleNotMatch: 'Ecosystem role not match', - orgEcoIdRequired: 'OrgId & EcosystemId is required' - } + error: { + exists: 'Credentials is already exist', + credentialsNotFound: 'Credentials not found', + agentEndPointNotFound: 'Agent details not found', + organizationNotFound: 'organization Not Found', + agentUrlNotFound: 'agent url not found', + notFound: 'History not found', + credentialOfferNotFound: 'Credential offer not found', + invitationNotFound: 'Invitation not found', + unableToCreateOOBOffer: 'Unable to create out-of-band credential offer', + platformConfigNotFound: 'Platform config details not found', + emailSend: 'Unable to send email to the user', + previewFile: 'Error while fetching file details', + previewCachedData: 'Error while fetching cached data', + emptyFileData: 'File details does not exit or removed', + cacheTimeOut: 'Timeout for reviewing data, re-upload your file and generate new request', + fileNotFound: 'File details not found', + fileData: 'File data does not exist for the specific file', + retry: 'Credentials do not exist for retry', + walletError: 'Credential Issuance failed due to error in Wallet Agent', + emailIdNotPresent: 'EmailId is empty or not present', + attributesNotPresent: 'Attributes are not present or not empty', + unableToCreateOffer: 'Unable to create offer', + orgAgentTypeNotFound: 'Organization agent type not found', + credentialNotPresent: 'credential is required', + optionsNotPresent: 'options are required', + attributesAreRequired: 'attributes are required', + invalidCredentialType: 'invalid credential type', + missingRequestId: 'Param requestId is missing from the request.', + cachedData: 'Cached data does not exist', + cachedfileData: 'Cached file data does not exist', + storeBulkData: 'Error while storing the bulk deata', + issuanceRecordsNotFound: 'Issuance records does not exists', + removeIssuanceData: 'First you have to remove issuance data' + } + }, + verification: { + success: { + fetch: 'Proof presentations details fetched successfully.', + create: 'Presentation of proof received successfully.', + verifiedProofDetails: 'Proof presentation details fetched successfully.', + send: 'Proof request send successfully.', + verified: 'Proof presentation verified successfully.', + deleteVerificationRecord: 'Verification records deleted' }, error: { notFound: 'Organization agent not found', @@ -425,7 +409,8 @@ export const ResponseMessages = { schemaRequest: 'Schema transaction request created successfully', credDefRequest: 'Credential definition transaction request created successfully', sign: 'Endorsement request approved', - submit: 'Endorsement request submitted to ledger', + submit: 'Endorsement request is submitted to ledger', + submitNoLedgerSchema: 'Endorsement request is submitted', invitationReject: 'Ecosystem invitation rejected', invitationAccept: 'Ecosystem invitation accepted successfully', deleteEcosystemMember: 'You are deleted as a ecosystem member', @@ -482,7 +467,8 @@ export const ResponseMessages = { invalidAgentUrl: 'Invalid agent url', EndorsementTransactionNotFoundException: 'Endorsement transaction with status requested not found', OrgOrEcosystemNotFoundExceptionForEndorsementTransaction: 'The endorsement transaction status cant be updated', - ecosystemOrgAlready: 'Organization is already part of the ecosystem. Please ensure that the organization is not duplicated.', + ecosystemOrgAlready: + 'Organization is already part of the ecosystem. Please ensure that the organization is not duplicated.', updateSchemaId: 'Error while updating the schema id', updateCredDefId: 'Error while updating the credential-definition', invalidMessage: 'Invalid transaction details. Missing "message" property.', @@ -523,22 +509,19 @@ export const ResponseMessages = { }, webhook: { success: { - webhookUrlRegister:'Webhook Url registered successfully', - getWebhookUrl:'Webhook Url fetched successfully' + webhookUrlRegister: 'Webhook Url registered successfully', + getWebhookUrl: 'Webhook Url fetched successfully' }, error: { - registerWebhook:'Unable to register a webhook url', - webhookResponse:'Error in sending webhook response to org webhook url', - notFound:'Webhook url not found' + registerWebhook: 'Unable to register a webhook url', + webhookResponse: 'Error in sending webhook response to org webhook url', + notFound: 'Webhook url not found' } }, shorteningUrl: { success: { - getshorteningUrl:'Shortening Url fetched successfully', + getshorteningUrl: 'Shortening Url fetched successfully', createShorteningUrl: 'Shortening Url created successfully' - }, - error: { - deepLinkDomainNotFound: 'Deeplink Domain not found. Please make sure to add it in your environment variables' } }, notification: { @@ -566,39 +549,5 @@ export const ResponseMessages = { stateNotFound: 'No states found for provided countryId.Please provide valid countryId', citiesNotFound: 'No cities found for provided stateId and countryId.Please provide valid stateId and countryId' } - }, - cloudWallet: { - success: { - create: 'Cloud wallet created successfully', - receive:'Received invitation successfully', - configureBaseWallet: 'Successfully configure the base wallet.', - acceptProofRequest: 'Proof request has been successfully accepted.', - createConnection: 'Connection created successfully.', - basicMessage: 'Basic message send successfully', - getProofById: 'Proof presentation has been successfully received.', - getProofPresentation: 'Proof presentations has been successfully received.', - didList: 'DID list fetched sucessfully', - connectionById: 'Connection record fetched successfully', - credentials: 'Credentials fetched successfully', - credentialByRecordId: 'Credential fetched successfully', - connectionList: 'Connection list fetched successfully', - basicMessageByConnectionId: 'Basic message fetched successfully' - }, - error: { - baseWalletNotFound: 'Base wallet configuration not found', - createCloudWallet: 'Error while creating cloud wallet on agent', - encryptCloudWalletKey: 'Error while creating encrypting wallet key', - userExist: 'Wallet already exist for the user', - walletNotExist: 'Wallet not exist for the user', - agentDetails: 'Invalid agent details', - agentNotRunning: 'Agent is not up and running', - receiveInvitation: 'Error while receiving invitation by url', - AcceptOffer: 'Error while invitation by url', - notReachable: 'The agent endpoint is not reachable.', - agentAlreadyExist: 'Agent already exist.', - platformAdminRecordNotFound: 'Platform admin reocrd not exist.', - notFoundBaseWallet: 'The base wallet record is missing.', - walletRecordNotFound: 'Wallet record not found.' - } } };