private void SetPayPalVisibility(CartViewModel model) { var isRecurring = CurrentCart != null ? CurrentCart.IsRecurring : false; var enabledMethods = PaymentMethods.EnabledMethods(HccApp.CurrentStore, isRecurring); model.PayPalExpressAvailable = enabledMethods.Any(m => m.MethodId == PaymentMethods.PaypalExpressId); }
private void LoadPaymentMethods() { // Hide all first var divs = new List <Control> { divNoPaymentNeeded, divCreditCard, divPurchaseOrder, divCompanyAccount, divCheck, divTelephone, divCashOnDelivery }; divs.ForEach(d => d.Visible = false); // Show enabled only var enabledMethods = PaymentMethods.EnabledMethods(HccApp.CurrentStore, CurrentOrder.IsRecurring); foreach (var method in enabledMethods) { var divWrapper = upMain.FindControl("div" + method.MethodName) as HtmlGenericControl; var radioButton = upMain.FindControl("rb" + method.MethodName) as RadioButton; if (divWrapper != null) { divWrapper.Visible = true; } if (radioButton != null) { radioButton.Text = LocalizationUtils.GetPaymentMethodFriendlyName(method.MethodName); } } // Select first one var firstMethod = enabledMethods.FirstOrDefault(); if (firstMethod != null) { var radioButton = upMain.FindControl("rb" + firstMethod.MethodName) as RadioButton; if (radioButton != null) { radioButton.Checked = true; } } }
private void LoadPaymentModel(EditBillingViewModel model, Order order) { var payManager = new OrderPaymentManager(order, HccApp); var pModel = new PaymentViewModel { PaymentMethods = PaymentMethods.EnabledMethods(HccApp.CurrentStore, true), CreditCardForm = { AcceptedCardTypes = HccApp.CurrentStore.Settings.PaymentAcceptedCards } }; var trInfo = payManager.GetLastCreditCardTransaction(); pModel.CreditCardForm.ExpirationMonth = trInfo.CreditCard.ExpirationMonth; pModel.CreditCardForm.ExpirationYear = trInfo.CreditCard.ExpirationYear; pModel.CreditCardForm.CardHolderName = trInfo.CreditCard.CardHolderName; pModel.CreditCardForm.CardNumber = "XXXXXXXXXXXX" + trInfo.CreditCard.CardNumberLast4Digits; model.PaymentModel = pModel; }