예제 #1
0
        public CreateOrUpdateProfileReceiverResponse CreateProfileReceiver(
            CreateOrUpdateProfileReceiverData data)
        {
            var validationResponse = CreateOrUpdateProfileReceiverBaseData(data);

            return(_validationOperations.CreateOrUpdateProfileReceiverValidate(data, validationResponse.Payload?.FieldsToCollect));
        }
예제 #2
0
 public CreateOrUpdateProfileReceiverResponse UpdateProfileReceiverData(CreateOrUpdateProfileReceiverData data, List <KeyValuePairType> fieldValues, string receiverProfileId, string receiverProfileTypeId)
 {
     data.CreateOrUpdateProfileReceiverRequest = CreateOrUpdateProfileReceiverRequestFactory.NewRequestWithBaseData();
     data.CreateOrUpdateProfileReceiverRequest.ConsumerProfileID     = receiverProfileId;
     data.CreateOrUpdateProfileReceiverRequest.ConsumerProfileIDType = receiverProfileTypeId;
     data.CreateOrUpdateProfileReceiverRequest.FieldValues.AddRange(fieldValues);
     return(_acIntegration.CreateOrUpdateProfileReceiver(data));
 }
        public void UpdateExistingReceiverProfile_ProfileUpdated()
        {
            var createResponse = CreateProfile();

            #region Get profile

            var getProfileResponse = GetProfileReceiver(createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileID, createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileIDType);

            Assert.IsFalse(getProfileResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{getProfileResponse.Errors?.Log()}");
            Assert.IsNotNull(getProfileResponse.Payload, "Payload is null");
            Assert.IsNotNull(getProfileResponse.Payload.CurrentValues, "There are no values related with profile");
            Assert.IsTrue(getProfileResponse.Payload.CurrentValues.Count != 0,
                          "There are no values related with profile");
            #endregion

            #region Update profile

            var addressToChange = _consumerOperations.GetCityAddressOfReceiver(getProfileResponse);
            var updateRequest   = new INTEGRATION.CreateOrUpdateProfileReceiverRequest
            {
                AgentState = _agentState,
            };
            updateRequest.PopulateAgentData(updateRequest.AgentState);
            var updateData = new CreateOrUpdateProfileReceiverData(updateRequest);
            var values     = getProfileResponse.Payload.CurrentValues.Where(x =>
                                                                            x.InfoKey != InfoKeyNames.issue_Date && x.InfoKey != InfoKeyNames.last_Modified_Date &&
                                                                            x.InfoKey != InfoKeyNames.issue_Date.Replace("_", "") &&
                                                                            x.InfoKey != InfoKeyNames.last_Modified_Date.Replace("_", "")
                                                                            ).ToList();
            var newAddress       = _consumerOperations.SetRandomAddressCityOfReceiver(values);
            var generatorCounter = 0;
            while (newAddress.Equals(addressToChange) && generatorCounter < 5)
            {
                newAddress = _consumerOperations.SetRandomAddressCityOfReceiver(values);
                generatorCounter++;
            }

            var createdProfile = createResponse.Payload.ConsumerProfileIDs.First();

            Assert.AreNotEqual(newAddress, addressToChange, "Could not change address to random one");
            var updateResponse = _consumerOperations.UpdateProfileReceiverData(updateData, values,
                                                                               createdProfile.ConsumerProfileID, createdProfile.ConsumerProfileIDType);
            Assert.IsFalse(updateResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{updateResponse.Errors?.Log()}");
            Assert.IsNotNull(updateResponse.Payload.ConsumerProfileIDs);
            Assert.IsTrue(updateResponse.Payload.ConsumerProfileIDs.Any() &&
                          !string.IsNullOrWhiteSpace(updateResponse.Payload.ConsumerProfileIDs.First()
                                                     .ConsumerProfileID));

            var updatedProfile = GetProfileReceiver(createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileID,
                                                    createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileIDType);

            var updatedAddress = _consumerOperations.GetCityAddressOfReceiver(updatedProfile);
            Assert.AreEqual(newAddress, updatedAddress);

            #endregion
        }
        public CreateOrUpdateProfileReceiverResponse CreateOrUpdateProfileReceiver(CreateOrUpdateProfileReceiverData createOrUpdateProfileData)
        {
            var agent = _agents.GetAgent(createOrUpdateProfileData.Request.AgentId, createOrUpdateProfileData.Request.AgentPos);

            _agentConnectConfig.DecorateRequest(createOrUpdateProfileData.CreateOrUpdateProfileReceiverRequest);
            var response = _testRunner.AgentConnect.CreateOrUpdateProfileReceiver(agent,
                                                                                  createOrUpdateProfileData.CreateOrUpdateProfileReceiverRequest);

            return(response);
        }
        private CreateOrUpdateProfileReceiverResponse CreateProfile()
        {
            var createRequest = new INTEGRATION.CreateOrUpdateProfileReceiverRequest
            {
                AgentState = _agentState
            };

            createRequest.PopulateAgentData(createRequest.AgentState);
            var createData = new CreateOrUpdateProfileReceiverData(createRequest);

            return(_consumerOperations.CreateProfileReceiver(createData));
        }
        public void CreateOrUpdateProfileReceiver_FieldsToCollectReturned()
        {
            var request = new INTEGRATION.CreateOrUpdateProfileReceiverRequest
            {
                AgentState = _agentState
            };

            request.PopulateAgentData(request.AgentState);
            var data     = new CreateOrUpdateProfileReceiverData(request);
            var response = _consumerOperations.CreateOrUpdateProfileReceiverBaseData(data);

            Assert.IsFalse(response.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{response.Errors?.Log()}");
            var containsCategory = ContainsCategory(response.Payload.FieldsToCollect, InfoKeyCategories.receiverProfileSaveOrUpdateInfoSet);

            Assert.IsTrue(containsCategory, "Ensure that profile editor limits for create or update profile Receiver are configured properly in the current environment");
        }
예제 #7
0
 public CreateOrUpdateProfileReceiverResponse CreateOrUpdateProfileReceiverBaseData(CreateOrUpdateProfileReceiverData data)
 {
     data.CreateOrUpdateProfileReceiverRequest = CreateOrUpdateProfileReceiverRequestFactory.NewRequestWithBaseData();
     return(_acIntegration.CreateOrUpdateProfileReceiver(data));
 }