public async Task <FundsTransferResponse> ValidateTransactionByRef(_StatusRequest _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(_appSettings.baseURL + _appSettings.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.transactionRef} : {tex.ToString()}"); } catch (Exception ex) { respCode = (int)HttpStatusCode.InternalServerError; res = new FundsTransferResponse() { message = ex.Message, status = Constant.FAILED_STATUS }; _logger.LogInformation($"{_request.transactionRef} : {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 async Task <FundsTransferResponse> ValidateTransactionByRef(string transactionRef) { FundsTransferResponse response = new FundsTransferResponse(); var oralConnect = new OracleConnection(_protector.Unprotect(_appSettings.FlexConnection)); using (oralConnect) { string query = $@"SELECT * FROM {_appSettings.FlexSchema}.ACTB_DAILY_LOG WHERE AUTH_STAT = ‘A’ AND TRN_REF_NO = :transactionRef"; var r = await oralConnect.QueryAsync <string>(query, new { transactionRef }); response.message = r.FirstOrDefault(); if (!string.IsNullOrWhiteSpace(response.message)) { response.status = "true"; } } return(response); }