/// <summary> /// Deletes the WalletAdjustment. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> DeleteWalletAdjustment(WalletAdjustmentIdDetails details) { try { var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); var response = await client.DeleteAsync(servicesConfig.Wallet + WalletServiceOperation.DeleteWalletAdjustment(details.WalletAdjustmentId)); return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'DeleteWalletAdjustment()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Updates the WalletAdjustment. /// </summary> /// <param name="details">The details.</param> /// <param name="request">The request.</param> /// <returns></returns> public async Task <APIResponse> UpdateWalletAdjustment(WalletAdjustmentIdDetails details, UpdateWalletAdjustmentRequest request) { try { var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); var param = JsonConvert.SerializeObject(request); HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json"); var response = await client.PutAsync(servicesConfig.Wallet + WalletServiceOperation.UpdateWalletAdjustment(details.WalletAdjustmentId), contentPost); return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'UpdateWalletAdjustment()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Gets the WalletAdjustment. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> GetWalletAdjustmentDetails(WalletAdjustmentIdDetails details) { try { var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); var response = await client.GetAsync(servicesConfig.Wallet + WalletServiceOperation.GetWalletAdjustmentDetails(details.WalletAdjustmentId)); if (response.IsSuccessStatusCode) { var walletAdjustment = JsonConvert.DeserializeObject <WalletAdjustmentResponseDetails>(await response.Content.ReadAsStringAsync()); return(new APIResponse(walletAdjustment, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetWalletAdjustmentDetails()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }