Пример #1
0
        public bool CertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            Eligible  eligble     = Eligible.Instance;
            ArrayList fingerprint = eligble.Fingerprints();

            if (certificate == null || chain == null)
            {
                return(false);
            }

            if (errors != SslPolicyErrors.None)
            {
                return(false);
            }

            bool is_white_listed_domain = false;

            foreach (string domain in eligble.WhiteListedDomains)
            {
                if (certificate.Subject.Contains(domain))
                {
                    is_white_listed_domain = true;
                }
            }

            if (is_white_listed_domain)
            {
                return(fingerprint.Contains(certificate.GetCertHashString()));
            }
            else
            {
                return(true);
            }
        }
        public static string FormatJson(string jsonParams, RequestOptions options)
        {
            JObject  jobject  = JObject.Parse(jsonParams);
            Eligible eligible = Eligible.Instance;

            return(AddingOptionsToJson(options, jobject));
        }
        public static RequestOptions SetRequestOptionsObject(RequestOptions options)
        {
            Eligible eligible = Eligible.Instance;

            if (options != null)
            {
                if (string.IsNullOrEmpty(options.ApiKey))
                {
                    options.ApiKey = eligible.ApiKey;
                }

                if (!options.IsTest.HasValue)
                {
                    if (eligible.IsTest.HasValue)
                    {
                        options.IsTest = eligible.IsTest;
                    }
                    else
                    {
                        options.IsTest = false;
                    }
                }
            }
            else
            {
                options        = new RequestOptions();
                options.ApiKey = eligible.ApiKey;
                options.IsTest = eligible.IsTest;
            }

            return(options);
        }
        public bool CertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            Eligible eligble = Eligible.Instance;

            ArrayList fingerprint = eligble.Fingerprints();

            if (certificate == null || chain == null)
            {
                return(false);
            }

            if (errors != SslPolicyErrors.None)
            {
                return(false);
            }

            var certFingerprint = certificate.GetCertHashString();

            if (!fingerprint.Contains(certFingerprint))
            {
                return(false);
            }

            return(true);
        }
Пример #5
0
        public static void SetConfiguration()
        {
            Eligible config = Eligible.Instance;
            string   value  = TestResource.apikey;

            config.ApiKey = (String.IsNullOrEmpty(value)) ? Environment.GetEnvironmentVariable("apikey") : value;
            config.IsTest = true;
        }
        public void CostEstimatesAuthenticationExceptionTest()
        {
            Eligible eligible = Eligible.Instance;

            eligible.ApiKey = "invalid key";
            eligible.IsTest = true;

            CostEstimatesResponse actualResponse = costEstimates.Get(CostEstimatesParams());
        }
Пример #7
0
        public void ClaimCreateAuthenticationExpceptionTest()
        {
            Eligible config = Eligible.Instance;

            config.ApiKey = "Invalid key";
            config.IsTest = true;

            ClaimResponse actualResponse = claim.Create(ClaimInput);
        }
Пример #8
0
        public void InvalidBaseUrlOptionTest()
        {
            Eligible       config  = Eligible.Instance;
            RequestOptions options = new RequestOptions();

            options.IsTest  = true;
            options.ApiKey  = config.ApiKey;
            options.BaseUrl = "https://www.example.com/";
            Hashtable input = JsonConvert.DeserializeObject <Hashtable>(ClaimInput);

            ClaimResponse actualResponse = claim.Create(input, options);
        }
Пример #9
0
        public bool Insert(Eligible eligible)
        {
            int         autonumber        = 0;
            EligibleDAC eligibleComponent = new EligibleDAC();
            bool        endedSuccessfuly  = eligibleComponent.InsertNewEligible(ref autonumber, eligible.PatientId, eligible.PatientName, eligible.NationalityId, eligible.Age, eligible.Mobile, eligible.Fax, eligible.Email, eligible.TransferredFrom, eligible.CurrentTransferredToDepartmentId, eligible.CurrentEligibilityStatusId, eligible.IsAdmitted, eligible.AdmissionApointmentDate, eligible.Ward, eligible.IsOPDAppointment, eligible.OPDAppointmentDate, eligible.HomePhone, eligible.Clinic, eligible.IsFurtherInvestigationDoneInReferringHospital, eligible.IsPatientCantBeAccommodatedForBedUnavailability, eligible.IsNothingAdditionalCanBeOfferedRightMedication, eligible.IsNothingAdditionalCanBeOfferedIsTerminal, eligible.IsMedicalReportIncomplete, eligible.IsNotAvailableSpeciality, eligible.IsOtherReason, eligible.OtherReason, eligible.ConsultantName, eligible.DivisionID, eligible.ConsultantID);

            if (endedSuccessfuly)
            {
                eligible.EligibleId = autonumber;
            }
            return(endedSuccessfuly);
        }
