public string LaunchProviderPortal()
        {
            if (!System.IO.Directory.Exists(LaunchDirectory))
            {
                System.IO.Directory.CreateDirectory(LaunchDirectory);
            }
            ConfigProfileCollection ConfigProfileList = SerializerSupport.DeserializeFrom <ConfigProfileCollection>(ConfigProfileFilePath);
            var CurrentProfile             = ConfigProfileList.ProfileList.SingleOrDefault(x => x.Key == ConfigProfileList.SelectedProfileKey);
            X509Certificate2      Cert     = CertificateSupport.GetCertificate(CurrentProfile.CertificateFingerPrint, X509FindType.FindByThumbprint, StoreName.My, StoreLocation.CurrentUser, true);
            MhrRestClient         Client   = new MhrRestClient(CurrentProfile.Endpoint, CurrentProfile.ClientId, Cert, CurrentProfile.ProductName, CurrentProfile.ProductVersion);
            MhrRestClientResponse Response = Client.GetAccessToNpp(CurrentProfile.Hpio, CurrentProfile.Hpii, LauncherVM.Dob.ToString("dd-MM-yyyy"), LauncherVM.Gender, LauncherVM.Family, LauncherVM.Ihi, LauncherVM.MedicareNumber, LauncherVM.DvaNumber);

            if (Response.HttpStatus == System.Net.HttpStatusCode.OK)
            {
                System.IO.StreamWriter sw = new System.IO.StreamWriter(FastPassLauncherHtmlFileName);
                sw.WriteLine(Response.Content);
                sw.Close();
                System.Diagnostics.Process.Start(FastPassLauncherHtmlFileName);
                return(string.Empty);
            }
            else
            {
                return($"{Response.Message}");
            }
        }
Example #2
0
        public void Sample()
        {
            // ------------------------------------------------------------------------------
            // Set up
            // ------------------------------------------------------------------------------

            // Set the URL for the CIStoNPP endpoint- uses B2B endpoint + CIStoNPP
            string b2bEndpoint = "https://b2b.ehealthvendortest.health.gov.au/";
            string url         = b2bEndpoint + "CIStoNPP";

            // Provide Client id allocated by the NIO when registering for this interface
            string clientId = "<Client id>";

            // Provide the product name and version registered
            string productName    = "<Product Name>";
            string productVersion = "<Product Version>";

            // Obtain the certificate by serial number
            // Obtain the certificate by thumbprint
            X509Certificate2 clientCert = GetCertificate("Thumbprint", X509FindType.FindByThumbprint, StoreName.My, StoreLocation.CurrentUser, true);

            // Read the HPIO out of the certificate
            string hpio = (clientCert != null ? clientCert.Subject.Split('.')[1] : "");

            // Create client
            MhrRestClient client = new MhrRestClient(url, clientId, clientCert, productName, productVersion);

            // Add HPII of provider accessing portal
            string hpii = "<HPI-I number";

            // Populate data from patient details
            // Get patient identifier - ONLY one of these
            string ihi = "<Either: ihi number";
            string mcn = "<or: medicare number";
            string dva = "<or: dva number";
            // Patient demographics
            string dob    = Convert.ToDateTime("DOB").ToString("dd-MM-yyyy");;
            string gender = "M, F, U or I";
            string family = "Surname only";


            // Set up the request
            try
            {
                //HTTP Response
                string response = client.GetAccessToNpp(hpio, hpii, dob, gender, family, ihi, mcn, dva);

                if (response != null)
                {
                    // Display the response in a webbrowser that has internet access
                    WebBrowser webBrowser = new WebBrowser()
                    {
                        DocumentText = response
                    };
                }
            }
            catch (Exception)
            {
                // If an error is encountered, look at client.restResponse
                // for detailed description of the error.
                IRestResponse lookAtStatusCode = client.restResponse;
            }
        }