diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts
index c56604bbb..1428ca1d1 100644
--- a/apps/verification/src/verification.service.ts
+++ b/apps/verification/src/verification.service.ts
@@ -1,5 +1,5 @@
/* eslint-disable camelcase */
-import { BadRequestException, HttpException, Inject, Injectable, InternalServerErrorException, Logger, NotFoundException } from '@nestjs/common';
+import { BadRequestException, HttpException, HttpStatus, Inject, Injectable, InternalServerErrorException, Logger, NotFoundException } from '@nestjs/common';
import { ClientProxy, RpcException } from '@nestjs/microservices';
import { map } from 'rxjs/operators';
import { IGetAllProofPresentations, IProofRequestSearchCriteria, IGetProofPresentationById, IProofPresentation, IProofRequestPayload, IRequestProof, ISendProofRequestPayload, IVerifyPresentation, IVerifiedProofData, IInvitation } from './interfaces/verification.interface';
@@ -454,8 +454,8 @@ export class VerificationService {
}
if (emailId) {
- await this.sendEmailInBatches(payload, emailId, getAgentDetails, getOrganization);
- return true;
+ const emailResponse = await this.sendEmailInBatches(payload, emailId, getAgentDetails, getOrganization);
+ return emailResponse;
} else {
const presentationProof: IInvitation = await this.generateOOBProofReq(payload);
const proofRequestInvitationUrl: string = presentationProof.invitationUrl;
@@ -498,13 +498,16 @@ export class VerificationService {
// Currently batch size is not used, as length of emails sent is restricted to '10'
- async sendEmailInBatches(payload: IProofRequestPayload, emailIds: string[], getAgentDetails: org_agents, organizationDetails: organisation): Promise {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ async sendEmailInBatches(payload: IProofRequestPayload, emailIds: string[], getAgentDetails: org_agents, organizationDetails: organisation): Promise {
try {
const accumulatedErrors = [];
+ const accumulatedResponse = [];
for (const email of emailIds) {
try {
- await this.sendOutOfBandProofRequest(payload, email, getAgentDetails, organizationDetails);
+ const response = await this.sendOutOfBandProofRequest(payload, email, getAgentDetails, organizationDetails);
+ accumulatedResponse.push({email, ...response});
await this.delay(500);
} catch (error) {
this.logger.error(`Error sending email to ${email}::::::`, error);
@@ -517,6 +520,8 @@ export class VerificationService {
throw new Error(ResponseMessages.verification.error.emailSend);
}
+ return accumulatedResponse;
+
} catch (error) {
this.logger.error('[sendEmailInBatches] - error in sending email in batches');
throw new Error(ResponseMessages.verification.error.batchEmailSend);
@@ -525,8 +530,9 @@ export class VerificationService {
// This function is specifically for OOB verification using email
- async sendOutOfBandProofRequest(payload: IProofRequestPayload, email: string, getAgentDetails: org_agents, organizationDetails: organisation): Promise {
- const getProofPresentation = await this._sendOutOfBandProofRequest(payload);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ async sendOutOfBandProofRequest(payload: IProofRequestPayload, email: string, getAgentDetails: org_agents, organizationDetails: organisation): Promise {
+ const getProofPresentation = await this._sendOutOfBandProofRequest(payload);
if (!getProofPresentation) {
throw new Error(ResponseMessages.verification.error.proofPresentationNotFound);
@@ -564,7 +570,11 @@ export class VerificationService {
throw new Error(ResponseMessages.verification.error.emailSend);
}
- return isEmailSent;
+ return {
+ isEmailSent,
+ outOfBandRecordId: getProofPresentation?.response?.outOfBandRecord?.id,
+ proofRecordThId: getProofPresentation?.response?.proofRecordThId
+ };
}
@@ -975,9 +985,14 @@ export class VerificationService {
verificationErrorHandling(error): void {
if (!error && !error?.status && !error?.status?.message && !error?.status?.message?.error) {
-
throw new RpcException(error.response ? error.response : error);
} else {
+ if (error?.message) {
+ throw new RpcException({
+ message: error?.message,
+ statusCode: HttpStatus.INTERNAL_SERVER_ERROR
+ });
+ }
throw new RpcException({
message: error?.status?.message?.error?.reason ? error?.status?.message?.error?.reason : error?.status?.message?.error,
statusCode: error?.status?.code
diff --git a/apps/verification/templates/out-of-band-verification.template.ts b/apps/verification/templates/out-of-band-verification.template.ts
index df33d0d68..8f9f38323 100644
--- a/apps/verification/templates/out-of-band-verification.template.ts
+++ b/apps/verification/templates/out-of-band-verification.template.ts
@@ -1,6 +1,6 @@
export class OutOfBandVerification {
- public outOfBandVerification(email: string, orgName: string, deeplLinkURL: string): string {
+ public outOfBandVerification(email: string, orgName: string, deepLinkURL: string): string {
try {
return `
@@ -37,35 +37,29 @@ export class OutOfBandVerification {
Hello ${email},
- ${orgName} has requested verification of your digital credential. To share requested credential kindly follow below steps:
+ ${orgName} has requested verification of your digital credential. To share the requested credentials, kindly follow the steps below:
- Download the ${process.env.MOBILE_APP_NAME} from
Android Play Store or
iOS App Store. (Skip, if already downloaded)
- - Complete the onboarding process in ${process.env.MOBILE_APP}.
- - Open the “Share Credential” link below in this email (This will open the link in the ${process.env.MOBILE_APP} App)
- - Tap the "Send Proof" button in ${process.env.MOBILE_APP} to share you credential data.
+ - Complete the onboarding process on ${process.env.MOBILE_APP}.
+ - Click on “Share Credential” button below in this email (This will redirect you to the ${process.env.MOBILE_APP} App)
+ - Tap the "Share" button on ${process.env.MOBILE_APP} to share your credentials.
- Note: If the above steps do not work for you, please open the attached QR Code image in this email on another device, and scan the QR code using the ${process.env.MOBILE_APP_NAME} on your mobile device.
+ Note: Alternatively, you will find a QR Code image attached to this email. You can open the QR code on another device and scan the QR code using the ${process.env.MOBILE_APP} App on your mobile device.
The QR Code is single-use.
-