Beispiel #1
0
        public async Task WhenIPressAdd()
        {
            var httpClient = new HttpClient();

            httpClient.BaseAddress = new Uri("https://pfeapim.azure-api.net/");
            client   = new MemberApiClient(httpClient);
            response = await client.CreateMemberAsync(request);
        }
        public void SetActivateMemberState(CreateMemberResponse createMemberResponse)
        {
            Member.ActivationCode = createMemberResponse.ActivationCode;
            Member.MemberUsername = createMemberResponse.MemberUsername;

            ShowActivationMessage = true;

            NotifyStateChanged();
        }
        public void ResetActivateMemberState()
        {
            Member = new CreateMemberResponse();

            ShowActivationMessage = false;

            ShowActivationSuccesMessage = false;

            NotifyStateChanged();
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateMemberResponse response = new CreateMemberResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("MemberId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.MemberId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Beispiel #5
0
        public async Task Cannot_Create_MemberAsync()
        {
            var request = new CreateMemberRequest
            {
                Id   = Guid.NewGuid(),
                Name = "Hugo"
            };

            var response = new CreateMemberResponse
            {
                Message = "Can not create member"
            };

            _membetApiClient.CreateMemberAsync(request).Returns(Task.FromResult(response));

            var result = await _controller.CreateMember(request);

            result.Message.Should().Be("Can not create member");
        }
Beispiel #6
0
        public async Task Can_Create_Member()
        {
            var request = new CreateMemberRequest
            {
                Id   = Guid.NewGuid(),
                Name = "Hugo"
            };

            var response = new CreateMemberResponse
            {
                Id = Guid.NewGuid()
            };

            _membetApiClient.CreateMemberAsync(request).Returns(Task.FromResult(response));

            var result = await _controller.CreateMember(request);

            result.Id.Should().NotBeEmpty();
        }
        public override void Process(ServicePipelineArgs args)
        {
            CreateUserRequest request;
            CreateUserResult  result;

            using (new DisposableThreadLifestyleScope())
            {
                CheckParametersAndSetupRequestAndResult(args, out request, out result);

                if (IsFromUcommerce(request))
                {
                    result.CommerceUser = _userRepository.Get(request.UserName);
                    return;
                }

                var createMemberPipeline = ObjectFactory.Instance.Resolve <IPipeline <IPipelineArgs <CreateMemberRequest, CreateMemberResponse> > >("CreateOrGetMember");

                var clientContext = ObjectFactory.Instance.Resolve <IClientContext>();
                var basket        = clientContext.GetBasket(true);
                basket.PurchaseOrder.Customer = CreateCustomer(request);

                var createMemberRequest = new CreateMemberRequest
                {
                    LoginName   = request.UserName,
                    Password    = request.Password,
                    Email       = request.Email,
                    MemberGroup = new MemberGroup(basket.PurchaseOrder.ProductCatalogGroup.MemberGroupId),
                    MemberType  = new MemberType(basket.PurchaseOrder.ProductCatalogGroup.MemberTypeId)
                };
                var createMemberResponse = new CreateMemberResponse();
                createMemberRequest.Properties["FromUCommerce"] = false;

                createMemberPipeline.Execute(new CreateMemberPipelineArgs(createMemberRequest, createMemberResponse));
                result.CommerceUser = _userRepository.Get(createMemberResponse.Member.LoginName);
            }
        }
Beispiel #8
0
        public static DenhacResponse CreateMemberService(
            string lastName,
            string mi,
            string firstName,
            DateTime birthdate,
            string streetAddress,
            string city,
            string zipCode,
            string email,
            string paypal_email,
            string phone,
            string businessPhone,
            string emergencyContact1,
            string emergencyPhone1,
            string emergencyAddress1,
            string emergencyRelation1,
            string emergencyContact2,
            string emergencyPhone2,
            string emergencyAddress2,
            string emergencyRelation2,
            string paymentAmount,
            DateTime joinDate,
            string proxCardID,
            string medicalHealthProblems,
            string ad_username)
        {
            var postData = new List <KeyValuePair <string, string> >();

            postData.Add(new KeyValuePair <string, string>("lastName", lastName));
            postData.Add(new KeyValuePair <string, string>("middleInitial", mi));
            postData.Add(new KeyValuePair <string, string>("firstName", firstName));
            postData.Add(new KeyValuePair <string, string>("birthdate", birthdate.ToString("yyyy-MM-dd")));
            postData.Add(new KeyValuePair <string, string>("streetAddress1", streetAddress));
            postData.Add(new KeyValuePair <string, string>("city", city));
            postData.Add(new KeyValuePair <string, string>("zipCode", zipCode));
            postData.Add(new KeyValuePair <string, string>("contact_email", email));
            postData.Add(new KeyValuePair <string, string>("paypal_email", paypal_email));
            postData.Add(new KeyValuePair <string, string>("phoneNumber", phone));
            postData.Add(new KeyValuePair <string, string>("businessPhone", businessPhone));
            postData.Add(new KeyValuePair <string, string>("emerContact1", emergencyContact1));
            postData.Add(new KeyValuePair <string, string>("emerPhone1", emergencyPhone1));
            postData.Add(new KeyValuePair <string, string>("emerAddress1", emergencyAddress1));
            postData.Add(new KeyValuePair <string, string>("emerRelation1", emergencyRelation1));
            postData.Add(new KeyValuePair <string, string>("emerContact2", emergencyContact2));
            postData.Add(new KeyValuePair <string, string>("emerPhone2", emergencyPhone2));
            postData.Add(new KeyValuePair <string, string>("emerAddress2", emergencyAddress2));
            postData.Add(new KeyValuePair <string, string>("emerRelation2", emergencyRelation2));
            postData.Add(new KeyValuePair <string, string>("paymentAmount", paymentAmount));
            postData.Add(new KeyValuePair <string, string>("join_date", joinDate.ToString("yyyy-MM-dd")));
            postData.Add(new KeyValuePair <string, string>("prox_card_id", proxCardID));
            postData.Add(new KeyValuePair <string, string>("medicalHealthProblems", medicalHealthProblems));
            postData.Add(new KeyValuePair <string, string>("ad_username", ad_username));

            var resultStr = CallPost(hostName + "/createmember", postData);
            CreateMemberResponse responseObj = JsonConvert.DeserializeObject <CreateMemberResponse>(resultStr);

            if (responseObj.success)
            {
                responseObj.transactionStatus = true;
            }
            else
            {
                responseObj.transactionStatus = false;
            }

            return(responseObj);
        }