public async Task <FundsTransferResponse> CashDeposit(CashDepositRequest request) { FundsTransferResponse res = new FundsTransferResponse(); string reqString; string respMsg = string.Empty; string resultContent = string.Empty; int respCode = 0; try { using (var client = new HttpClient()) { reqString = JsonHelper.toJson(request); var content = new StringContent(reqString, Encoding.UTF8, Constant.CONTENTTYPE); var result = await client.PostAsync(_settings.baseURL + _settings.peURL, content); respCode = (int)result.StatusCode; respMsg = result.ReasonPhrase; resultContent = await result.Content.ReadAsStringAsync(); }; } catch (TaskCanceledException tex) { respCode = (int)HttpStatusCode.RequestTimeout; res = new FundsTransferResponse() { message = Constant.TIMEOUT_MSG, status = Constant.TIMEOUT_STATUS }; _logger.LogInformation($"{request.cract} {request.trnrefno} : {tex.ToString()}"); } catch (Exception ex) { respCode = (int)HttpStatusCode.InternalServerError; res = new FundsTransferResponse() { message = ex.Message, status = Constant.FAILED_STATUS }; _logger.LogInformation($"{request.cract} {request.trnrefno} : {ex.ToString()}"); } if (!string.IsNullOrEmpty(resultContent)) { res = JsonHelper.fromJson <FundsTransferResponse>(resultContent); } else { res.message = Constant.UKNOWN_MSG; res.status = Constant.UKNOWN_STATUS; } return(res); }
public Models.Response GetFTResponse(FundsTransferResponse r) { return(new Models.Response() { actualTrnAmt = r.actualtrnamt, message = r.message, rate = r.rate, status = r.status, trnRefNo = r.trnrefno }); }