Skip to content
Snippets Groups Projects
Commit 2fea530a authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #14565 TIME 0:10 add tmpUniqueId

parent f659f755
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import { tap, catchError } from 'rxjs/operators';
import { SignaturesContentService } from './signatures.service';
import { NotificationService } from '../service/notification.service';
import { of } from 'rxjs';
import { FunctionsService } from './functions.service';
@Injectable({
providedIn: 'root'
......@@ -18,9 +19,10 @@ export class ActionsService {
private latinisePipe: LatinisePipe,
public notificationService: NotificationService,
public signaturesService: SignaturesContentService,
private functionsService: FunctionsService
) { }
sendDocument(note: string, eSignature: any = null, signatureLength: any = null) {
sendDocument(note: string, eSignature: any = null, signatureLength: any = null, tmpUniqueId: string = null) {
return new Promise(async (resolve) => {
const signatures: any[] = [];
if (this.signaturesService.currentAction > 0) {
......@@ -85,6 +87,10 @@ export class ActionsService {
data.signatureLength = signatureLength;
}
if (!this.functionsService.empty(tmpUniqueId)) {
data.tmpUniqueId = tmpUniqueId;
}
this.http.put('../rest/documents/' + this.signaturesService.mainDocumentId + '/actions/' + this.signaturesService.currentAction, data)
.pipe(
tap((res: any) => {
......@@ -92,7 +98,8 @@ export class ActionsService {
const objSignData = {
hashDocument : res.dataToSign,
signatureContentLength : res.signatureContentLength,
signatureFieldName : res.signatureFieldName
signatureFieldName : res.signatureFieldName,
tmpUniqueId: res.tmpUniqueId
};
resolve(objSignData);
} else {
......
......@@ -101,7 +101,8 @@ export class SignatureMethodModalComponent implements OnInit {
console.log('hashDocumentHex', hashDocumentHex);
let hashSignature;
let hashSignature: any;
try {
hashSignature = await this.provider.subtle.sign(alg, this.privateKey, hashDocumentHex);
} catch (e) {
......@@ -110,7 +111,6 @@ export class SignatureMethodModalComponent implements OnInit {
return of(false);
}
console.log('hashSignature', hashSignature);
const objEsign = {
......@@ -141,10 +141,11 @@ export class SignatureMethodModalComponent implements OnInit {
async sendAndSign() {
let allSignaturesComplete: boolean = false;
let res: any = {};
while (!allSignaturesComplete) {
let signDocComplete: any = false;
while (signDocComplete === false) {
const res: any = await this.actionsService.sendDocument(this.note, this.certificate, this.signatureLength);
res = await this.actionsService.sendDocument(this.note, this.certificate, this.signatureLength, res.tmpUniqueId);
if (res === null) {
return false;
} else if (res !== false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment