public CurrencyResponse GetCurrencyResponse(List <Rates> rates)
        {
            if (rates == null)
            {
                return(null);
            }

            CurrencyResponse resp = new CurrencyResponse()
            {
                status = "SUCCESSFUL"
            };

            PropertyInfo[] properties = typeof(CurrencyResponse).GetProperties();

            foreach (PropertyInfo property in properties)
            {
                foreach (var r in rates)
                {
                    if (r.ccy1 == property.Name)
                    {
                        property.SetValue(resp, r.rate);
                        break;
                    }
                }
            }

            return(resp);
        }
        public async Task <CurrencyResponse> GetRates()
        {
            CurrencyResponse response = new CurrencyResponse()
            {
                status = "FAILED"
            };

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

            using (oralConnect)
            {
                string query = $@"SELECT DISTINCT BRANCH_CODE, CCY1, CCY2, RATE_TYPE, MID_RATE AS RATE, RATE_DATE, 
                                  INT_AUTH_STAT FROM CYTM_RATES WHERE CCY1 IN ({getCcys(_settings.CCY1)}) 
                                  AND RATE_TYPE = '{_settings.RateType}' AND CCY2 = '{_settings.CCY2}' 
                                  AND INT_AUTH_STAT = '{_settings.IntAuthStat}' AND BRANCH_CODE = '{_settings.BranchCode}'";

                var r = await oralConnect.QueryAsync <Rates>(query);

                response = GetCurrencyResponse(r.ToList());
            }

            return(response);
        }