Пример #1
0
 public dynamic createPayment(int guestID, string type, string method, decimal amount, string status, int resID = -1)
 {
     if (type == "PostCharge")
     {
         PostCharge charge = new PostCharge();
         charge.GuestId       = guestID;
         charge.PaymentMethod = method;
         charge.Amount        = amount;
         charge.Status        = status;
         return(charge);
     }
     else if (type == "ReservationInvoice")
     {
         ReservationInvoice invoice = new ReservationInvoice();
         invoice.ReservationId = resID;
         invoice.GuestId       = guestID;
         invoice.IssueDate     = DateTime.Now;
         invoice.PaymentMethod = method;
         invoice.Amount        = amount;
         invoice.Status        = status;
         return(invoice);
     }
     else
     {
         return(null);
     }
 }
Пример #2
0
        public void notifyCancellation(int resID, decimal price)
        {
            PaymentFactory factory = PaymentFactory.getInstance();
            Reservation    res     = _reservationservice.SearchByReservationId(resID);
            int            guestID = int.Parse(res.GetReservation()["guestID"].ToString());

            ReservationInvoice resInvoice =
                factory.createPayment(guestID: guestID, resID: resID, type: "ReservationInvoice",
                                      amount: price, status: "Outstanding", method: "");

            _invoiceGateway.insert(resInvoice);
        }
Пример #3
0
        public async Task <IHttpActionResult> SendFacturaAsync(ReservationInvoice reservationInvoice)
        {
            try
            {
                var reservationManager = new ReservationManagement();
                await reservationManager.SendInvoiceAsync(reservationInvoice);

                apiResponse = new ApiResponse();

                return(Ok(apiResponse));
            }
            catch (BussinessException bex)
            {
                return(InternalServerError(new Exception(bex.AppMessage.Message)));
            }
        }
        public async Task SendEmailWithFactura(User user, string qrCodeValue, ReservationInvoice reservationInvoice)
        {
            var correo = user.Correo;

            var client           = new SendGridClient("sendgrid_key");
            var from             = new EmailAddress("*****@*****.**", "Stay n'Chill");
            var subject          = "Código QR de Reservación";
            var to               = new EmailAddress(correo);
            var plainTextContent = "";

            var htmlContent = string.Format(@"
                <div style='text-align:center;'>
                    <div style='border-radius:20px 20px 0 0;display:inline-block;'>
                        <div style='letter-spacing:1px;font-family: monospace,sans-serif;border-radius:12px 12px 0 0;background-color: #5D78FF;'>
                            <p style='color:#FFF;font-size:1.5rem;padding:2rem 2rem 0 2rem;margin: 0;'>Código QR de Reservación</p>
                            <p style='color:#F2F2F2;font-size:1rem;padding:0 2rem 2rem 2rem;margin:0;'>Stay n'Chill</p>
                        </div>
                        <div style='border-right: 1px dashed #BEBEBE;border-bottom: 1px dashed #BEBEBE;border-left: 1px dashed #BEBEBE;'>
                            <img src='https://res.cloudinary.com/qubitscenfo/image/upload/v1564822446/" + $@"{qrCodeValue}" + @"' style='padding:2.5rem'>
                        </div>
                    </div>
                </div>










<div style='margin-top:5rem; max-width: 800px; margin: auto; padding: 30px; border: 1px solid #eee; box-shadow: 0 0 10px rgba(0, 0, 0, .15); font-size: 16px; line-height: 24px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #555; border-radius: 7px;'>
        <table cellpadding='0' cellspacing='0' style='width: 100%; line-height: inherit; text-align: left;'>
            <tr style='font-size: 45px;
            line-height: 45px;
            color: #333;padding-bottom: 40px;'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table style='width: 100%; line-height: inherit; text-align: left;'>
                        <tr>
                            <td  style='font-size: 45px;
                            line-height: 45px;
                            color: #333;padding: 5px; vertical-align: top;'>
                                <img src='https://res.cloudinary.com/qubitscenfo/image/upload/v1565417512/ckxg43ppvqlizl1mzzie.png' style='width:100%; max-width:300px;'>
                            </td>
                            
                            
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr class='information'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table>
                        
                    </table>
                </td>
            </tr>
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Método de Pago
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    PayPal
                </td>
            </tr>
            
            
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Item
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    Precio
                </td>
            </tr>
            
            <tr class='item'>
                <td style='padding: 5px; vertical-align: top;'>
                    Reservación
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    " + $@"{reservationInvoice.NombreHotel}" + @"
                </td>
            </tr>
            
            <tr class='total'>
                <td>
                    
                </td>
                <td>
                   Total: " + $@"{reservationInvoice.PrecioTotal}" + @"
                </td>
            </tr>
        </table>
    </div>");

            var msg      = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
            var response = await client.SendEmailAsync(msg);
        }
Пример #5
0
 public bool delete(ReservationInvoice reservationInvoice)
 {
     _context.ReservationInvoice.Remove(reservationInvoice);
     return(_context.SaveChanges() > 0 ? true : false);
 }
Пример #6
0
 public bool update(ReservationInvoice reservationInvoice)
 {
     _context.Update(reservationInvoice);
     return(_context.SaveChanges() > 0 ? true : false);
 }
Пример #7
0
 public bool insert(ReservationInvoice reservationInvoice)
 {
     _context.Add(reservationInvoice);
     return(_context.SaveChanges() > 0 ? true : false);
 }
        public async Task SendInvoice(ReservationInvoice reservationInvoice)
        {
            var correo = reservationInvoice.CorreoUsuario;

            var client           = new SendGridClient("sendgrid_key");
            var from             = new EmailAddress("*****@*****.**", "Stay n'Chill");
            var subject          = "Factura de Reservación";
            var to               = new EmailAddress(correo);
            var plainTextContent = "";

            var htmlContent = string.Format(@"<div style='max-width: 800px; margin: auto; padding: 30px; border: 1px solid #eee; box-shadow: 0 0 10px rgba(0, 0, 0, .15); font-size: 16px; line-height: 24px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #555; border-radius: 7px;'>
        <table cellpadding='0' cellspacing='0' style='width: 100%; line-height: inherit; text-align: left;'>
            <tr style='font-size: 45px;
            line-height: 45px;
            color: #333;padding-bottom: 40px;'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table style='width: 100%; line-height: inherit; text-align: left;'>
                        <tr>
                            <td  style='font-size: 45px;
                            line-height: 45px;
                            color: #333;padding: 5px; vertical-align: top;'>
                                <img src='https://res.cloudinary.com/qubitscenfo/image/upload/v1565417512/ckxg43ppvqlizl1mzzie.png' style='width:100%; max-width:300px;'>
                            </td>
                            
                            
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr class='information'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table>
                        
                    </table>
                </td>
            </tr>
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Método de Pago
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    PayPal
                </td>
            </tr>
            
            
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Item
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    Hotel
                </td>
            </tr>
            
            <tr class='item'>
                <td style='padding: 5px; vertical-align: top;'>
                    Reservación
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    " + $@"{reservationInvoice.NombreHotel}" + @"
                </td>
            </tr>
            
            <tr class='total'>
                <td>
                    
                </td>
                <td>
                   Total: " + $@"{reservationInvoice.PrecioTotal}" + @"
                </td>
            </tr>
        </table>
    </div>");

            var msg      = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
            var response = await client.SendEmailAsync(msg);
        }
 public async Task SendEmailWithFactura(User user, string qrCodeValue, ReservationInvoice reservationInvoice) => await crudQRCode.SendEmailWithFactura(user, qrCodeValue, reservationInvoice);
Пример #10
0
 public bool updatePayment(ReservationInvoice invoice)
 {
     return(_invoiceGateway.update(invoice));
 }
Пример #11
0
 public bool addPayment(ReservationInvoice invoice)
 {
     return(_invoiceGateway.insert(invoice));
 }
 public async System.Threading.Tasks.Task SendInvoiceAsync(ReservationInvoice reservationInvoice) => await reservationCrud.SendInvoice(reservationInvoice);