diff --git a/src/app/services/producto.service.ts b/src/app/services/producto.service.ts index c825683..237feb6 100644 --- a/src/app/services/producto.service.ts +++ b/src/app/services/producto.service.ts @@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { appSettings } from 'src/etc/AppSettings'; import { Producto } from '../wrappers/producto'; +import { ClienteService } from './cliente.service'; @Injectable({ providedIn: 'root' @@ -15,7 +16,7 @@ export class ProductoService { mostrar: string; esPromoPersonalizada: boolean = false; - constructor(private http: HttpClient) { } + constructor(private http: HttpClient, private clienteService: ClienteService) { } getProductoById(id): Observable { @@ -80,8 +81,20 @@ export class ProductoService { } pagar(medioPago: string) { - return this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { - productos: this.productos + + return new Observable((observer) => { + + this.clienteService.getClienteById(-1).subscribe(cliente => { + + this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { + productos: this.productos, + cliente: cliente + }).subscribe((data) => { + + observer.next(data); + observer.complete(); + }); + }); }); } diff --git a/src/etc/AppSettings ejemplo.ts b/src/etc/AppSettings ejemplo.ts index 9edd44b..ea89eb1 100644 --- a/src/etc/AppSettings ejemplo.ts +++ b/src/etc/AppSettings ejemplo.ts @@ -1,4 +1,5 @@ export const appSettings = { // apiUrl: 'http://10.231.45.117:4705/autoservicio', - // apiImagenes: 'http://10.231.45.117:4513/' + // apiImagenes: 'http://10.231.45.117:4513/', + // apiClientes: 'http://localhost:1515/clientes' };