episerver / Foundation

Foundation offers a starting point that is intuitive, well-structured and modular allowing developers to explore CMS, Commerce, Personalization, Search and Navigation, Data Platform and Experimentation.
https://docs.developers.optimizely.com/digital-experience-platform/docs/optimizely-foundation-demo-sites
Apache License 2.0
132 stars 136 forks source link

Unable to fetch Saved Credit Cards #875

Open sandeep1102 opened 2 years ago

sandeep1102 commented 2 years ago

Describe the bug CustomerContext.Current.CurrentContact.ContactCreditCards should return saved credit cards but it doesn't return any list or say length is always 0, even after saving one credit card entry through code.

To Reproduce Run this code and at first run there can be empty list of credit cards but after saving one it should show saved credit cards list.


var epiServerContext = CustomerContext.Current.CurrentContact;
            var epiServerCreditCards1 = CustomerContext.Current?.GetContactCreditCards(epiServerContext);
            var epiServerCreditCards2 = epiServerContext?.ContactCreditCards;
            var creditCard = new CreditCard
            {
                LastFourDigits = Convert.ToString("1111"),
                ExpirationMonth = Convert.ToInt32(12),
                ExpirationYear = Convert.ToInt32(2023),
                CardType = 1,
            };
            epiServerContext?.AddCreditCard(creditCard);
            epiServerContext?.SaveChanges();