public CreditCardInfo(ProcessCreditCardViewModel processCreditCardViewModel) { FirstName = processCreditCardViewModel.FirstName; LastName = processCreditCardViewModel.LastName; StreetAddress = processCreditCardViewModel.BillingAddress.Street; City = processCreditCardViewModel.BillingAddress.City; State = processCreditCardViewModel.BillingAddress.State; ZIP = processCreditCardViewModel.BillingAddress.ZIP; CreditCardNumber = processCreditCardViewModel.CreditCardNumber; ExpirationDate = processCreditCardViewModel.ExpirationDate.Value; CVVCSCCode = processCreditCardViewModel.CSCCode; }
public ActionResult SubmitPayment(ProcessCreditCardViewModel viewModel) { var jsonResult = new JsonResultManager(Url); if (!IsTabAvailable(OrderCreationWizardTabOrder.OrderConfirmation, viewModel.OrderId)) { OrderCreationWizardTabOrder lastCompletedStep = GetOrderCreationLastCompletedStep(viewModel.OrderId); return Json(jsonResult.GetJsonResultObject(RedirectToStep(lastCompletedStep, viewModel.OrderId))); } string submitPaymentSessionKey = viewModel.OrderId.ToString(); if (ModelState.IsValid) { if (Session[submitPaymentSessionKey] == null) { Session[submitPaymentSessionKey] = "true"; var totalFee = (decimal)_orderService.GetFeeConfirmation(viewModel.OrderId).TotalFee; var result = _creditCardService.Pay(new CreditCardInfo(viewModel) { Amount = totalFee }, viewModel.OrderId); Session[submitPaymentSessionKey] = null; if (result.IsApproved) { _orderService.SaveProcessCreditCardInfo(viewModel, result.TransactionId, true); _orderService.UpdateOrderStatus(viewModel.OrderId, OrderStatus.PendingAssignment); SetLastCompletedStepAndStatus(OrderCreationWizardTabOrder.ProcessCreditCard, (int)OrderCreationWizardTabOrder.RequestConfirmation, viewModel.OrderId, false); CommitProviderInstance.Commit(); var configurationHelper = DependencyResolver.Current.GetService<DVS.Logic.Interfaces.IConfigs.IConfigurationHelper>(); if (configurationHelper.Environment != DVS.Model.Enums.DvsEnvironment.Local) { _taskManager.GenerateLOEDocument(viewModel.OrderId, SecurityContext.CurrentUser.Id); } return Json(jsonResult.GetJsonResultObject(RedirectToStep(OrderCreationWizardTabOrder.RequestConfirmation, viewModel.OrderId))); } else { TempData["AuthorizeErrorMessage"] = result.Message; TempData[_paymentConfirmationKey] = viewModel; return Json(jsonResult.ShowMessageResult(result.Message)); } } } TempData[_paymentConfirmationKey] = viewModel; return Json(jsonResult.GetJsonResultObject(RedirectToStep(OrderCreationWizardTabOrder.ProcessCreditCard, viewModel.OrderId))); }
public ActionResult ProcessCreditCard(ProcessCreditCardViewModel viewModel, int nextStep) { if (!IsStateValid(viewModel.BillingAddress.State)) { viewModel.BillingAddress.State = string.Empty; return View(NameHelper.OrderCreationWizard.ProcessCreditCard, viewModel); } var nextTab = SafeConvert.ToEnum<OrderCreationWizardTabOrder>(nextStep).Value; bool isSavePressed = IsSavePressed(nextTab, OrderCreationWizardTabOrder.ProcessCreditCard); _orderService.SaveProcessCreditCardInfo(viewModel, string.Empty); SetLastCompletedStepAndStatus(OrderCreationWizardTabOrder.ProcessCreditCard, nextStep, viewModel.OrderId, isSavePressed); CommitProviderInstance.Commit(); return isSavePressed ? RedirectToClientPipeline() : RedirectToStep(nextTab, viewModel.OrderId); }
private Guid GenerateOrderReport(ProcessCreditCardViewModel viewModel, string transactionId, string orderPublicNumber) { string creditCardName = _referenceManager.GetReference(ReferenceType.CreditCardTypes, false)[viewModel.CreditCardType.Value]; var pdfDocument = _reportManager.GetPropertyAppraisalReceiptReport( viewModel.OrderId, viewModel.FirstName, viewModel.LastName, creditCardName, transactionId, viewModel.BillingAddress.Street, viewModel.BillingAddress.ZIP, GetStateAbbreviation(viewModel.BillingAddress.State), viewModel.BillingAddress.City, ReportFormat.PDF); var encryptedDocument = _cryptographicProvider.Encrypt(pdfDocument); var documentInfo = new DocumentInfo() { AddedByUserId = _securityContext.CurrentUser.Id, DateAdded = DateTime.Now, DocumentType = ".pdf", Name = "Order#" + orderPublicNumber + "_Receipt", Size = encryptedDocument.Value.Length, IsEncrypted = true }; var documentStorageId = _documentService.StoreDocument(documentInfo, encryptedDocument.Value); return documentStorageId; }
public void SaveProcessCreditCardInfo(ProcessCreditCardViewModel viewModel, string transactionId, bool isGenerateOrderReceipt = false) { var order = _orderManager.GetOrderById(viewModel.OrderId); CheckOrderAccessForClients(order); var stateAbbr = GetStateAbbreviation(viewModel.BillingAddress.State); var orderPaymentInfo = new OrderPaymentInfo(); orderPaymentInfo.FirstName = _cryptographicProvider.EncryptString(viewModel.FirstName).Value; orderPaymentInfo.LastName = _cryptographicProvider.EncryptString(viewModel.LastName).Value; orderPaymentInfo.TransactionId = _cryptographicProvider.EncryptString(transactionId).Value; orderPaymentInfo.City = _cryptographicProvider.EncryptString(viewModel.BillingAddress.City).Value; orderPaymentInfo.State = _cryptographicProvider.EncryptString(stateAbbr).Value; orderPaymentInfo.Street = _cryptographicProvider.EncryptString(viewModel.BillingAddress.Street).Value; orderPaymentInfo.Zip = _cryptographicProvider.EncryptString(viewModel.BillingAddress.ZIP).Value; orderPaymentInfo.CardTypeId = viewModel.CreditCardType == 0 ? null : viewModel.CreditCardType; orderPaymentInfo.PaymentDate = DateTime.Now; if (isGenerateOrderReceipt) { if (_configurationHelper.Environment != DvsEnvironment.Local) { var documentGuid = GenerateOrderReport(viewModel, transactionId, order.OrderPublicId); orderPaymentInfo.PropertyAppraisalReceiptFile = documentGuid; } } order.PaymentInfoes.Add(orderPaymentInfo); }
private ProcessCreditCardViewModel GetProcessCreditCardInternal(int orderId, bool isForDeclinedOrder) { var order = _orderManager.GetOrderById(orderId); CheckOrderAccessForClients(order); var viewModel = new ProcessCreditCardViewModel(); if (order.PaymentInfoes != null && order.PaymentInfoes.Count > 0) { var paymentInfo = order.PaymentInfoes.OrderByDescending(pi => pi.PaymentDate).FirstOrDefault(); if (paymentInfo != null) { viewModel.FirstName = _cryptographicProvider.DecryptString(paymentInfo.FirstName).Value; viewModel.LastName = _cryptographicProvider.DecryptString(paymentInfo.LastName).Value; viewModel.CreditCardType = paymentInfo.CardTypeId; viewModel.BillingAddress = new AddressViewModel(); viewModel.BillingAddress.City = _cryptographicProvider.DecryptString(paymentInfo.City).Value; string stateAbbr = _cryptographicProvider.DecryptString(paymentInfo.State).Value; viewModel.BillingAddress.State = _referenceManager.FindState(stateAbbr); viewModel.BillingAddress.Street = _cryptographicProvider.DecryptString(paymentInfo.Street).Value; viewModel.BillingAddress.ZIP = _cryptographicProvider.DecryptString(paymentInfo.Zip).Value; } } if (isForDeclinedOrder) { viewModel.FeeDifference = GetFeeDifference(order); } else { viewModel.FeeConfirmation = new OrderFeeConfirmationViewModel(order.FeeInfo); } viewModel.IsCancelPopupNeeded = !IsOrderDraft(order); viewModel.OrderNumber = GetOrderNumber(order); return viewModel; }
public ActionResult ProcessCreditCard(ProcessCreditCardViewModel viewModel, int nextStep) { var nextTab = SafeConvert.ToEnum<OrderCreationWizardTabOrder>(nextStep).Value; bool isSavePressed = IsSavePressed(nextTab, OrderCreationWizardTabOrder.ProcessCreditCard); _orderService.SaveProcessCreditCardInfo(viewModel, string.Empty); CommitProviderInstance.Commit(); return isSavePressed ? RedirectToClientPipeline() : RedirectToStep(nextTab, viewModel.OrderId); }