Chore:
Deduplicated the settle options function for save/update/void/receive payment Ported: Void Receive payment
This commit is contained in:
@ -76,19 +76,24 @@ export class VoucherService {
|
||||
}
|
||||
}
|
||||
|
||||
receivePayment(id: string, amounts: { id: number; name: string; amount: number }[], name: string, updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('receive-payment', '').set('u', updateTable.toString())};
|
||||
receivePayment(
|
||||
id: string,
|
||||
amounts: { id: number; name: string; amount: number }[],
|
||||
name: string,
|
||||
updateTable: boolean
|
||||
): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(
|
||||
`${url}/${id}`, {name: name, amounts: amounts}, options
|
||||
`${url}/receive-payment/${id}`, {name: name, amounts: amounts}, options
|
||||
).pipe(
|
||||
catchError(this.log.handleError(serviceName, 'receivePayment'))
|
||||
);
|
||||
}
|
||||
|
||||
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('void-bill', '').set('u', updateTable.toString())};
|
||||
const options = {params: new HttpParams().set('reason', reason).set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(
|
||||
`${url}/${id}`, {reason: reason}, options
|
||||
`${url}/void-bill/${id}`, {}, options
|
||||
).pipe(
|
||||
catchError(this.log.handleError(serviceName, 'voidBill'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user