protected override DriverResult Editor(OrderPart order, IUpdateModel updater, dynamic shapeHelper) { if (!_orchardServices.Authorizer.Authorize(OrderPermissions.ManageOrders, null, T("Cannot manage orders"))) { return(null); } if (updater != null) { var viewModel = new PaymentInfoViewModel(); updater.TryUpdateModel(viewModel, PaymentInfoPrefix, null, null); if (viewModel.EditTransactionId) { // I need to edit payment transaction id if changed. var transactionId = viewModel.TransactionId; if (transactionId != null) { var payment = _paymentService.GetPaymentByGuid(order.Charge?.TransactionId); if (!payment.TransactionId.Equals(transactionId, StringComparison.InvariantCultureIgnoreCase)) { var eventText = T("Transaction id changed from {0} to {1}", payment.TransactionId, transactionId); payment.TransactionId = transactionId; order.LogActivity(OrderPart.Event, eventText.Text, _orchardServices.WorkContext.CurrentUser?.UserName ?? "System"); } } } } return(Editor(order, shapeHelper)); }
public ActionResult PayByCash(string splrId) { try { var identity = (LoginIdentity)Thread.CurrentPrincipal.Identity; PaymentInfoViewModel paymentInfoVm = new PaymentInfoViewModel(); if (!string.IsNullOrEmpty(splrId)) { decimal dueAmount = 0m; decimal advanceAmount = 0m; string supplierName = ""; _supplierLedgerService.GetDueOrAdvanceAmountBySupplierIdWithSupplierName(splrId, out supplierName, out dueAmount, out advanceAmount); if (dueAmount > 0) { paymentInfoVm.DueAmount = dueAmount; } else if (advanceAmount > 0) { paymentInfoVm.AdvanceAmount = advanceAmount; } paymentInfoVm.TrackingNo = _paymentInfoService.GenerateTrackingNo(identity.CompanyId, identity.BranchId, "PaymentInfo"); paymentInfoVm.TransactionType = TransactionType.Cash.ToString(); paymentInfoVm.SupplierId = splrId; paymentInfoVm.SupplierName = supplierName; paymentInfoVm.CompanyId = identity.CompanyId; paymentInfoVm.BranchId = identity.BranchId; paymentInfoVm.TransactionDate = DateTime.Now; } return(View(paymentInfoVm)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
//GET protected override DriverResult Editor(OrderPart order, dynamic shapeHelper) { if (!_orchardServices.Authorizer.Authorize(OrderPermissions.ManageOrders, null, T("Cannot manage orders"))) { return(null); } PaymentRecord payment = _paymentService.GetPaymentByGuid(order.Charge?.TransactionId); return(ContentShape("Parts_Order_PaymentInfo", () => { if (payment == null) { return null; } var model = new PaymentInfoViewModel { PosName = payment.PosName, Reason = payment.Reason, Amount = payment.Amount, Currency = payment.Currency, UpdateDate = payment.UpdateDate, Success = payment.Success, Error = payment.Error, TransationId = payment.TransactionId, }; return shapeHelper.EditorTemplate( TemplateName: "Parts/Order.PaymentInfo", Model: model); })); }
public IActionResult PaymentInfo(PaymentInfoViewModel payInfo) { if (ModelState.IsValid) { HttpContext.Session.SetJson("PaymentInfo", payInfo); return(RedirectToAction("ReviewOrder")); } return(View()); }
public ActionResult ReceiveByBank(string phone, string cstmrId) { try { var identity = (LoginIdentity)Thread.CurrentPrincipal.Identity; PaymentInfoViewModel paymentInfoVM = new PaymentInfoViewModel(); string customerName = ""; decimal dueAmount = 0m; decimal advanceAmount = 0m; Customer customer = new Customer(); if (!string.IsNullOrEmpty(phone)) { _customerLedgerService.GetDueOrAdvanceAmountByCustomerPhoneWithCustomerIdName(phone, out cstmrId, out customerName, out dueAmount, out advanceAmount); if (dueAmount > 0) { paymentInfoVM.DueAmount = dueAmount; } if (advanceAmount > 0) { paymentInfoVM.AdvanceAmount = advanceAmount; } paymentInfoVM.TrackingNo = _paymentInfoService.GenerateTrackingNo(identity.CompanyId, identity.BranchId, "PaymentInfo"); paymentInfoVM.TransactionType = TransactionType.Bank.ToString(); paymentInfoVM.CustomerId = cstmrId; paymentInfoVM.CustomerName = customerName; paymentInfoVM.TransactionDate = DateTime.Now; paymentInfoVM.CompanyId = identity.CompanyId; paymentInfoVM.BranchId = identity.BranchId; } else if (!string.IsNullOrEmpty(cstmrId)) { _customerLedgerService.GetDueOrAdvanceAmountByCustomerIdWithCustomerName(cstmrId, out customerName, out dueAmount, out advanceAmount); if (dueAmount > 0) { paymentInfoVM.DueAmount = dueAmount; } if (advanceAmount > 0) { paymentInfoVM.AdvanceAmount = advanceAmount; } paymentInfoVM.TrackingNo = _paymentInfoService.GenerateTrackingNo(identity.CompanyId, identity.BranchId, "PaymentInfo"); paymentInfoVM.TransactionType = TransactionType.Bank.ToString(); paymentInfoVM.CustomerId = cstmrId; paymentInfoVM.CustomerName = customerName; paymentInfoVM.TransactionDate = DateTime.Now; paymentInfoVM.CompanyId = identity.CompanyId; paymentInfoVM.BranchId = identity.BranchId; } return(View(paymentInfoVM)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public IActionResult PaymentInfo(PaymentInfoViewModel model) { if (ModelState.IsValid) { HttpContext.Session.Set <string>("email", model.Email); return(View("Pay")); } return(View(model)); }
public ActionResult CashReturn(PaymentInfoViewModel paymentInfoVM) { try { _paymentInfoService.CashReturn(Mapper.Map <PaymentInfo>(paymentInfoVM)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/PaymentInfo/ReceiveIndex"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public JavaScriptResult PayByChequeEdit(PaymentInfoViewModel paymentInfoVm) { try { _paymentInfoService.PayByChequeUpdate(Mapper.Map <PaymentInfo>(paymentInfoVm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/PaymentInfo/PayIndex"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public ActionResult ReceiveByCheque(string companyId, string branchId, string cstmrId, string phone) { try { PaymentInfoViewModel paymentInfoVm = new PaymentInfoViewModel(); string customerName = ""; decimal dueAmount = 0m; decimal advanceAmount = 0m; Customer customer = new Customer(); if (!string.IsNullOrEmpty(phone)) { _customerLedgerService.GetDueOrAdvanceAmountByCustomerPhoneWithCustomerIdName(phone, out cstmrId, out customerName, out dueAmount, out advanceAmount); if (dueAmount > 0) { paymentInfoVm.DueAmount = dueAmount; } if (advanceAmount > 0) { paymentInfoVm.AdvanceAmount = advanceAmount; } paymentInfoVm.TrackingNo = _paymentInfoService.GenerateTrackingNo(companyId, branchId, "PaymentInfo"); paymentInfoVm.TransactionType = TransactionType.Cash.ToString(); paymentInfoVm.CustomerId = cstmrId; paymentInfoVm.CustomerName = customerName; paymentInfoVm.CompanyId = companyId; paymentInfoVm.BranchId = branchId; } else if (!string.IsNullOrEmpty(cstmrId)) { _customerLedgerService.GetDueOrAdvanceAmountByCustomerIdWithCustomerName(cstmrId, out customerName, out dueAmount, out advanceAmount); if (dueAmount > 0) { paymentInfoVm.DueAmount = dueAmount; } if (advanceAmount > 0) { paymentInfoVm.AdvanceAmount = advanceAmount; } paymentInfoVm.TrackingNo = _paymentInfoService.GenerateTrackingNo(companyId, branchId, "PaymentInfo"); paymentInfoVm.TransactionType = TransactionType.Cheque.ToString(); paymentInfoVm.CustomerId = cstmrId; paymentInfoVm.CustomerName = customerName; paymentInfoVm.CompanyId = companyId; paymentInfoVm.BranchId = branchId; } return(View(paymentInfoVm)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public ActionResult ReceiveByBank(PaymentInfoViewModel paymentInfoVm) { try { if (paymentInfoVm.Amount > 0) { _paymentInfoService.ReceiveByBank(Mapper.Map <PaymentInfo>(paymentInfoVm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/PaymentInfo/ReceiveIndex"}')")); } return(JavaScript($"ShowResult('{"Amount 0 is not valid value!"}','{"failure"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public async Task <IActionResult> Index([Bind] PaymentInfoViewModel paymentInfo) { if (ModelState.IsValid) { PaymentInfoRequest paymentInfoRequest = new PaymentInfoRequest() { AmountTrxn = paymentInfo.AmountTrxn, CardHolder = paymentInfo.CardHolder, CurrencyCode = paymentInfo.CurrencyCode, CardNo = paymentInfo.CardNo, FunctionCode = paymentInfo.FunctionCode }; PaymentInfoResponse paymentInfoResponse = await _paymentService.DoTransaction(_configuration["PaymentServiceBaseUrl"].ToString(), paymentInfoRequest); return(RedirectToAction("SuccessPayment", new { code = paymentInfoResponse.ApprovalCode })); } else { //TODO add view error message return(View()); } }
public IActionResult StudentPayment(PaymentInfoViewModel model) { var payment = new PaymentInformation(); payment.StudentId = model.StudentId; payment.TeacherId = model.TeacherId; payment.Price = model.Price; payment.Subject = model.Subject; payment.IsActive = true; if (model.CardNumber != null) { payment.CardNumber = model.CardNumber; } if (model.MonthExpiry != null) { payment.MonthExpiry = int.Parse(model.MonthExpiry); } if (model.YearExpiry != null) { payment.YearExpiry = int.Parse(model.YearExpiry); } if (model.Cvv != null) { payment.Cvv = int.Parse(model.Cvv); } var data = _dbContext.StudentPaymentInfos.Add(payment); var result = _dbContext.SaveChanges(); if (result > 0) { return(Ok("true")); } else { return(Ok("false")); } }
private IEnumerable <PaymentInfoViewModel> GetPaymentInfo(CommerceOrder commerceOrder) { foreach (var payment in commerceOrder.Payment) { var paymentInfo = new PaymentInfoViewModel(); if (payment is CommerceCreditCardPaymentInfo) { var creditCard = payment as CommerceCreditCardPaymentInfo; paymentInfo.CardType = creditCard.CardType; paymentInfo.CreditCardNumber = creditCard.CreditCardNumber; paymentInfo.CustomerName = creditCard.CustomerNameOnPayment; paymentInfo.ExpirationMonth = creditCard.ExpirationMonth; paymentInfo.ExpirationYear = creditCard.ExpirationMonth; paymentInfo.PaymentType = PaymentType.CreditCard; paymentInfo.Amount = creditCard.Amount; } else if (payment is GiftCardPaymentInfo) { var giftCard = payment as GiftCardPaymentInfo; paymentInfo.PaymentType = PaymentType.GiftCard; paymentInfo.GiftCardId = giftCard.PaymentMethodID; paymentInfo.Amount = giftCard.Amount; } else if (payment is FederatedPaymentInfo) { var federated = payment as FederatedPaymentInfo; paymentInfo.PaymentType = PaymentType.Federated; paymentInfo.Amount = federated.Amount; } else { continue; } yield return(paymentInfo); } }
//GET protected override DriverResult Editor(OrderPart order, dynamic shapeHelper) { if (!_orchardServices.Authorizer.Authorize(OrderPermissions.ManageOrders, null, T("Cannot manage orders"))) { return(null); } var shapes = new List <DriverResult>(); // PayentInfo PaymentRecord payment = _paymentService.GetPaymentByGuid(order.Charge?.TransactionId); shapes.Add(ContentShape("Parts_Order_PaymentInfo", () => { if (payment == null) { return(null); } var model = new PaymentInfoViewModel { PosName = payment.PosName, Reason = payment.Reason, Amount = payment.Amount, Currency = payment.Currency, UpdateDate = payment.UpdateDate, Success = payment.Success, Error = payment.Error, TransactionId = payment.TransactionId, EditTransactionId = false }; return(shapeHelper.EditorTemplate( TemplateName: "Parts/Order.PaymentInfo", Model: model, Prefix: PaymentInfoPrefix)); })); // Checkout policies var policyXElements = order.AdditionalElements .Where(el => CheckoutPolicySettingsPart.OrderXElementName .Equals(el.Name.ToString(), StringComparison.InvariantCultureIgnoreCase)); if (policyXElements.Any()) { var vm = new CheckoutPoliciesOrderViewModel(); vm.Policies.AddRange(policyXElements.Select(xel => { var partXel = xel.Element("PolicyTextInfoPart"); var pvm = new CheckoutPolicyOrderViewModel(); pvm.Accepted = bool.Parse(xel.Attribute("Accepted").Value); pvm.Mandatory = bool.Parse(partXel.Attribute("UserHaveToAccept").Value); pvm.AnswerDateUTC = DateTime.Parse(xel.Attribute("AnswerDate").Value).ToUniversalTime(); pvm.PolicyTextInfoPartId = int.Parse(xel.Attribute("PolicyTextId").Value); pvm.PolicyTextInfoPartVersionNumber = int.Parse(xel.Attribute("VersionNumber").Value); return(pvm); })); shapes.Add(ContentShape("Parts_Order_CheckoutPolicies", () => { return(shapeHelper.EditorTemplate( TemplateName: "Parts/Order.CheckoutPolicies", Model: vm)); })); } return(Combined(shapes.ToArray())); }
public ActionResult paymentinfo(int id) { Webmaster webmaster = db.Webmasters.Single(w=>w.Id==id); Earning earning = db.Earnings.Single(e=>e.WebmasterId == id); Payment payment = db.Payments.Single(p=>p.WebmasterId == id); PaymentInfoViewModel model = new PaymentInfoViewModel() { earning = earning,payment = payment,webmaster = webmaster}; TransactionLogViewModel.AddLog(User.Identity.Name + " has just view Payment Information of Webmaster: "+webmaster.Username, DateTime.Now); return View(model); }
public static PaymentInfoViewModel ToViewModel(this PaymentInfo model) { PaymentInfoViewModel result = new PaymentInfoViewModel(); result.PaymentInfoGuid = model.PaymentInfoGuid; result.PaymentInfoID = model.PaymentInfoID; result.AmazonToken = model.AmazonToken; return result; }