Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let fileName = file['webkitRelativePath'] ?
file['webkitRelativePath'] :
file.name;
// Replace folder separator with underline
fileName = fileName.replace(/\//g, '_');
fileName = fileName.replace(/\\/g, '_'); // Don't know about windows, but better be safe
// Add the file to the request.
formdata.append('attachment', file, fileName);
}
formdata.append('mid', '' + this.model.mid);
formdata.append('attach', 'Attach');
formdata.append('ajaxAttach', 'Attach');
this.http.request(new HttpRequest(
'POST', '/ajax/upload_attachment', formdata,
{ reportProgress: true , headers: new HttpHeaders({ 'ngsw-bypass': '1' }) }
)).subscribe((event) => {
if (event.type === HttpEventType.UploadProgress) {
const progress = event.loaded * 100 / event.total;
this.uploadprogress = progress === 100 ? null : progress;
} else if (event.type === HttpEventType.Response) {
if (!this.model.attachments) {
this.model.attachments = [];
}
(event.body as any).result.attachments
.forEach((att: any) => {
att.file = att.filename;
this.model.attachments.push(att);
});
pisDoneUsingGETResponse(params: PSUPISCancellationService.PisDoneUsingGETParams): __Observable<__StrictHttpResponse> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
if (params.forgetConsent != null) __params = __params.set('forgetConsent', params.forgetConsent.toString());
if (params.backToTpp != null) __params = __params.set('backToTpp', params.backToTpp.toString());
if (params.oauth2 != null) __params = __params.set('oauth2', params.oauth2.toString());
if (params.Cookie != null) __headers = __headers.set('Cookie', params.Cookie.toString());
let req = new HttpRequest(
'GET',
this.rootUrl + `/pis-cancellation/${params.encryptedPaymentId}/authorisation/${params.authorisationId}/done`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse;
})
);
}
constructor(public guid: string, public endpointGuid: string) {
super();
this.options = new HttpRequest(
'GET',
`stacks/${guid}`
);
}
actions = [
public uploadAttachments(files: File[], progressCallback?: (number) => void): Observable {
const formData: FormData = new FormData();
files.forEach((file) => formData.append('attachments', file));
const req = new HttpRequest('POST', `${Constance.UPLOAD_URL}/files`, formData, {
reportProgress: true
});
return this.uploadFile(req, progressCallback);
}
pisDoneUsingGET1Response(params: PSUPISService.PisDoneUsingGET1Params): __Observable<__StrictHttpResponse> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
if (params.forgetConsent != null) __params = __params.set('forgetConsent', params.forgetConsent.toString());
if (params.backToTpp != null) __params = __params.set('backToTpp', params.backToTpp.toString());
if (params.oauth2 != null) __params = __params.set('oauth2', params.oauth2.toString());
if (params.Cookie != null) __headers = __headers.set('Cookie', params.Cookie.toString());
let req = new HttpRequest(
'GET',
this.rootUrl + `/pis/${params.encryptedPaymentId}/authorisation/${params.authorisationId}/done`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse;
})
);
}
private _request(method: string, url: string, body?: any, httpHeaders?: HttpHeaders): Observable> {
if (!httpHeaders) {
httpHeaders = new HttpHeaders();
}
const httpRequest = new HttpRequest(method, url, body, {
headers: httpHeaders.set('x-feater-api-token', this._buildAuthHeader()),
});
return Observable.create((observer) => {
this.process.next(Action.QueryStart);
this._httpClient.request(httpRequest).pipe(
finalize(() => {
this.process.next(Action.QueryStop);
}))
.subscribe(
(res) => {
observer.next(res);
observer.complete();
},
(err) => {
switch (err.status) {
constructor(public guid: string, public endpointGuid: string) {
super();
this.options = new HttpRequest(
'DELETE',
`organizations/${guid}`,
{
params: new HttpHeaders({
recursive: 'true',
async: 'false'
})
}
);
}
actions = [DELETE_ORGANIZATION, DELETE_ORGANIZATION_SUCCESS, DELETE_ORGANIZATION_FAILED];
revokeConsentUsingDELETEResponse(params: PSUAISService.RevokeConsentUsingDELETEParams): __Observable<__StrictHttpResponse> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
if (params.Cookie != null) __headers = __headers.set('Cookie', params.Cookie.toString());
let req = new HttpRequest(
'DELETE',
this.rootUrl + `/ais/${params.encryptedConsentId}/${params.authorisationId}`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse;
})
);
}
constructor(
public guid: string,
public endpointGuid: string,
public includeRelations: string[] = [],
public populateMissing = true
) {
super();
this.options = new HttpRequest(
'GET',
`user_provided_service_instances/${guid}`
);
}
actions = getActions('User Provided Service', 'Get User Provided Service');
startConsentAuthUsingPOSTResponse(params: PSUAISService.StartConsentAuthUsingPOSTParams): __Observable<__StrictHttpResponse> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
__body = params.aisConsent;
if (params.Cookie != null) __headers = __headers.set('Cookie', params.Cookie.toString());
let req = new HttpRequest(
'POST',
this.rootUrl + `/ais/${params.encryptedConsentId}/authorisation/${params.authorisationId}/start`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse;
})
);
}