private RestRequest GetCreateRequest(TransactionRequest requestObj) { var request = new RestRequest(Method.POST); request.AddHeader(ApiEndPoints.ContentType, ApiEndPoints.ApplicationJson); request.AddHeader(ApiEndPoints.XChangeNowHeaderKey, _apiKey); request.AddParameter(ApiEndPoints.ApplicationJson, "{" + $"\n \"fromCurrency\": \"{requestObj.FromCurrency}\"," + $"\n \"toCurrency\": \"{requestObj.ToCurrency}\"," + $"\n \"fromNetwork\": \"{requestObj.FromNetwork}\"," + $"\n \"toNetwork\": \"{requestObj.ToNetwork}\"," + $"\n \"fromAmount\": \"{requestObj.FromAmount.ToString(CultureInfo.InvariantCulture)}\"," + $"\n \"toAmount\": \"{requestObj.ToAmount.ToString(CultureInfo.InvariantCulture)}\"," + $"\n \"address\": \"{requestObj.Address}\"," + $"\n \"extraId\": \"{requestObj.ExtraId}\"," + $"\n \"refundAddress\": \"{requestObj.RefundAddress}\"," + $"\n \"refundExtraId\": \"{requestObj.RefundExtraId}\"," + $"\n \"userId\": \"{requestObj.UserId}\"," + $"\n \"payload\": \"{requestObj.PayLoad}\"," + $"\n \"contactEmail\": \"{requestObj.ConactEmail}\"," + $"\n \"source\": \"\"," + $"\n \"flow\": \"{FlowEnumConverter.ToString(requestObj.Flow)}\"," + $"\n \"type\": \"{DirectionEnumConverter.ToString(requestObj.Type)}\"," + $"\n \"rateId\": \"{requestObj.RateID}\"" + $"\n" + "}", ParameterType.RequestBody); return(request); }
private string GetExchangeRangeQueryString(ExchangeRangeRequest request) { return($"{ApiEndPoints.Exchange}range?fromCurrency={request.FromCurrency}&toCurrency={request.ToCurrency}&fromNetwork={request.FromNetwork}&toNetwork={request.ToNetwork}&flow={FlowEnumConverter.ToString(request.Flow)}"); }
private string GetMinimalExchangeAmountQueryString(MinimalExchangeRequest request) { return($"{ApiEndPoints.Exchange}min-amount?fromCurrency={request.FromCurrency}&toCurrency={request.ToCurrency}&fromNetwork={request.FromNetwork}&toNetwork={request.ToNetwork}&flow={FlowEnumConverter.ToString(request.Flow)}"); }
private string GetAvailableCurrencyQueryString(CurrencyRequest request) { return($"{ApiEndPoints.Exchange}currencies?active={request.Active}&flow={FlowEnumConverter.ToString(request.Flow)}&buy={request.Buy}&sell={ request.Sell}"); }
private string GetGetEstimatedExchangeAmountQueryString(EstimatedExchangeAmountRequest request) { return($"{ApiEndPoints.Exchange}estimated-amount?fromCurrency={request.FromCurrency}&toCurrency={request.ToCurrency}&fromAmount={request.FromAmount.ToString(CultureInfo.InvariantCulture)}&toAmount={request.ToAmount.ToString(CultureInfo.InvariantCulture)}&fromNetwork={request.FromNetwork}&toNetwork={request.ToNetwork}&flow={FlowEnumConverter.ToString(request.Flow)}&type={DirectionEnumConverter.ToString(request.Type)}&useRateId={request.UseRateId}"); }