/// <summary> /// Deletes the Wallet. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> DeleteWallet(WalletIdDetails details) { try { var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); var response = await client.DeleteAsync(servicesConfig.Wallet + WalletServiceOperation.DeleteWallet(details.WalletId)); return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'DeleteWallet()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Updates the Wallet. /// </summary> /// <param name="details">The details.</param> /// <param name="request">The request.</param> /// <returns></returns> public async Task <APIResponse> UpdateWallet(WalletIdDetails details, UpdateWalletRequest 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.UpdateWallet(details.WalletId, details.IsPaused, details.IsReleased, details.IsChurned), contentPost); return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'UpdateWallet()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Gets the Wallet. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> GetWalletDetails(WalletIdDetails details) { try { var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); var response = await client.GetAsync(servicesConfig.Wallet + WalletServiceOperation.GetWalletDetails(details.WalletId)); if (response.IsSuccessStatusCode) { var wallet = JsonConvert.DeserializeObject <WalletResponseDetails>(await response.Content.ReadAsStringAsync()); return(new APIResponse(wallet, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetWalletDetails()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }