private void Charges(double diffPrice, ActualPriceObject newPrice, double actualPrice)
        {
            string description = string.Format("Update Check-In Date {0} - {1} - {2} - {3:MMM dd, yyyy}",
                                               ProductTypeTrackString,
                                               PublicProduct.ProductName,
                                               PublicHotel.HotelName, DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId));
            StripeCharge stripeCharge = CreateCharges(diffPrice, PublicCustomerInfos.StripeCustomerId,
                                                      description);

            var chargeInvoice = new Invoices
            {
                BookingId          = PublicBooking.BookingId,
                PassStatus         = PublicBooking.PassStatus,
                StripeChargeId     = stripeCharge.Id,
                ChargeAmount       = diffPrice,
                CreatedDate        = DateTime.UtcNow,
                CreatedBy          = PublicCustomerInfos.CustomerId,
                InvoiceStatus      = (int)Enums.InvoiceStatus.Charge,
                HotelPrice         = actualPrice,
                MerchantPrice      = newPrice.Price,
                Quantity           = PublicBooking.Quantity,
                RefundAmount       = 0,
                StripeRefundId     = string.Empty,
                StripeRefundStatus = string.Empty,
                TotalPrice         = PublicBooking.TotalPrice + diffPrice
            };

            _bookingRepository.AddInvoices(chargeInvoice, string.Empty);
        }
        private void MaintainOldInvoices(Bookings booking)
        {
            var chargeInvoice = new Invoices
            {
                BookingId          = booking.BookingId,
                PassStatus         = booking.PassStatus,
                StripeChargeId     = booking.StripeChargeId,
                ChargeAmount       = booking.TotalPrice,
                CreatedDate        = DateTime.UtcNow,
                CreatedBy          = PublicCustomerInfos != null ?  PublicCustomerInfos.CustomerId : 1,
                HotelPrice         = booking.HotelPrice,
                InvoiceStatus      = (int)Enums.InvoiceStatus.Charge,
                MerchantPrice      = booking.MerchantPrice,
                Quantity           = booking.Quantity,
                RefundAmount       = 0,
                StripeRefundId     = string.Empty,
                StripeRefundStatus = string.Empty,
                TotalPrice         = booking.TotalPrice
            };

            _bookingRepository.AddInvoices(chargeInvoice, string.Empty);

            if (!string.IsNullOrEmpty(booking.StripeRefundTransactionId))
            {
                double refundAmount = booking.StripeRefundAmount.HasValue
                    ? booking.StripeRefundAmount.Value
                    : 0;
                var refundInvoice = new Invoices
                {
                    BookingId          = booking.BookingId,
                    PassStatus         = booking.PassStatus,
                    StripeChargeId     = string.Empty,
                    ChargeAmount       = 0,
                    CreatedDate        = DateTime.UtcNow,
                    CreatedBy          = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 1,
                    HotelPrice         = booking.HotelPrice,
                    InvoiceStatus      = refundAmount >= booking.TotalPrice * 100 ? (int)Enums.InvoiceStatus.FullRefund : (int)Enums.InvoiceStatus.PartialRefund,
                    MerchantPrice      = booking.MerchantPrice,
                    Quantity           = booking.Quantity,
                    RefundAmount       = (double)refundAmount / 100,
                    StripeRefundId     = booking.StripeRefundTransactionId,
                    StripeRefundStatus = booking.StripeRefundStatus,
                    TotalPrice         = booking.TotalPrice
                };
                _bookingRepository.AddInvoices(refundInvoice, string.Empty);
            }

            booking.StripeChargeId            = string.Empty;
            booking.StripeRefundAmount        = 0;
            booking.StripeRefundStatus        = string.Empty;
            booking.StripeRefundTransactionId = string.Empty;
            booking.HasInvoice = true;
            _bookingRepository.UpdateStatus(new List <Bookings> {
                booking
            });
        }