Пример #10
0
        public void ValidBaseUrlOptionTest()
        {
            Eligible       config  = Eligible.Instance;
            RequestOptions options = new RequestOptions();

            options.IsTest  = true;
            options.ApiKey  = config.ApiKey;
            options.BaseUrl = "https://gds.eligibleapi.com/";
            Hashtable input = JsonConvert.DeserializeObject <Hashtable>(ClaimInput);

            ClaimResponse actualResponse = claim.Create(input, options);

            Assert.IsNotNull(actualResponse.JsonResponse());
        }
Пример #11
0
        public void ClaimCreateAuthenticationExpceptionTest()
        {
            Eligible config = Eligible.Instance;

            config.ApiKey = "Invalid key";
            config.IsTest = true;

            try
            {
                ClaimResponse actualResponse = claim.Create(ClaimInput);
            }
            catch (Exception ex)
            {
                Assert.AreEqual("Could not authenticate you. Please re-try with a valid API key.", ex.Message);
            }
        }
Пример #12
0
 public void Setup()
 {
     eligible = Eligible.Instance;
     execute  = new RequestExecute();
 }
Пример #13
0
        public Eligible GetByID(int _eligibleId)
        {
            EligibleDAC _eligibleComponent = new EligibleDAC();
            IDataReader reader             = _eligibleComponent.GetByIDEligible(_eligibleId);
            Eligible    _eligible          = null;

            while (reader.Read())
            {
                _eligible = new Eligible();
                if (reader["EligibleId"] != DBNull.Value)
                {
                    _eligible.EligibleId = Convert.ToInt32(reader["EligibleId"]);
                }
                if (reader["PatientId"] != DBNull.Value)
                {
                    _eligible.PatientId = Convert.ToString(reader["PatientId"]);
                }
                if (reader["PatientName"] != DBNull.Value)
                {
                    _eligible.PatientName = Convert.ToString(reader["PatientName"]);
                }
                if (reader["NationalityId"] != DBNull.Value)
                {
                    _eligible.NationalityId = Convert.ToString(reader["NationalityId"]);
                }
                if (reader["Age"] != DBNull.Value)
                {
                    _eligible.Age = Convert.ToInt32(reader["Age"]);
                }
                if (reader["Mobile"] != DBNull.Value)
                {
                    _eligible.Mobile = Convert.ToString(reader["Mobile"]);
                }
                if (reader["Fax"] != DBNull.Value)
                {
                    _eligible.Fax = Convert.ToString(reader["Fax"]);
                }
                if (reader["Email"] != DBNull.Value)
                {
                    _eligible.Email = Convert.ToString(reader["Email"]);
                }
                if (reader["TransferredFrom"] != DBNull.Value)
                {
                    _eligible.TransferredFrom = Convert.ToString(reader["TransferredFrom"]);
                }
                if (reader["CurrentTransferredToDepartmentId"] != DBNull.Value)
                {
                    _eligible.CurrentTransferredToDepartmentId = Convert.ToInt32(reader["CurrentTransferredToDepartmentId"]);
                }
                if (reader["CurrentEligibilityStatusId"] != DBNull.Value)
                {
                    _eligible.CurrentEligibilityStatusId = Convert.ToInt32(reader["CurrentEligibilityStatusId"]);
                }
                if (reader["IsAdmitted"] != DBNull.Value)
                {
                    _eligible.IsAdmitted = Convert.ToBoolean(reader["IsAdmitted"]);
                }
                if (reader["AdmissionApointmentDate"] != DBNull.Value)
                {
                    _eligible.AdmissionApointmentDate = Convert.ToDateTime(reader["AdmissionApointmentDate"]);
                }
                if (reader["Ward"] != DBNull.Value)
                {
                    _eligible.Ward = Convert.ToString(reader["Ward"]);
                }
                if (reader["IsOPDAppointment"] != DBNull.Value)
                {
                    _eligible.IsOPDAppointment = Convert.ToBoolean(reader["IsOPDAppointment"]);
                }
                if (reader["OPDAppointmentDate"] != DBNull.Value)
                {
                    _eligible.OPDAppointmentDate = Convert.ToDateTime(reader["OPDAppointmentDate"]);
                }
                if (reader["HomePhone"] != DBNull.Value)
                {
                    _eligible.HomePhone = Convert.ToString(reader["HomePhone"]);
                }
                if (reader["Clinic"] != DBNull.Value)
                {
                    _eligible.Clinic = Convert.ToString(reader["Clinic"]);
                }
                if (reader["IsFurtherInvestigationDoneInReferringHospital"] != DBNull.Value)
                {
                    _eligible.IsFurtherInvestigationDoneInReferringHospital = Convert.ToBoolean(reader["IsFurtherInvestigationDoneInReferringHospital"]);
                }
                if (reader["IsPatientCantBeAccommodatedForBedUnavailability"] != DBNull.Value)
                {
                    _eligible.IsPatientCantBeAccommodatedForBedUnavailability = Convert.ToBoolean(reader["IsPatientCantBeAccommodatedForBedUnavailability"]);
                }
                if (reader["IsNothingAdditionalCanBeOfferedRightMedication"] != DBNull.Value)
                {
                    _eligible.IsNothingAdditionalCanBeOfferedRightMedication = Convert.ToBoolean(reader["IsNothingAdditionalCanBeOfferedRightMedication"]);
                }
                if (reader["IsNothingAdditionalCanBeOfferedIsTerminal"] != DBNull.Value)
                {
                    _eligible.IsNothingAdditionalCanBeOfferedIsTerminal = Convert.ToBoolean(reader["IsNothingAdditionalCanBeOfferedIsTerminal"]);
                }
                if (reader["IsMedicalReportIncomplete"] != DBNull.Value)
                {
                    _eligible.IsMedicalReportIncomplete = Convert.ToBoolean(reader["IsMedicalReportIncomplete"]);
                }
                if (reader["IsNotAvailableSpeciality"] != DBNull.Value)
                {
                    _eligible.IsNotAvailableSpeciality = Convert.ToBoolean(reader["IsNotAvailableSpeciality"]);
                }
                if (reader["IsOtherReason"] != DBNull.Value)
                {
                    _eligible.IsOtherReason = Convert.ToBoolean(reader["IsOtherReason"]);
                }
                if (reader["OtherReason"] != DBNull.Value)
                {
                    _eligible.OtherReason = Convert.ToString(reader["OtherReason"]);
                }
                if (reader["ConsultantName"] != DBNull.Value)
                {
                    _eligible.ConsultantName = Convert.ToString(reader["ConsultantName"]);
                }
                if (reader["ConsultantID"] != DBNull.Value)
                {
                    _eligible.ConsultantID = Convert.ToInt32(reader["ConsultantID"]);
                }
                if (reader["DivisionID"] != DBNull.Value)
                {
                    _eligible.DivisionID = Convert.ToInt32(reader["DivisionID"]);
                }
                _eligible.NewRecord = false;
            }
            reader.Close();
            return(_eligible);
        }
Пример #14
0
        public bool Update(Eligible eligible, int old_eligibleId)
        {
            EligibleDAC eligibleComponent = new EligibleDAC();

            return(eligibleComponent.UpdateEligible(eligible.PatientId, eligible.PatientName, eligible.NationalityId, eligible.Age, eligible.Mobile, eligible.Fax, eligible.Email, eligible.TransferredFrom, eligible.CurrentTransferredToDepartmentId, eligible.CurrentEligibilityStatusId, eligible.IsAdmitted, eligible.AdmissionApointmentDate, eligible.Ward, eligible.IsOPDAppointment, eligible.OPDAppointmentDate, eligible.HomePhone, eligible.Clinic, eligible.IsFurtherInvestigationDoneInReferringHospital, eligible.IsPatientCantBeAccommodatedForBedUnavailability, eligible.IsNothingAdditionalCanBeOfferedRightMedication, eligible.IsNothingAdditionalCanBeOfferedIsTerminal, eligible.IsMedicalReportIncomplete, eligible.IsNotAvailableSpeciality, eligible.IsOtherReason, eligible.OtherReason, eligible.ConsultantName, eligible.DivisionID, eligible.ConsultantID, old_eligibleId));
        }