示例#1
0
        public async Task <string> CreateCase(LibraryVolunteeringEnquiry enquiry)
        {
            var response = await _verintServiceGateway.CreateCase(enquiry.MapToCase(
                                                                      _verintConfiguration.EventCode,
                                                                      _verintConfiguration.Classification));

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("LibraryVolunteeringEnquiryService.CreateCase: VerintServiceGateway status code indicated the case was not created.");
            }

            if (!string.IsNullOrEmpty(enquiry.Email))
            {
                _ = _mailingServiceGateway.Send(new Mail
                {
                    Template = EMailTemplate.LibraryVolunteeringEnquiry,
                    Payload  = JsonConvert.SerializeObject(new
                    {
                        enquiry.FirstName,
                        Reference        = response.ResponseContent,
                        RecipientAddress = enquiry.Email,
                        Subject          = "Library Volunteering Enquiry"
                    })
                });
            }

            return(response.ResponseContent);
        }