diff --git a/apps/verification/src/verification.service.ts b/apps/verification/src/verification.service.ts
index 9697481df..fda573ae0 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';
@@ -455,8 +455,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;
@@ -499,13 +499,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);
@@ -518,6 +521,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);
@@ -526,8 +531,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);
@@ -565,7 +571,11 @@ export class VerificationService {
throw new Error(ResponseMessages.verification.error.emailSend);
}
- return isEmailSent;
+ return {
+ isEmailSent,
+ outOfBandRecordId: getProofPresentation?.response?.outOfBandRecord?.id,
+ proofRecordThId: getProofPresentation?.response?.proofRecordThId
+ };
}
@@ -977,9 +987,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..3aa4ca672 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 `
@@ -45,27 +45,21 @@ export class OutOfBandVerification {
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.
+ Tap the "Share" button in ${process.env.MOBILE_APP} to share you credential data.
- 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.
-