public ActionResult Dashboard() { var model = new ShopperDashboardViewModel(); this.FillDashboardViewModelWithCommonData(model, this.FormsAuthentication.GetAuthenticationToken()); model.UserEmail = this.FormsAuthentication.GetAuthenticationToken(); return this.View("Dashboard", model); }
/// <summary> /// The fill dashboard view model with common data. /// </summary> /// <param name="model"> /// The model. /// </param> /// <param name="userEmail"> /// The user email. /// </param> private void FillDashboardViewModelWithCommonData(ShopperDashboardViewModel model, string userEmail) { var response = this.membershipService.GetProfile( new GetProfileRequest { IdentityToken = userEmail }); model.UserEmail = userEmail; model.UspsTrackingUrl = ConfigurationManager.AppSettings["UspsTrackingUrl"]; model.UserId = response.Id; model.FirstName = response.FirstName; model.LastName = response.LastName; model.WalletAmount = response.Balance; model.AmountValidationMessage = DashboardViewResources.ResourceManager.GetString("AddFundsAmountValidationMessage"); var addressesResponse = this.addressService.GetDeliveryAddresses(new GetDeliveryAddressesRequest { IdentityToken = userEmail }); model.DeliveryAddressViewModels = addressesResponse.ConvertToDeliveryAddressViewModel(); model.AddFundsButtonText = DashboardViewResources.AddFundsButton; model.AddFundsLoadingText = DashboardViewResources.AddFundsButtonLoading; model.DeliveryMethods = Enum.GetValues(typeof(DispatchMethod)) .Cast<DispatchMethod>() .Select(enumElement => new DispatchMethodViewModel { Id = (int)enumElement, Name = DispatchMethods.ResourceManager.GetString(enumElement.ToString()) }).ToList(); }
public ActionResult PaymentSucceded(string token, string payerId) { var model = new ShopperDashboardViewModel(); try { PayPalHelper.ConfirmPayPalPayment(token, payerId); var confirmPayPalTransactionResponse = this.transactionService.ConfirmPayPalTransaction( new ConfirmPayPalTransactionRequest { PayerId = payerId, Token = token }); if (confirmPayPalTransactionResponse.MessageType == Services.Messaging.MessageType.Success) { model.PayPalTransactionResultMessage = DashboardViewResources.ResourceManager.GetString("SuccessfullPayPalPaymentConfirmationMessage"); model.PayPalTransactionResultMessageType = "Success"; } else { model.PayPalTransactionResultMessage = confirmPayPalTransactionResponse.Message; model.PayPalTransactionResultMessageType = confirmPayPalTransactionResponse.MessageType.ToString(); } } catch (PayPalException ex) { model.PayPalTransactionResultMessage = string.Format( "{0}\n{1}", DashboardViewResources.ResourceManager.GetString("FailedPayPalPaymentConfirmationMessage"), ex.Message); model.PayPalTransactionResultMessageType = "Error"; } this.FillDashboardViewModelWithCommonData(model, this.FormsAuthentication.GetAuthenticationToken()); return this.View("Dashboard", model); }
public ActionResult PaymentCanceled(string token, string payerId) { var model = new ShopperDashboardViewModel(); var cancelPayPalTransactionResponse = this.transactionService.CancelPayPalTransaction( new CancelPayPalTransactionRequest { Token = token }); model.PayPalTransactionResultMessage = cancelPayPalTransactionResponse.Message; model.PayPalTransactionResultMessageType = cancelPayPalTransactionResponse.MessageType.ToString(); this.FillDashboardViewModelWithCommonData(model, this.FormsAuthentication.GetAuthenticationToken()); return this.View("Dashboard", model); }
public ActionResult ViewShopperDashboard(string userEmail) { var model = new ShopperDashboardViewModel { UserEmail = userEmail, OperatorMode = true }; this.FillDashboardViewModelWithCommonData(model, userEmail); return this.View("Dashboard", model); }