Made the voucher calls more readable
This commit is contained in:
@ -5,7 +5,6 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../../core/error-logger.service';
|
||||
import { Bill, PrintType } from './bill';
|
||||
import { Table } from "../../core/table";
|
||||
import {ObjectUnsubscribedError} from "rxjs";
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
@ -79,7 +78,7 @@ export class VoucherService {
|
||||
}
|
||||
|
||||
receivePayment(id: string, amounts: { id: string; name: string; amount: number }[], updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('r', "").set('u', updateTable.toString())};
|
||||
const options = {params: new HttpParams().set('receive-payment', "").set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, amounts, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'receivePayment'))
|
||||
@ -87,16 +86,16 @@ export class VoucherService {
|
||||
}
|
||||
|
||||
moveTable(id: string, table: Table): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('m', table.id)};
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {}, options)
|
||||
const options = {params: new HttpParams().set('move-table', '')};
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {table:{id: table.id}}, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'moveTable'))
|
||||
);
|
||||
}
|
||||
|
||||
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('v', reason).set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {}, options)
|
||||
const options = {params: new HttpParams().set('void-bill', "").set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {reason: reason}, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'voidBill'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user