diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e56cc21..cee94e8 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -14,14 +14,14 @@ const routes: Routes = [ { path: 'home', component: HomeComponent }, { path: 'abm-imagenes', component: AmbImagenesComponent }, { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent }, + { path: 'pago', component: PagoComponent }, { path: 'cancelar-compra', component: CancelarCompraComponent }, { path: '', component: MasterComponent, children: [ { path: 'inicio', component: InicioComponent }, - { path: 'busqueda-productos', component: BusquedaProductosComponent }, - { path: 'pago', component: PagoComponent } + { path: 'busqueda-productos', component: BusquedaProductosComponent } ] }, { path: '**', redirectTo: '/home', pathMatch: 'full' }, diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html index 0ca15ac..23a2a9a 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html @@ -89,7 +89,7 @@ Volver - + Finalizar y Pagar diff --git a/src/app/components/pago/pago.component.html b/src/app/components/pago/pago.component.html index 2b22e06..753a83e 100644 --- a/src/app/components/pago/pago.component.html +++ b/src/app/components/pago/pago.component.html @@ -1,5 +1,7 @@ + + @@ -14,23 +16,53 @@ Mi Compra - Seleccione medio de pago + Seleccione medio de pago + Escane QR - - Pago con tarjeta de débito/crédito - - - + + + Mercado Pago - + Pago con QR mercado pago + + + + + + + + + Volver + + + + Finalizar y Pagar + + + + Cancelar + + + + + + + + diff --git a/src/app/components/pago/pago.component.ts b/src/app/components/pago/pago.component.ts index 7c192fc..0c11823 100644 --- a/src/app/components/pago/pago.component.ts +++ b/src/app/components/pago/pago.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { appSettings } from 'src/etc/AppSettings'; +import { ProductoService } from 'src/app/services/producto.service'; +import { RouterLink } from '@angular/router'; @Component({ selector: 'app-pago', @@ -9,10 +11,25 @@ import { appSettings } from 'src/etc/AppSettings'; export class PagoComponent implements OnInit { private apiUrl: string = appSettings.apiUrl; + private verQR: boolean = false; - constructor() { } + constructor(private productoService: ProductoService) { } ngOnInit() { } + pagar() { + + this.verQR = true; + alert('Procesando Pago'); + + this.productoService.pagar() + .subscribe(() => { + alert('Compra finalizada'); + }, err => { + console.log(err); + alert('algo salió mal'); + }) + } + } diff --git a/src/app/services/producto.service.ts b/src/app/services/producto.service.ts index f72c7ab..fd6cccb 100644 --- a/src/app/services/producto.service.ts +++ b/src/app/services/producto.service.ts @@ -47,4 +47,10 @@ export class ProductoService { return this.http.get(`${appSettings.apiUrl}/categorias`); } + pagar() { + return this.http.post(`${appSettings.apiUrl}/comprobante/guardar`, { + productos: this.productos + }); + } + }