public ActionResult CreditCardDetail() { var customer = HttpContext.GetCustomer(); var showCardStartDateFields = AppLogic.AppConfigBool("ShowCardStartDateFields"); var walletsAreEnabled = customer.IsRegistered && WalletProvider.WalletsAreEnabled(); var displayWalletCards = walletsAreEnabled && WalletProvider.GetPaymentProfiles(customer).Any(); string name = customer.FullName(), number = null, cardType = null, expirationDate = null, startDate = null; var checkoutContext = PersistedCheckoutContextProvider.LoadCheckoutContext(customer); if (checkoutContext.CreditCard != null) { name = checkoutContext.CreditCard.Name ?? customer.FullName(); number = GetCreditCardNumberForDisplay(checkoutContext.CreditCard.Number); cardType = checkoutContext.CreditCard.CardType; expirationDate = GetCreditCardDateForDisplay(checkoutContext.CreditCard.ExpirationDate); startDate = GetCreditCardDateForDisplay(checkoutContext.CreditCard.StartDate); } var skinProvider = new SkinProvider(); return(PartialView(ViewNames.CreditCardDetailPartial, new CheckoutCreditCardViewModel { Name = name, Number = number, CardType = cardType, ExpirationDate = expirationDate, StartDate = startDate, ShowStartDate = showCardStartDateFields, WalletsAreEnabled = walletsAreEnabled, DisplayWalletCards = displayWalletCards, LastFour = (!string.IsNullOrEmpty(number) && number.Length > 4) ? number.Substring(number.Length - 4) : null, CardImage = !string.IsNullOrEmpty(cardType) ? DisplayTools.GetCardImage( imagePath: Url.SkinUrl("images/"), cardName: cardType) : null })); }
public ActionResult SelectWallet() { var customer = HttpContext.GetCustomer(); var paymentProfiles = WalletProvider.GetPaymentProfiles(customer); return(PartialView(new WalletSelectViewModel( walletPaymentTypes: paymentProfiles .Select(profile => new WalletPaymentType { PaymentProfileId = profile.PaymentProfileId, CardType = profile.CardType, CardNumber = profile.CreditCardNumberMasked, ExpirationMonth = profile.ExpirationMonth, ExpirationYear = profile.ExpirationYear, CardImage = Url.Content(string.Format("~/skins/{0}/Images/{1}", SkinProvider.GetSkinNameById(customer.SkinID), DisplayTools.GetCardImage(string.Empty, profile.CardType))) })))); }