+ private buildResponsePayload(uuid: string): ResponsePayload {
+ const responsesStatus =
+ this.responses
+ .get(uuid)
+ ?.responses.every(({ status }) => status === ResponseStatus.SUCCESS) === true
+ ? ResponseStatus.SUCCESS
+ : ResponseStatus.FAILURE;
+ return {
+ status: responsesStatus,
+ hashIdsSucceeded: this.responses
+ .get(uuid)
+ ?.responses.filter(({ hashId }) => !Utils.isNullOrUndefined(hashId))
+ .map(({ status, hashId }) => {
+ if (status === ResponseStatus.SUCCESS) {
+ return hashId;
+ }
+ }),
+ ...(responsesStatus === ResponseStatus.FAILURE && {
+ hashIdsFailed: this.responses
+ .get(uuid)
+ ?.responses.filter(({ hashId }) => !Utils.isNullOrUndefined(hashId))
+ .map(({ status, hashId }) => {
+ if (status === ResponseStatus.FAILURE) {
+ return hashId;
+ }
+ }),
+ }),
+ ...(responsesStatus === ResponseStatus.FAILURE && {
+ responsesFailed: this.responses
+ .get(uuid)
+ ?.responses.filter((response) => !Utils.isNullOrUndefined(response))
+ .map((response) => {
+ if (response.status === ResponseStatus.FAILURE) {
+ return response;
+ }
+ }),
+ }),
+ };