Example #1
0
            /// <summary>
            /// Gets the state province information.
            /// </summary>
            /// <param name="countryCode">The country code.</param>
            /// <param name="queryResultSettings">The query result settings.</param>
            /// <returns>The states/provinces for the given country.</returns>
            public async Task <ActionResult> GetStateProvinceInfo(string countryCode, QueryResultSettings queryResultSettings)
            {
                EcommerceContext                ecommerceContext            = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler         retailOperationsHandler     = new RetailOperationsHandler(ecommerceContext);
                PagedResult <StateProvinceInfo> stateProvinceInfoCollection = await retailOperationsHandler.GetStateProvinces(countryCode, queryResultSettings);

                return(this.Json(stateProvinceInfoCollection.Results));
            }
Example #2
0
            /// <summary>
            /// Gets the gift card information.
            /// </summary>
            /// <param name="giftCardId">The gift card identifier.</param>
            /// <returns>A response containing gift card information.</returns>
            public async Task <ActionResult> GetGiftCardInformation(string giftCardId)
            {
                EcommerceContext        ecommerceContext        = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler retailOperationsHandler = new RetailOperationsHandler(ecommerceContext);
                GiftCard giftCard = await retailOperationsHandler.GetGiftCardInformation(giftCardId);

                return(this.Json(giftCard));
            }
Example #3
0
            /// <summary>
            /// Gets the country region information.
            /// </summary>
            /// <param name="languageId">The language identifier.</param>
            /// <param name="queryResultSettings">The query result settings.</param>
            /// <returns>Country info response.</returns>
            public async Task <ActionResult> GetCountryRegionInfo(string languageId, QueryResultSettings queryResultSettings)
            {
                EcommerceContext                ecommerceContext            = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler         retailOperationsHandler     = new RetailOperationsHandler(ecommerceContext);
                PagedResult <CountryRegionInfo> countryRegionInfoCollection = await retailOperationsHandler.GetCountryRegionInfo(languageId, queryResultSettings);

                return(this.Json(countryRegionInfoCollection.Results));
            }
Example #4
0
            /// <summary>
            /// Gets the loyalty card status.
            /// </summary>
            /// <param name="loyaltyCardNumbers">The loyalty card numbers.</param>
            /// <returns>Response containing the statuses of the specified loyalty card numbers.</returns>
            public async Task <ActionResult> GetLoyaltyCardStatus(IEnumerable <string> loyaltyCardNumbers)
            {
                EcommerceContext          ecommerceContext        = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler   retailOperationsHandler = new RetailOperationsHandler(ecommerceContext);
                PagedResult <LoyaltyCard> loyaltyCards            = await retailOperationsHandler.GetLoyaltyCardStatus(loyaltyCardNumbers);

                return(this.Json(loyaltyCards.Results));
            }
Example #5
0
            /// <summary>
            /// Retrieves the card payment accept result.
            /// </summary>
            /// <param name="cardPaymentResultAccessCode">The card payment result access code.</param>
            /// <returns>Returns payment response.</returns>
            public async Task <ActionResult> RetrieveCardPaymentAcceptResult(string cardPaymentResultAccessCode)
            {
                EcommerceContext        ecommerceContext        = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler retailOperationsHandler = new RetailOperationsHandler(ecommerceContext);
                CardPaymentAcceptResult cardPaymentAcceptResult = await retailOperationsHandler.RetrieveCardPaymentAcceptResult(cardPaymentResultAccessCode);

                return(this.Json(cardPaymentAcceptResult));
            }
Example #6
0
            /// <summary>
            /// Gets the loyalty card transactions.
            /// </summary>
            /// <param name="loyaltyCardNumber">The loyalty card number.</param>
            /// <param name="rewardPointId">The reward point identifier.</param>
            /// <param name="queryResultSettings">The query result settings.</param>
            /// <returns>A response containing transactions for the specified loyalty card.</returns>
            public async Task <ActionResult> GetLoyaltyCardTransactions(string loyaltyCardNumber, string rewardPointId, QueryResultSettings queryResultSettings)
            {
                EcommerceContext        ecommerceContext        = ServiceUtilities.GetEcommerceContext(this.HttpContext);
                RetailOperationsHandler retailOperationsHandler = new RetailOperationsHandler(ecommerceContext);
                PagedResult <LoyaltyCardTransaction> loyaltyCardTransactions = await retailOperationsHandler.GetLoyaltyCardTransactions(
                    loyaltyCardNumber,
                    rewardPointId,
                    queryResultSettings);

                return(this.Json(loyaltyCardTransactions.Results));
            }
Example #7
0
            /// <summary>
            /// Action invoked to complete link up of an existing customer with an external identity.
            /// </summary>
            /// <returns>View for entering activation code to finalize account link up.</returns>
            public async Task <ActionResult> FinalizeAccountLinkUp()
            {
                string emailAddressOfExistingCustomer = this.Request.Form["Email"];
                string activationCode = this.Request.Form["ActivationCode"];

                if (string.IsNullOrEmpty(emailAddressOfExistingCustomer) || string.IsNullOrEmpty(activationCode))
                {
                    var message = "Both the email address and associated activation code must be provided.";
                    RetailLogger.Log.OnlineStoreInvalidAccountLinkUpRequest(Utilities.GetMaskedEmailAddress(emailAddressOfExistingCustomer), activationCode, new NotSupportedException(message));
                    CustomerLinkUpPendingViewModel viewModel = new CustomerLinkUpPendingViewModel()
                    {
                        ErrorMessage = message,
                        EmailAddressOfExistingCustomer = emailAddressOfExistingCustomer,
                        ActivationCode = activationCode
                    };

                    return(this.View(SignInController.UserPendingActivationViewName, viewModel));
                }

                LinkToExistingCustomerResult result;

                try
                {
                    RetailOperationsHandler retailOperationsHandler = new RetailOperationsHandler(ServiceUtilities.GetEcommerceContext(this.HttpContext));
                    result = await retailOperationsHandler.FinalizeLinkToExistingCustomer(emailAddressOfExistingCustomer, activationCode);
                }
                catch (Exception ex)
                {
                    RetailLogger.Log.OnlineStoreInvalidAccountLinkUpRequest(Utilities.GetMaskedEmailAddress(emailAddressOfExistingCustomer), activationCode, ex);
                    var message = "We were unable to process this activation code. Please try entering the code again.";
                    CustomerLinkUpPendingViewModel viewModel = new CustomerLinkUpPendingViewModel()
                    {
                        ErrorMessage = message,
                        EmailAddressOfExistingCustomer = emailAddressOfExistingCustomer,
                        ActivationCode = activationCode
                    };

                    return(this.View(SignInController.UserPendingActivationViewName, viewModel));
                }

                this.TempData["IsActivationFlow"] = true;
                this.TempData["ActivatedEmail"]   = result.EmailAddress;
                this.TempData["IdProvider"]       = GetAuthenticationProviderName(result.ExternalIdentityProvider);

                var authProviders = SignInController.GetAuthenticationProviders(this.HttpContext);

                return(this.RedirectToAction(SignInController.DefaultActionName, SignInController.ControllerName));
            }