public async Task <BalanceEnquiryResponse> GetBalanceEnquiry(BalanceEnquiryRequest request)
        {
            //EncData();
            BalanceEnquiryResponse br = new BalanceEnquiryResponse();

            var oralConnect = new OracleConnection(_protector.Unprotect(_appSettings.FlexConnection));

            using (oralConnect)
            {
                //Confirm if ther is phone number on this table
                string query = $@"select AC_DESC CUST_NAME, CCY CURRENCY, DECODE(ACCOUNT_TYPE, 'U', 'CURRENT ACCOUNT', 'S', 'SAVINGS ACCOUNT', 'NULL') ACCT_TYPE,
                              ACCOUNT_CLASS COD_PROD, CUST_AC_NO COD_ACCT_NO, acy_curr_balance UNCLEARD_BAL,
                              tod_limit+acy_curr_balance as BAL_AVAILABLE, BRANCH_CODE COD_CC_BRN
                              from {_appSettings.FlexSchema}.sttm_cust_account where cust_ac_no = :accountNumber and record_stat = 'O' and tod_limit> 0
                              and trunc(tod_limit_end_date) >= trunc(sysdate)";

                var brs = await oralConnect.QueryAsync <BalanceEnquiryResponse>(query, new { request.accountNumber });

                if (brs.Count() <= 0)
                {
                    string new_query = $@"SELECT AC_DESC CUST_NAME, CCY CURRENCY, DECODE(ACCOUNT_TYPE, 'U', 'CURRENT ACCOUNT', 'S', 'SAVINGS ACCOUNT', 'NULL') ACCT_TYPE,
                                  ACCOUNT_CLASS COD_PROD, CUST_AC_NO COD_ACCT_NO,  acy_curr_balance UNCLEARD_BAL,
                                  nvl({_appSettings.FlexSchema}.GET_AC_CUST_DLY_CLOSING_BAL(:accountNumber, sysdate), 0)  BAL_AVAILABLE,
                                  BRANCH_CODE COD_CC_BRN FROM {_appSettings.FlexSchema}.STTM_CUST_ACCOUNT  WHERE CUST_AC_NO = :accountNumber";

                    brs = await oralConnect.QueryAsync <BalanceEnquiryResponse>(new_query, new { request.accountNumber });
                }

                br = brs.FirstOrDefault();
            }
            return(br);
        }
        public async Task <Tuple <Models.Response, Response> > GetBalanceByAccountNumber(BalanceEnquiryRequest request)
        {
            BalanceEnquiryResponse br = new BalanceEnquiryResponse();
            Response res = new Response();

            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.beURL, content);

                    respCode      = (int)result.StatusCode;
                    respMsg       = result.ReasonPhrase;
                    resultContent = await result.Content.ReadAsStringAsync();
                };
            }
            catch (Exception ex)
            {
                respCode = (int)HttpStatusCode.InternalServerError;
                res      = new Response()
                {
                    message = ex.Message,
                    status  = false
                };
                _logger.LogInformation($"{request.accountNumber} : {ex.ToString()}");
            }

            res.message = respMsg;
            res.status  = respCode == (int)HttpStatusCode.Created || respCode == (int)HttpStatusCode.OK;

            if (!string.IsNullOrEmpty(resultContent))
            {
                if (!res.status)
                {
                    res = JsonHelper.fromJson <Response>(resultContent);
                }
                else
                {
                    br = JsonHelper.fromJson <BalanceEnquiryResponse>(resultContent);
                }
            }
            else
            {
                res = new Response()
                {
                    message = Constant.UKNOWN_MSG,
                    status  = false
                };
            }

            return(new Tuple <Models.Response, Response>(GetBalanceEnquiryResponse(br), res));
        }
 private Models.Response GetBalanceEnquiryResponse(BalanceEnquiryResponse br)
 {
     return(new Models.Response()
     {
         accountType = br.acct_type,
         availableBalance = StringToDecimal(br.bal_available),
         codAccountNumber = br.cod_acct_no,
         codCcBrn = br.cod_cc_brn,
         codProd = br.cod_prod,
         currency = br.currency,
         customerName = br.cust_name,
         uncleardBalance = StringToDecimal(br.uncleard_bal)
     });
 }