Пример #1
0
    private void UpdateDisplay()
    {
        if (!HasBeenShown || !HasBeenEnabled || !AppLogic.SecureNetVaultIsEnabled() || SecureNetModel == null)
        {
            Visible = false;
            return;
        }

        Visible = SecureNetModel.GetCustomerVault().Any();
    }
Пример #2
0
    public void SaveViewToModel()
    {
        if (SecureNetModel == null)
        {
            return;
        }

        SecureNetModel.SelectedVaultPayment = rblSecureNetVaultMethods.SelectedValue;
        SecureNetModel.Save();
    }
    public override void SetModel(PaymentMethodBaseModel model, IStringResourceProvider stringResourceProvider)
    {
        base.SetModel(model, stringResourceProvider);

        if (!AppLogic.SecureNetVaultIsEnabled())
        {
            return;
        }

        if (rblSecureNetVaultMethods.Items.Count != 0)
        {
            return;
        }

        if (this.Model == null)
        {
            return;
        }

        var  vaultPaymentInfo = SecureNetModel.GetCustomerVault();
        bool defaultToNewCard = true;

        rblSecureNetVaultMethods.Items.Clear();
        foreach (var paymentInfo in vaultPaymentInfo)
        {
            string text     = String.Format("<strong>{0}</strong>: {1} <strong>{2}</strong>: {3}", "account.creditcardprompt".StringResource(), paymentInfo.CardNumberPadded, "account.expires".StringResource(), paymentInfo.ExpDateFormatted);
            string value    = paymentInfo.PaymentId;
            bool   selected = value == (SecureNetModel.SelectedVaultPayment ?? SecureNetModel.GetCustomersSelectedSecureNetVault());

            if (selected)
            {
                defaultToNewCard = false;
            }

            rblSecureNetVaultMethods.Items.Add(
                new ListItem
            {
                Text     = text,
                Value    = value,
                Selected = selected
            });
        }

        rblSecureNetVaultMethods.Items.Add(
            new ListItem
        {
            Text     = "Use a new credit card",
            Value    = "-1",
            Selected = defaultToNewCard,
        });
    }
Пример #4
0
    public void Initialize()
    {
        if (SecureNetModel == null)
        {
            return;
        }

        var vaultPaymentInfo = SecureNetModel.GetCustomerVault();

        if (!vaultPaymentInfo.Any(pi => pi.PaymentId == SecureNetModel.SelectedVaultPayment))
        {
            SecureNetModel.SelectedVaultPayment = "-1";
        }
    }