Exemple #1
0
        public AcApiResponse <SaveConsumerProfileDocumentResponse, ApiData> SaveConsumerProfileDocument(ViewModels.Consumer.SaveConsumerProfileDocumentRequest req)
        {
            var imageItems = new List <ImageItemType>();

            foreach (var image in req.ConsumerProfileDocument.ImageItems)
            {
                if (!string.IsNullOrEmpty(image.Image)) //add only non-empty images
                {
                    imageItems.Add(new ImageItemType
                    {
                        Image = System.Convert.FromBase64String(image.Image).ToList(),
                        Label = image.Label
                    });
                }
            }

            if (imageItems.Count == 0) //photocopy flow
            {
                imageItems = null;
            }

            var consumerProfileDocument = new ConsumerProfileDocumentContentType
            {
                Identifier        = req.ConsumerProfileDocument.Identifier,
                DocumentIssueDate = req.ConsumerProfileDocument.DocumentIssueDate,
                MimeType          = req.ConsumerProfileDocument.MimeType,
                ImageItems        = imageItems
            };

            var request = new SaveConsumerProfileDocumentRequest
            {
                AgentID                 = req.AgentID,
                AgentSequence           = req.AgentSequence,
                ChannelType             = req.ChannelType,
                ClientSoftwareVersion   = req.ClientSoftwareVersion,
                ConsumerProfileID       = req.ConsumerProfileID,
                ConsumerProfileIDType   = req.ConsumerProfileIDType,
                Language                = req.Language,
                MgiSessionID            = req.MgiSessionID,
                OperatorName            = req.OperatorName,
                PoeCapabilities         = req.PoeCapabilities,
                PoeType                 = req.PoeType,
                TargetAudience          = req.TargetAudience,
                TimeStamp               = req.TimeStamp,
                UnitProfileID           = req.UnitProfileID,
                ConsumerProfileDocument = consumerProfileDocument,
            };

            var response = _agentConnectIntegration.SaveConsumerProfileDocument(request);

            var apiResponse = new AcApiResponse <SaveConsumerProfileDocumentResponse, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(response.Payload?.Flags, DataSource.AgentConnect),
                ResponseData     = response
            };

            return(apiResponse);
        }