public ActionResult PaymentsReceived() { List <CustomerPaymentModel> model = new List <CustomerPaymentModel>(); var paymentreceived = _boardService.GetPaymentReceived(_workContext.CurrentCustomer.Id); foreach (var ptos in paymentreceived) { CustomerPaymentModel cpmodel = new CustomerPaymentModel(); cpmodel.Id = ptos.Id; cpmodel.PayToCustomerId = ptos.PayToCustomerId; cpmodel.PayByCustomerId = ptos.PayByCustomerId; cpmodel.BitcoinAddress = ptos.BitcoinAddress; cpmodel.PaymentProcessor1 = ptos.PaymentProcessor1; cpmodel.PaymentProcessor2 = ptos.PaymentProcessor2; cpmodel.PaymentProcessor3 = ptos.PaymentProcessor3; cpmodel.PaymentProcessor4 = ptos.PaymentProcessor4; cpmodel.PaymentProcessor5 = ptos.PaymentProcessor5; cpmodel.Paymentdate = ptos.Paymentdate; cpmodel.Status = ptos.Status; cpmodel.PaymentProff = ptos.PaymentProff; cpmodel.Remarks = ptos.Remarks; cpmodel.Amount = ptos.Amount; cpmodel.BoardId = ptos.BoardId; cpmodel.Deleted = ptos.Deleted; cpmodel.PayToCustomerEmail = _customerService.GetCustomerById(ptos.PayToCustomerId).Email; //cpmodel.PayToCustomerName = ptos.Customer. cpmodel.PayByCustomerEmail = _customerService.GetCustomerById(ptos.PayByCustomerId).Email; //cpmodel.PayByCustomerName { get; set; } model.Add(cpmodel); } return(View(model)); }
private void saveButton_Click(object sender, EventArgs e) { if (DialogResult.OK == MessageBox.Show("Confirm?", "deleted", MessageBoxButtons.OKCancel)) { DateTime date = paymentDate.Value; string CustomrId = CustomerSL.Text; float amountpaied = Convert.ToSingle(amount.Text); CustomerPaymentModel customerPayment = new CustomerPaymentModel() { CustomerId = CustomrId, Amount = amountpaied, Date = date }; db.Payments.Add(customerPayment); var custoemrdb = db.Customers.FirstOrDefault(c => c.CustomerId.Equals(customerPayment.CustomerId)); if (custoemrdb == null) { MessageBox.Show("No customer Found"); } else { custoemrdb.AccountRecivable = custoemrdb.AccountRecivable - customerPayment.Amount; } db.SaveChanges(); CustomerList aCustomerListfrolm = new CustomerList(); this.Hide(); } }
private async Task CreatePayment() { try { ErrorMessage = ""; ErrorVisibility = "Collapsed"; if (ValidatePayment()) { CanPay = false; CustomerPaymentModel paymentData = new CustomerPaymentModel { FlatID = SelectedFlat.Id, CustomerID = Customer.ID, AggregateAmountReceived = AggregateAmountReceived, ExtraWorkTotal = ExtraWorkTotal, ExtraWorkReceived = ExtraWorkReceived, GSTReceived = GSTReceived, StampDutyBalance = StampDutyBalance, PaymentDate = PaymentDate, PaymentModeID = SelectedPaymentMode.ID, Remarks = Remarks, Status = false, CreatedOn = DateTime.Now, CreatedBy = ParentLayout.LoggedInUser.Name }; HttpResponseMessage result = await apiHelper.PostCustomerPayment(ParentLayout.LoggedInUser.Token, paymentData).ConfigureAwait(false); if (result.IsSuccessStatusCode) { MessageBox.Show($"Customer Payment Done Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information); await GetTransactions(); ClearFields(); //Application.Current.Dispatcher.Invoke((Action)delegate //{ // ClearFields(); //}); } else { MessageBox.Show("Error in payment", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } CanPay = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); CanPay = true; } }
public async Task <HttpResponseMessage> PostCustomerPayment(string token, CustomerPaymentModel paymentData) { try { httpClient.DefaultRequestHeaders.Clear(); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {token}"); using (HttpResponseMessage response = await httpClient.PostAsJsonAsync("/api/CustomerPayment", paymentData)) { return(response); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult AddressFormPopup(CustomerPaymentModel CustomerPaymentModel) { var model = new CustomerPaymentWithAddressModel { CustomerAddressEditModel = new CustomerAddressEditModel(), CustomerPaymentModel = CustomerPaymentModel }; //because a customer might not have any address, order creation will trigger an error, therefore let's allow customer to add an address model.CustomerAddressEditModel.Address.PrepareModel( address: null, excludeProperties: false, addressSettings: _addressSettings, localizationService: _localizationService, stateProvinceService: _stateProvinceService, addressAttributeService: _addressAttributeService, addressAttributeParser: _addressAttributeParser, loadCountries: () => _countryService.GetAllCountries()); return(View("mobSocial/Payment/AddressFormPopup", model)); }
public ActionResult PaymentsToSend() { List <CustomerPaymentModel> model = new List <CustomerPaymentModel>(); var btcaddress = _workContext.CurrentCustomer.GetAttribute <string>(SystemCustomerAttributeNames.BitcoinAddressAcc); if (btcaddress == "" || btcaddress == null) { ViewBag.ErrorMessage = "Please update your bitcoin address, before sending payment"; return(View(model)); } var paymenttosend = _boardService.GetPaymentToSend(_workContext.CurrentCustomer.Id); foreach (var ptos in paymenttosend) { CustomerPaymentModel cpmodel = new CustomerPaymentModel(); cpmodel.Id = ptos.Id; cpmodel.PayToCustomerId = ptos.PayToCustomerId; cpmodel.PayByCustomerId = ptos.PayByCustomerId; cpmodel.BitcoinAddress = ptos.BitcoinAddress; cpmodel.PaymentProcessor1 = ptos.PaymentProcessor1; cpmodel.PaymentProcessor2 = ptos.PaymentProcessor2; cpmodel.PaymentProcessor3 = ptos.PaymentProcessor3; cpmodel.PaymentProcessor4 = ptos.PaymentProcessor4; cpmodel.PaymentProcessor5 = ptos.PaymentProcessor5; cpmodel.Paymentdate = ptos.Paymentdate; cpmodel.Status = ptos.Status; cpmodel.PaymentProff = ptos.PaymentProff; cpmodel.Remarks = ptos.Remarks; cpmodel.Amount = ptos.Amount; cpmodel.BoardId = ptos.BoardId; cpmodel.Deleted = ptos.Deleted; cpmodel.PayToCustomerEmail = _customerService.GetCustomerById(ptos.PayToCustomerId).Email; //cpmodel.PayToCustomerName = ptos.Customer. cpmodel.PayByCustomerEmail = _customerService.GetCustomerById(ptos.PayByCustomerId).Email; //cpmodel.PayByCustomerName { get; set; } model.Add(cpmodel); } return(View(model)); }
public ActionResult PaymentFormPopup(CustomerPaymentModel Model) { if (!ModelState.IsValid) { return(null); } //first check if the customer has an address, otherwise first address form will be shown if (_workContext.CurrentCustomer.Addresses.Count == 0) { return(AddressFormPopup(Model)); } var BattleId = Model.BattleId; var BattleType = Model.BattleType; var PurchaseType = Model.PurchaseType; //TODO: Remove comment when picture battles are ready var battle = _videoBattleService.GetById(BattleId); // Model.BattleType == BattleType.Video ? _videoBattleService.GetById(Model.BattleId) : null; var model = new CustomerPaymentPublicModel { IsAmountVariable = PurchaseType == PurchaseType.SponsorPass || battle.CanVoterIncreaseVotingCharge, MinimumPaymentAmount = PurchaseType == PurchaseType.SponsorPass ? battle.MinimumSponsorshipAmount : battle.MinimumVotingCharge, PurchaseType = Model.PurchaseType }; //if purchase type is sponsor and customer is already a sponsor, he should not have a minimum amount criteria if (PurchaseType == PurchaseType.SponsorPass) { var sponsorshipOrders = _sponsorPassService.GetSponsorPassOrders(_workContext.CurrentCustomer.Id, BattleId, BattleType); if (sponsorshipOrders.Any()) { model.MinimumPaymentAmount = 1; } } IList <Order> orders; if (PurchaseType == PurchaseType.VoterPass) { //also check if there are any paid orders which haven't been used for voting yet? var passes = _voterPassService.GetPurchasedVoterPasses(_workContext.CurrentCustomer.Id, PassStatus.NotUsed); orders = passes.Count > 0 ? _orderService.GetOrdersByIds(passes.Select(x => x.VoterPassOrderId).ToArray()) : null; } else { //also check if there are any paid orders which haven't been used for sponsorship yet? var passes = _sponsorPassService.GetPurchasedSponsorPasses(_workContext.CurrentCustomer.Id, PassStatus.NotUsed); orders = passes.Count > 0 ? _orderService.GetOrdersByIds(passes.Select(x => x.SponsorPassOrderId).ToArray()) : null; } if (orders != null) { foreach (var order in orders) { model.CustomerPendingOrders.Add(new SelectListItem() { Text = "Order#" + order.Id + " (" + order.OrderTotal + ")", Value = order.Id.ToString() }); } } //let's get the payment methods for the logged in user var paymentMethods = _paymentMethodService.GetCustomerPaymentMethods(_workContext.CurrentCustomer.Id); foreach (var pm in paymentMethods) { model.CustomerPaymentMethods.Add(new SelectListItem() { Text = pm.NameOnCard + " (" + pm.CardNumberMasked + ")", Value = pm.Id.ToString() }); } //battle should not be complete before payment form can be opened return(battle.VideoBattleStatus == VideoBattleStatus.Complete ? null : PartialView("mobSocial/Payment/PaymentFormPopup", model)); }
public ActionResult Details(int?key, int JobRequestId) { //UserPermissionAction("Category", RoleAction.view.ToString(), operation, ShowMessage, MessageBody); //CheckPermission(); if (Session["UserId"] == null) { return(RedirectToAction("LogOn", "Account")); } if (key == 1) { Session["CurrentPageNumber"] = null; } if (Session["CurrentPageNumber"] == null) { ViewBag.currentPageNumber = 0; } else { ViewBag.currentPageNumber = Convert.ToInt32(Session["CurrentPageNumber"]); } int id = Convert.ToInt32(Session["UserId"].ToString()); if (id > 0) { var details = new JobDetails(); var job = _RequestService.GetRequest(JobRequestId); if (job != null) { Mapper.CreateMap <JobRequest, RequestModel>(); var model = Mapper.Map <JobRequest, RequestModel>(job); var category = _CategoryService.GetCategory(model.CategoryId); if (category != null) { details.CategoryName = category.Name; } if (job.IsPaid == true) { var customerpaymentdata = _CustomerPaymentService.GetCustomerPaymentByJobRequestId(JobRequestId); Mapper.CreateMap <CustomerPayment, CustomerPaymentModel>(); CustomerPaymentModel customerPaymentModel = Mapper.Map <CustomerPayment, CustomerPaymentModel>(customerpaymentdata); details.customerPaymentModel = customerPaymentModel; } List <Reviews> objReview = new List <Reviews>(); var reviews = _ReviewAndRatingService.GetReviewAndRatings().Where(r => r.JobRequestId == JobRequestId).ToList(); float rating = 0; foreach (var review in reviews) { Mapper.CreateMap <ReviewAndRating, Reviews>(); Reviews reviewModel = Mapper.Map <ReviewAndRating, Reviews>(review); rating += Convert.ToSingle(reviewModel.Rating); var customer = _CustomerService.GetCustomer(reviewModel.CustomerId); reviewModel.CustomerName = customer.FirstName + " " + customer.LastName; reviewModel.PhotoPath = customer.PhotoPath; reviewModel.ReviewAndRatingId = review.ReviewAndRatingId; objReview.Add(reviewModel); } // DealResponseModel.AverageRating = float.IsNaN(rating / reviews.Count()) ? 0 : (rating / reviews.Count()); details.Reviews = objReview; details.TotalReviews = reviews.Count(); //START:Get detail of job assign individual AgencyJob agencyJobData = _AgencyJobService.GetAgencyJobByJobRequest(JobRequestId); if (agencyJobData != null) { var agencydata = _AgencyIndividualService.GetAgencyIndividual(agencyJobData.AgencyIndividualId); if (agencydata == null) { var customerData = _CustomerService.GetCustomer(agencyJobData.AgencyIndividualId); Mapper.CreateMap <Customer, CustomerModel>(); CustomerModel agencyModel = Mapper.Map <Customer, CustomerModel>(customerData); details.customerModel = agencyModel; } else { Mapper.CreateMap <AgencyIndividual, AgencyIndividualModel>(); AgencyIndividualModel agencyModel = Mapper.Map <AgencyIndividual, AgencyIndividualModel>(agencydata); details.agencyIndividualModel = agencyModel; } } else { details.agencyIndividualModel = null; } //END:Get detail of job assign individual details.request = model; } return(View(details)); } else { return(RedirectToAction("LogOn", "Account")); } }