public PatchGoalHttpTriggerService(IGoalsPatchService goalsPatchService, IDocumentDBProvider documentDbProvider) { _goalPatchService = goalsPatchService; _documentDbProvider = documentDbProvider; }
public PatchCustomerHttpTriggerService(ICustomerPatchService customerPatchService, IDocumentDBProvider documentDbProvider) { _documentDbProvider = documentDbProvider; _customerPatchService = customerPatchService; }
public static async Task <HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "customers/{customerId}/ContactDetails/")] HttpRequestMessage req, ILogger log, string customerId, [Inject] IResourceHelper resourceHelper, [Inject] IHttpRequestMessageHelper httpRequestMessageHelper, [Inject] IValidate validate, [Inject] IPostContactDetailsHttpTriggerService contactdetailsPostService, [Inject] IDocumentDBProvider provider) { var touchpointId = httpRequestMessageHelper.GetTouchpointId(req); if (string.IsNullOrEmpty(touchpointId)) { log.LogInformation("Unable to locate 'TouchpointId' in request header."); return(HttpResponseMessageHelper.BadRequest()); } var ApimURL = httpRequestMessageHelper.GetApimURL(req); if (string.IsNullOrEmpty(ApimURL)) { log.LogInformation("Unable to locate 'apimurl' in request header"); return(HttpResponseMessageHelper.BadRequest()); } log.LogInformation("C# HTTP trigger function Post Contact processed a request. " + touchpointId); if (!Guid.TryParse(customerId, out var customerGuid)) { return(HttpResponseMessageHelper.BadRequest(customerGuid)); } Models.ContactDetails contactdetailsRequest; try { contactdetailsRequest = await httpRequestMessageHelper.GetContactDetailsFromRequest <Contact.Models.ContactDetails>(req); } catch (JsonException ex) { return(HttpResponseMessageHelper.UnprocessableEntity(ex)); } if (contactdetailsRequest == null) { return(HttpResponseMessageHelper.UnprocessableEntity(req)); } contactdetailsRequest.SetIds(customerGuid, touchpointId); var errors = validate.ValidateResource(contactdetailsRequest, null, true); if (errors != null && errors.Any()) { return(HttpResponseMessageHelper.UnprocessableEntity(errors)); } var doesCustomerExist = await resourceHelper.DoesCustomerExist(customerGuid); if (!doesCustomerExist) { return(HttpResponseMessageHelper.NoContent(customerGuid)); } var isCustomerReadOnly = await resourceHelper.IsCustomerReadOnly(customerGuid); if (isCustomerReadOnly) { return(HttpResponseMessageHelper.Forbidden(customerGuid)); } var doesContactDetailsExist = contactdetailsPostService.DoesContactDetailsExistForCustomer(customerGuid); if (doesContactDetailsExist) { return(HttpResponseMessageHelper.Conflict()); } if (!string.IsNullOrEmpty(contactdetailsRequest.EmailAddress)) { var contacts = await provider.GetContactsByEmail(contactdetailsRequest.EmailAddress); if (contacts != null) { foreach (var contact in contacts) { var isReadOnly = await provider.DoesCustomerHaveATerminationDate(contact.CustomerId.GetValueOrDefault()); if (!isReadOnly) { //if a customer that has the same email address is not readonly (has date of termination) //then email address on the request cannot be used. return(HttpResponseMessageHelper.Conflict()); } } } } var contactDetails = await contactdetailsPostService.CreateAsync(contactdetailsRequest); if (contactDetails != null) { await contactdetailsPostService.SendToServiceBusQueueAsync(contactDetails, ApimURL); } return(contactDetails == null ? HttpResponseMessageHelper.BadRequest(customerGuid) : HttpResponseMessageHelper.Created(JsonHelper.SerializeObject(contactDetails))); }
public PatchSessionHttpTriggerService(IDocumentDBProvider documentDbProvider, ISessionPatchService sessionPatchService) { _documentDbProvider = documentDbProvider; _sessionPatchService = sessionPatchService; }
public PatchActionPlanHttpTriggerService(IActionPlanPatchService actionPlanPatchService, IDocumentDBProvider documentDbProvider) { _actionPlanPatchService = actionPlanPatchService; _documentDbProvider = documentDbProvider; }
public PatchOutcomesHttpTriggerService(IDocumentDBProvider documentDbProvider, IOutcomePatchService outcomePatchService) { _documentDbProvider = documentDbProvider; _outcomePatchService = outcomePatchService; }
public PatchAdviserDetailHttpTriggerService(IDocumentDBProvider documentDbProvider, IAdviserDetailPatchService adviserDetailPatchService) { _documentDbProvider = documentDbProvider; _adviserDetailPatchService = adviserDetailPatchService; }
public PatchAddressHttpTriggerService(IDocumentDBProvider documentDbProvider, IAddressPatchService addressPatchService) { _documentDbProvider = documentDbProvider; _addressPatchService = addressPatchService; }
public BulkGeoCodeAddressServiceService(IDocumentDBProvider dbProvider, IJsonHelper jsonHelper, IAzureMapService azureMapService) { _dbProvider = dbProvider ?? throw new ArgumentNullException(nameof(dbProvider)); _jsonHelper = jsonHelper ?? throw new ArgumentNullException(nameof(jsonHelper)); _azureMapService = azureMapService ?? throw new ArgumentNullException(nameof(azureMapService)); }
public SubscriptionHelper(IDocumentDBProvider dbProvider) { _dbProvider = dbProvider; }