/// <summary> /// At this time, Sezzle only allows configuration of the URL that we send our webhooks to. /// </summary> /// <remarks> /// https://gateway.sezzle.com/v1/configuration /// </remarks> /// <returns></returns> public async Task <ConfigurationUpdateResponse> UpdateAsync(ConfigurationUpdateRequest configuration) { var tokenTask = _authenticationEndpoint.CreateTokenAsync(); var requestUrl = UrlStringExtensions.FormatRequestUrl(_baseConfiguration.ApiUrl, "/configuration"); var token = await(tokenTask); var response = await _sezzleHttpClient.PostAsync <ConfigurationUpdateRequest, ConfigurationUpdateResponse>(token.Token, requestUrl, configuration); return(response); }
public async Task CanUpdateConfiguration() { var configurationEndpoint = new SezzleSharp.Endpoints.ConfigurationEndpoint(_baseConfiguration, _authenticationClient, GetDefaultSezzleHttpClient()); var request = new ConfigurationUpdateRequest() { WebhookUrl = "https://test.sezzle.com/orders-webhook" }; ConfigurationUpdateResponse response = await configurationEndpoint.UpdateAsync(request); Assert.IsNotNull(response); Assert.AreEqual(HttpStatusCode.OK, response.RequestAndResponseInfo.ResponseHttpStatusCode); }
public async Task <ActionResult> UpdateConfiguration(EditConfigRequestModel updateRequest) { try { IConfigurationUpdateRequest updateConfigurationRequest = new ConfigurationUpdateRequest(updateRequest.Key, updateRequest.Value); IConfigurationUpdateResponse configurationUpdateResponse = await _configurationUpdater.UpdateConfiguration(updateConfigurationRequest); return(PrepareResponseAfterUpdateConfigurationResponse(configurationUpdateResponse)); } catch (Exception ex) { _logger.Log(ex); return(StatusCode(500)); } }