Exemplo n.º 1
0
        public ActionResult ProcessResultPaymentNPS(NPSPaymentModel model)
        {
            var    npsBLL        = new NpsBLL();
            string idTransaccion = string.Empty;
            float  importe;

            try{
                var rpta = npsBLL.ActualizarEstadoPago(model.psp_MerchTxRef);

                if (string.IsNullOrEmpty(rpta))
                {
                    using (var dc = new TurismoDataContext())
                    {
                        var moneda = dc.MonedaDBs.SingleOrDefault(m => m.DESCRIPCION == MapCurrencyFromNPS(SessionData.Reservation.LodgingCurrencyCode));
                        importe = (float)SessionData.Reservation.TotalAmount * moneda.COTIZACION;
                    }

                    if (new ServiceController().CompleteReservation(ref idTransaccion))
                    {
                        if (!string.IsNullOrEmpty(idTransaccion))
                        {
                            var response = npsBLL.CapturarTrx(model.psp_MerchTxRef, SessionData.Reservation.IdTransaccionNPS, idTransaccion, importe);

                            if (string.IsNullOrEmpty(response))
                            {
                                return(RedirectToAction("PaymentSuccess"));
                            }
                            else
                            {
                                return(View("PaymentError", new ErrorModel {
                                    Mensaje = response
                                }));
                            }
                        }
                        else
                        {
                            return(View("PaymentError", new ErrorModel {
                                Mensaje = "La reserva no pudo completarse"
                            }));
                        }
                    }
                    else
                    {
                        return(View("PaymentError", new ErrorModel {
                            Mensaje = "La reserva no pudo completarse"
                        }));
                    }
                }
                else
                {
                    return(View("PaymentError", new ErrorModel {
                        Mensaje = "La reserva no pudo completarse. Operación no autorizada"
                    }));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("PaymentError", new ErrorModel {
                    Mensaje = e.Message
                }));
            }
        }
Exemplo n.º 2
0
 public ActionResult BridgeProcessResultPaymentNPS(NPSPaymentModel model)
 {
     return(View(model));
 }