Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 25x 25x 25x 25x 25x 25x 3x 2x 1x 1x 1x 1x | import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, map, throwError } from 'rxjs';
import { DataRequestData } from 'ish-core/models/data-request/data-request.interface';
import { DataRequestMapper } from 'ish-core/models/data-request/data-request.mapper';
import { DataRequest, DataRequestConfirmation } from 'ish-core/models/data-request/data-request.model';
import { ApiService } from 'ish-core/services/api/api.service';
@Injectable({ providedIn: 'root' })
export class DataRequestsService {
constructor(private apiService: ApiService) {}
/**
* Confirmation of a GDPR data request with corresponding request id and hash.
*
* @param data The DataRequest model includes request id and hash.
* @returns The enriched DataRequest model includes additional response status and code of the request.
*/
confirmGDPRDataRequest(data: DataRequest): Observable<DataRequestConfirmation> {
if (!data) {
return throwError(() => new Error('confirmGDPRDataRequest() called without data body'));
}
const dataRequestHeaderV1 = new HttpHeaders()
.set('content-type', 'application/json')
.set('Accept', 'application/vnd.intershop.gdpr.v1+json');
return this.apiService
.put<DataRequestData>(
`gdpr-requests/${this.apiService.encodeResourceId(data.requestID)}/confirmations`,
{ hash: data.hash },
{ headers: dataRequestHeaderV1 }
)
.pipe(map(payload => DataRequestMapper.fromData(payload)));
}
}
|