public static BookingSource FromBooking(Booking booking, BookingPax[] pax, PaymentSummary payment) { return(new BookingSource { Reference = booking.Reference, FirstName = booking.FirstName, LastName = booking.LastName, Email = booking.Email, PhoneNo = booking.PhoneNo, TeamName = booking.TeamName, SpecialRequest = booking.SpecialRequest, InternalNotes = booking.InternalNotes, Discount = booking.Discount, ConfirmationSent = booking.ConfirmationSent, Pax = pax.Select(p => new PaxSource { FirstName = p.FirstName, LastName = p.LastName, Gender = p.Gender.ToString(), Dob = p.Dob.ToString(), Food = p.Food, CabinClassMin = p.CabinClassMin, CabinClassPreferred = p.CabinClassPreferred, CabinClassMax = p.CabinClassMax, }).ToList(), Payment = payment }); }
public ActionResult ChangeAmount(ChangeAmountModel model) { if ((model.AccountTransactionType == AccountTransactionType.Withdrawn || model.AccountTransactionType == AccountTransactionType.Reduction) && model.NewAmount > model.CurrentAmount) { return(Json(new { IsValid = false, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = "New Amount cannot be more than the Current Amount." })); } model.TerminalName = "IMS"; model.ApprovedDate = DateTime.Now; model.ReferenceTransactionType = ReferenceTransactionType.Representation; try { var fineService = new FineService(AuthenticatedUser.SessionToken); fineService.ChangeAmount(model); PaymentSummary paymentSummary = Session["PaymentSummary"] as PaymentSummary; paymentSummary.Fines.Single(f => f.ReferenceNumber == model.ReferenceNumber).OutstandingAmount = model.NewAmount; Session["PaymentSummary"] = paymentSummary; return(Json(new { IsValid = true, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = string.Empty })); } catch (GatewayException ex) { return(Json(new { IsValid = false, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = ex.Message })); } }
public PaymentForm(long oid_agente, PaymentSummary summary, bool isModal, Form parent) : base(oid_agente, new object[1] { summary }, isModal, parent) { InitializeComponent(); }
protected override void SetRowFormat(DataGridViewRow row) { if (row.IsNewRow) { return; } if (!row.Displayed) { return; } PaymentSummary item = row.DataBoundItem as PaymentSummary; if (item == null) { return; } if (item.Pendiente > 0) { row.Cells[Pendiente.Index].Style = Common.ControlTools.Instance.PendienteStyleC; } else { row.Cells[Pendiente.Index].Style = Common.ControlTools.Instance.CobradoStyle; } }
public virtual void ShowPagosAction() { PaymentSummary item = PaymentSummary.Get((ETipoAcreedor)ActiveItem.TipoAcreedor, ActiveItem.OidAcreedor); PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidAcreedor, item); form.ShowDialog(this); }
public JsonResult CreatePurchase(string nonce) { // Use payment method nonce here Result <Transaction> result = CreateBraintreeTransaction(nonce); PaymentSummary PaymentSummary = new PaymentSummary(result); if (!result.IsSuccess()) { string errormessage = string.Empty; //add some logging if (result.Transaction.Status == TransactionStatus.GATEWAY_REJECTED) { errormessage = "Gateway rejected." + result.Transaction.GatewayRejectionReason; } if (result.Errors.DeepCount > 0) { foreach (ValidationError error in result.Errors.DeepAll()) { if (errormessage.Equals(string.Empty)) { errormessage = error.Message; } else { errormessage = ";" + errormessage; } } } PaymentSummary.Errors = errormessage; } //return payment summary details return(Json(PaymentSummary)); }
public void CreatePayslipSummary_Payslip_ReturnExpectedResult( string firstName, string lastName, string paymentStartDate, decimal annualSalary, decimal superRate, string expectedPayPeriod, decimal expectedGrossIncome, decimal expectedIncomeTax, decimal expectedNetIncome, decimal expectedSuper) { var paymentSummary = new PaymentSummary() { EmployeeInfo = new Employee() { FirstName = firstName, LastName = lastName }, PaymentStartDate = DateTime.Parse(paymentStartDate), AnnualSalary = annualSalary, SuperRate = superRate }; var payslip = _payslipService.CreatePayslipSummary(paymentSummary); Assert.NotNull(payslip); Assert.Equal(firstName, payslip.EmployeeInfo.FirstName); Assert.Equal(lastName, payslip.EmployeeInfo.LastName); Assert.Equal(expectedPayPeriod, payslip.PayPeriod); Assert.Equal(expectedGrossIncome, payslip.GrossIncome); Assert.Equal(expectedIncomeTax, payslip.IncomeTax); Assert.Equal(expectedNetIncome, payslip.NetIncome); Assert.Equal(expectedSuper, payslip.Super); }
public ActionResult CourtPayment() { PaymentSummary paymentSummary = Session["PaymentSummary"] as PaymentSummary; ViewBag.Districts = AuthenticatedUser.UserData.Districts; return(View(paymentSummary)); }
public String Payment(UserCardInfo cardInfo) { int CargoPrice = 20; DateTime RecordDate = DateTime.Now; CartVM model = new CartVM(); ViewBag.Result = ""; ePayment.cc5payment payment = new ePayment.cc5payment { host = "host", name = "", password = "", clientid = "", orderresult = 0, cardnumber = cardInfo.CardNumber, expmonth = cardInfo.ExpMonth, expyear = cardInfo.ExpYear.ToString(), cv2 = cardInfo.SecurityNumber, currency = "949", chargetype = "Auth", ip = Request.ServerVariables["REMOTE_ADDR"], subtotal = model.Price.ToString(), taksit = "1" }; string bankasonuc = payment.processorder(); string bankaAppr = payment.appr; if (bankasonuc == "1") { if (bankaAppr == "Approved") { ViewBag.Result = "Ödeme işlemi başarıyla tamamlandı."; } else if (bankaAppr == "Declined") { ViewBag.Result = "Banka ödemeyi reddetti."; } else { ViewBag.Result = "Banka ile iletişim kurulamadı."; } } using (Db db = new Db()) { // Init DTO PaymentSummary dto = new PaymentSummary(); dto.CargoPrice = CargoPrice; dto.RecordDate = RecordDate; // Save DTO db.PaymentSummary.Add(dto); db.SaveChanges(); } return("Ödeme Başarılı.Onay Bekliyor" + "\n" + "Ödeme Tarihi:" + RecordDate + " " + "Kargo Ücreti" + CargoPrice + "TL"); }
public ActionResult DoPayment(PaymentSummary paymentSummary) { if (string.IsNullOrWhiteSpace(paymentSummary.PaymentReference)) { paymentSummary.PaymentReference = Guid.NewGuid().ToString(); } Session["PaymentSummary"] = paymentSummary; return(Json("OK")); }
public void GotoPagosAction() { if (ActiveItem.EEstado == moleQule.Base.EEstado.Anulado) { return; } PaymentEditForm form = new PaymentEditForm(this, ActiveOID, PaymentSummary.Get(ActiveItem.ETipoAcreedor, ActiveOID)); form.ShowDialog(this); }
public PaymentEditForm(Form parent, long oidAgent, PaymentSummary summary) : base(parent, oidAgent, summary) { InitializeComponent(); if (_entity != null) { SetFormData(); this.Text = Resources.Labels.PAGO_EDIT_TITLE + " " + _entity.Nombre.ToUpper(); } _mf_type = ManagerFormType.MFEdit; }
public async Task <Guid> CreateAsync(Booking booking) { PaymentSummary payment = await _paymentRepository.GetSumOfPaymentsByBookingAsync(booking); var deleted = DeletedBooking.FromBooking(booking, payment.Total); using (var db = DbUtil.Open()) { Guid id = await db.ExecuteScalarAsync <Guid>("insert into [DeletedBooking] ([CruiseId], [Reference], [FirstName], [LastName], [Email], [PhoneNo], [TotalPrice], [AmountPaid], [Created], [Updated]) output inserted.[Id] values (@CruiseId, @Reference, @FirstName, @LastName, @Email, @PhoneNo, @TotalPrice, @AmountPaid, @Created, @Updated)", new { CruiseId = deleted.CruiseId, Reference = deleted.Reference, FirstName = deleted.FirstName, LastName = deleted.LastName, Email = deleted.Email, PhoneNo = deleted.PhoneNo, TotalPrice = deleted.TotalPrice, AmountPaid = deleted.AmountPaid, Created = deleted.Created, Updated = deleted.Updated }); return(id); } }
public ActionResult SaleRegister() { PaymentSummary objPaymentSummary = new PaymentSummary(); try { if (Session["LoginUser"] != null) { string LoginPartyCode = (Session["LoginUser"] as User).PartyCode; } } catch (Exception ex) { } return(View(objPaymentSummary)); }
public async Task <IHttpActionResult> Get(string reference) { try { Event evnt = await _eventRepository.GetActiveAsync(); if (null == evnt) { return(NotFound()); } if (IsUnauthorized(reference)) { return(BadRequest("Request is unauthorized, or not logged in as the booking it's trying to read.")); } Booking booking = await _bookingRepository.FindByReferenceAsync(reference); if (null == booking) { return(NotFound()); } Event activeEvent = await _eventRepository.GetActiveAsync(); if (!AuthContext.IsAdmin && !booking.EventId.Equals(activeEvent?.Id)) { return(BadRequest("Request is unauthorized, or booking belongs to an inactive event.")); } BookingPax[] pax = await _bookingRepository.GetPaxForBookingAsync(booking); PaymentSummary payment = await _paymentRepository.GetSumOfPaymentsByBookingAsync(booking); BookingSource result = BookingSource.FromBooking(booking, pax, payment); if (!AuthContext.IsAdmin) { result.InternalNotes = null; // Do not leak internal notes to non-admins } return(this.OkNoCache(result)); } catch (Exception ex) { _log.Error(ex, $"An unexpected exception occurred while getting the booking with reference {reference}."); throw; } }
public ActionResult PaymentSummary() { PaymentSummary objPaymentSummary = new PaymentSummary(); try { if (Session["LoginUser"] != null) { objPaymentSummary.PaymentMode = objReportManager.GetPaymodeList(); string LoginPartyCode = (Session["LoginUser"] as User).PartyCode; } } catch (Exception ex) { } return(View(objPaymentSummary)); }
public async Task GivenBooking_WhenPaymentsRegistered_ShouldCalculateCorrectSummary() { var booking = await BookingRepositoryTest.GetNewlyCreatedBookingForTestAsync(); var repository = GetPaymentRepositoryForTest(); decimal amount1 = 409.27m, amount2 = 15000m, amount3 = -927.44m; await repository.CreateAsync(booking, amount1); await repository.CreateAsync(booking, amount2); await repository.CreateAsync(booking, amount3); PaymentSummary summary = await repository.GetSumOfPaymentsByBookingAsync(booking); Assert.AreEqual(amount1 + amount2 + amount3, summary.Total); Assert.AreNotEqual(DateTime.MinValue, summary.Latest); }
public void LineToPaymentSummary(string dataRow, string paymentId, bool isFirstLine) { decimal value = 0; var columns = dataRow.Split(','); // Skip Header if (isFirstLine) { if (!columns.Any(field => decimal.TryParse(field, out value))) { return; } } var paymentSummary = new PaymentSummary() { Id = paymentId, EmployeeInfo = new Employee() { FirstName = columns[0], LastName = columns[1] } }; if (decimal.TryParse(columns[2], out value)) { paymentSummary.AnnualSalary = value; } if (decimal.TryParse(columns[3], out value)) { paymentSummary.SuperRate = value; } DateTime dateTime; if (DateTime.TryParse(columns[4], out dateTime)) { paymentSummary.PaymentStartDate = dateTime; } PaymentSummaries.Add(paymentSummary); }
public async Task <IHttpActionResult> Get(string reference) { try { if (!AuthContext.IsAdmin && !String.Equals(AuthContext.UserName, reference, StringComparison.InvariantCultureIgnoreCase)) { return(BadRequest("Request is unauthorized, or not logged in as the booking it's trying to read.")); } Booking booking = await _bookingRepository.FindByReferenceAsync(reference); if (null == booking) { return(NotFound()); } Cruise activeCruise = await _cruiseRepository.GetActiveAsync(); if (!AuthContext.IsAdmin && !booking.CruiseId.Equals(activeCruise?.Id)) { return(BadRequest("Request is unauthorized, or booking belongs to an inactive cruise.")); } BookingCabinWithPax[] cabins = await _bookingRepository.GetCabinsForBookingAsync(booking); BookingProduct[] products = await _productRepository.GetProductsForBookingAsync(booking); PaymentSummary payment = await _paymentRepository.GetSumOfPaymentsByBookingAsync(booking); BookingSource result = BookingSource.FromBooking(booking, cabins, products, payment); if (!AuthContext.IsAdmin) { result.InternalNotes = null; // Do not leak internal notes to non-admins } return(this.OkNoCache(result)); } catch (Exception ex) { _log.Error(ex, $"An unexpected exception occurred while getting the booking with reference {reference}."); throw; } }
public async Task <IHttpActionResult> Pay(string reference, PaymentSource payment) { try { PaymentSummary summary = await _paymentsController.Pay(reference, payment, _bookingRepository.FindByReferenceAsync); if (payment.Amount != 0) { _log.Info($"Registered payment of {payment.Amount} kr for booking {reference}."); } return(Ok(summary)); } catch (NotFoundException) { return(NotFound()); } catch (Exception ex) { _log.Error(ex, $"An unexpected exception occurred while creating a payment for the booking with reference {reference}."); throw; } }
public override PayslipSummary CreatePayslipSummary(PaymentSummary payment) { var payslip = new PayslipSummary() { Id = $"Payslip_{PayslipType}_{payment.Id}", EmployeeInfo = payment.EmployeeInfo, PayPeriod = GetPayPeriod(payment.PaymentStartDate), GrossIncome = CalGrossIncome(payment.AnnualSalary), }; var incomeTax = CalIncomeTax(payment.AnnualSalary); if (incomeTax < 0) { LogService.LogError($"Cannot find tax formula for employee {payment.EmployeeInfo.FullName} {payment.AnnualSalary}."); return(null); } payslip.IncomeTax = incomeTax; payslip.NetIncome = CalNetIncome(payslip.GrossIncome, payslip.IncomeTax); payslip.Super = CalSuper(payslip.GrossIncome, payment.SuperRate); return(payslip); }
public void GoToSourceAction() { if (ActiveItem == null) { return; } if (ActiveItem.EEstado == EEstado.Anulado) { return; } switch (ActiveItem.ETipoMovimientoBanco) { case EBankLineType.Cobro: { switch (ActiveItem.ETipoTitular) { case ETipoTitular.Cliente: { ClienteInfo cliente = ClienteInfo.Get(ActiveItem.OidTitular, true); ChargeSummary item = ChargeSummary.Get(cliente); CobroEditForm form = new CobroEditForm(cliente.Oid, item, null, this); form.ShowDialog(this); } break; case ETipoTitular.Fomento: { ChargeInfo cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.Fomento, false); CobrosFomentoEditForm form = new CobrosFomentoEditForm(cobro, this); form.ShowDialog(this); } break; case ETipoTitular.REA: { ChargeInfo cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.REA, false); CobrosREAEditForm form = new CobrosREAEditForm(cobro, this); form.ShowDialog(); } break; } } break; case EBankLineType.PagoFactura: { ETipoAcreedor tipo = moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular); if ((new List <ETipoTitular> { ETipoTitular.TransportistaOrigen, ETipoTitular.TransportistaOrigen }).Contains(ActiveItem.ETipoTitular)) { TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTitular, moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular), false); tipo = transporter.ETipoAcreedor; } PaymentSummary item = PaymentSummary.Get(tipo, ActiveItem.OidTitular); PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidTitular, item); form.ShowDialog(this); } break; case EBankLineType.PagoGasto: { ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.OidTitular, ETipoPago.Gasto, this); form.ShowDialog(); } break; case EBankLineType.PagoNomina: { PaymentSummary item = PaymentSummary.Get(ETipoAcreedor.Empleado, ActiveItem.OidTitular); EmployeePaymentEditForm form = new EmployeePaymentEditForm(this, ActiveItem.OidTitular, item); form.ShowDialog(); } break; case EBankLineType.PagoPrestamo: { LoanPaymentEditForm form = new LoanPaymentEditForm(ActiveItem.OidTitular, ETipoPago.Prestamo, this); form.ShowDialog(); } break; case EBankLineType.Prestamo: { LoanEditForm form = new LoanEditForm(ActiveItem.OidTitular, this); form.ShowDialog(); } break; case EBankLineType.EntradaCaja: case EBankLineType.SalidaCaja: { CashLineInfo linea = CashLineInfo.Get(ActiveItem.OidOperacion); if (linea.OidCierre != 0) { CashCountEditForm form = new CashCountEditForm(linea.OidCierre, this); form.ShowDialog(); } else { CashEditForm form = new CashEditForm(linea.OidCaja, this); form.ShowDialog(); } } break; case EBankLineType.Traspaso: { TraspasoEditForm form = new TraspasoEditForm(ActiveItem.OidTitular, this); form.ShowDialog(); } break; case EBankLineType.ExtractoTarjeta: { CreditCardPaymentEditForm form = new CreditCardPaymentEditForm(ActiveItem.OidOperacion, ETipoPago.ExtractoTarjeta, this); form.Show(); } break; } }
public static BookingSource FromBooking(Booking booking, BookingCabinWithPax[] cabins, BookingProduct[] products, PaymentSummary payment) { return(new BookingSource { Reference = booking.Reference, FirstName = booking.FirstName, LastName = booking.LastName, Email = booking.Email, PhoneNo = booking.PhoneNo, Lunch = booking.Lunch, Discount = booking.Discount, InternalNotes = booking.InternalNotes, SubCruise = booking.SubCruise.ToString(), IsLocked = booking.IsLocked, Cabins = cabins.Select(c => new Cabin { TypeId = c.CabinTypeId, Pax = c.Pax.Select(p => new Pax { Group = p.Group, FirstName = p.FirstName, LastName = p.LastName, Gender = p.Gender.ToString(), Dob = p.Dob.ToString(), Nationality = p.Nationality.ToUpperInvariant(), Years = p.Years }).ToList() }).ToList(), Products = products.Select(p => new Product { TypeId = p.ProductTypeId, Quantity = p.Quantity }).ToList(), Payment = payment }); }
public PaymentForm(Form parent, long oidAgent, PaymentSummary summary) : this(oidAgent, summary, true, parent) { }
public abstract PayslipSummary CreatePayslipSummary(PaymentSummary payment);
public ActionResult CourtPayment(PaymentSummary model) { ViewBag.Districts = AuthenticatedUser.UserData.Districts; if (!ModelState.IsValid) { return(View(model)); } var paymentDate = DateTime.Now; if (!DateTime.TryParseExact(model.PaymentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out paymentDate)) { ModelState.AddModelError("PaymentDate", "Invalid Payment Date."); return(View(model)); } try { PaymentSummary cachedModel = Session["PaymentSummary"] as PaymentSummary; model.Fines = cachedModel.Fines; var paymentTransaction = new PaymentTransactionModel(); paymentTransaction.CredentialID = AuthenticatedUser.SessionData.CredentialID; paymentTransaction.CustomerContactNumber = model.MobileNumber; paymentTransaction.CustomerIDNumber = string.Empty; paymentTransaction.CustomerFirstName = model.FirstName; paymentTransaction.CustomerLastName = model.LastName; paymentTransaction.PaymentSource = model.PaymentMethod; paymentTransaction.Receipt = model.PaymentReference; paymentTransaction.ReceiptTimestamp = paymentDate; paymentTransaction.CourtID = model.CourtID; paymentTransaction.TerminalType = Core.Gateway.Models.Enums.TerminalType.InternalServer; paymentTransaction.TerminalUUID = "IMS"; paymentTransaction.Amount = model.Fines.Sum(f => f.OutstandingAmount).Value; paymentTransaction.PaymentTransactionItems = model.Fines.Select(f => new PaymentTransactionItemModel { ReferenceNumber = f.ReferenceNumber, Amount = f.OutstandingAmount.Value, TransactionToken = string.Empty, EntityReferenceTypeID = long.Parse(f.ReferenceNumber[1].ToString()), Description = "Notice issued." }) .ToList(); var paymentService = new PaymentService(AuthenticatedUser.SessionToken); var transactionToken = paymentService.RegisterPayment(paymentTransaction); var confirmedPayment = new ConfirmedPaymentModel(); confirmedPayment.CustomerContactNumber = model.MobileNumber; confirmedPayment.CustomerIDNumber = string.Empty; confirmedPayment.CustomerFirstName = model.FirstName; confirmedPayment.CustomerLastName = model.LastName; confirmedPayment.PaymentSource = model.PaymentMethod; confirmedPayment.Receipt = model.PaymentReference; confirmedPayment.TerminalType = Core.Gateway.Models.Enums.TerminalType.InternalServer; confirmedPayment.TerminalUUID = "IMS"; confirmedPayment.Amount = paymentTransaction.Amount; confirmedPayment.TransactionToken = transactionToken; paymentService.SettlePayment(confirmedPayment); Session.Remove("PaymentSummary"); return(RedirectToAction("Index")); } catch (GatewayException ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View(model)); } }
public EmployeePaymentForm(Form parent, long oidAgente, PaymentSummary summary) : this(oidAgente, summary, true, parent) { }
public PaymentUIForm(Form parent, long oidAgent, PaymentSummary summary) : base(parent, oidAgent, summary) { InitializeComponent(); }
public override void OpenEditForm() { switch (ActiveItem.ETipoPago) { case ETipoPago.Factura: { PaymentSummary item = PaymentSummary.Get((ETipoAcreedor)ActiveItem.TipoAgente, ActiveItem.OidAgente); PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidAgente, item); if (form.Entity != null) { form.Select(ActiveItem); AddForm(form); } item.CloseSession(); } break; case ETipoPago.Nomina: { if (ActiveItem.OidAgente == 0) { PayrollPaymentEditForm form = new PayrollPaymentEditForm(ActiveItem.Oid, ETipoPago.Nomina, this); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } else { PaymentSummary item = PaymentSummary.Get((ETipoAcreedor)ActiveItem.TipoAgente, ActiveItem.OidAgente); EmployeePaymentEditForm form = new EmployeePaymentEditForm(this, ActiveItem.OidAgente, item); if (form.Entity != null) { form.Select(ActiveItem); AddForm(form); } item.CloseSession(); } } break; case ETipoPago.Prestamo: { LoanPaymentEditForm form = new LoanPaymentEditForm(ActiveItem.Oid, ETipoPago.Prestamo, this); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } break; case ETipoPago.Fraccionado: { PagoFraccionadoEditForm form = new PagoFraccionadoEditForm(ActiveItem.Oid, ETipoPago.Fraccionado, this); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } break; case ETipoPago.ExtractoTarjeta: { CreditCardPaymentEditForm form = new CreditCardPaymentEditForm(ActiveItem.Oid, ETipoPago.ExtractoTarjeta, this); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } break; default: { ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.Oid, ActiveItem.ETipoPago, this); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } break; } }