Ejemplo n.º 1
0
 public static LoginResponse GetBaseLoginResponse(bool authenticated)
 {
     LoginResponse value = new LoginResponse();
     value.Authenticated = authenticated;
     value.MemberFound = authenticated;
     value.Success = authenticated;
     value.WebAccountFound = authenticated;
     return value;
 }
Ejemplo n.º 2
0
        public static BaseResponse Login(returntype sfgReturn)
        {
            string className = "SFGWrapper.GateKeeperTranslators.Login()";
            BaseResponse baseResponse = new BaseResponse();
            foreach (var item in sfgReturn.error)
            {
                Message ahError = new Message(item.errno, MessageSources.Gatekeeper);
                foreach (string message in item.errmsg)
                {
                    ahError.SfgMessages.Add(message);
                }
                baseResponse.Messages.Add(ahError);
            }
            LoginResponse loginResponse = new LoginResponse();
            loginResponse.Authenticated = (sfgReturn.response.AUTH == "Y");
            loginResponse.MemberFound = (sfgReturn.response.CUST_FOUND == "Y");
            loginResponse.WebAccountFound = (sfgReturn.response.USER_FOUND == "Y");
            loginResponse.ShipToAddress = GetAddress(sfgReturn.response.SHIP_TO);
            loginResponse.MemberData = GetMember(sfgReturn.response.CUSTOMER_INFO);
            loginResponse.MemberData.UserName = sfgReturn.response.USERID;
            if (loginResponse.Authenticated)
            {
                loginResponse.SubscriptionValidationData = GetSubscriptionValidation(sfgReturn.response);
                foreach (Subscription sub in GetSubscriptions(sfgReturn.response.ORDER_HISTORY))
                {
                    loginResponse.MemberData.Subscriptions.Add(sub);
                }
                foreach (RenewalOffer item in GetRenewalOffers(sfgReturn.response.SUB_OFFERS))
                {
                    loginResponse.RenewalOffers.Add(item);
                }
            }
            baseResponse.TypedResponse = loginResponse;

            baseResponse.TypedResponse.Success = sfgReturn.success;
            baseResponse.TypedResponse.Info = Utilities.GetInfo(sfgReturn.response.INFO);
            baseResponse.TypedResponse.MemoryUsed = sfgReturn.response.MEMORY_USED;
            baseResponse.TypedResponse.Protocol = sfgReturn.response.PROTOCOL;
            baseResponse.TypedResponse.RoundtripTime = sfgReturn.response.ROUNDTRIP_TIME;
            baseResponse.TypedResponse.Server = sfgReturn.response.SERVER;
            baseResponse.TypedResponse.TimeElapsed = sfgReturn.response.TIME_ELAPSED;
            baseResponse.TypedResponse.Version = sfgReturn.response.VERSION;

            return baseResponse;
        }