Exemplo n.º 1
0
        public List <string> GetModules(ProviderRegistrationRequest request)
        {
            var modules = new List <string>
            {
                //default
                Modules.Eligibility.ToString(),
                Modules.Claims.ToString(),
                Modules.PriorAuth.ToString()
            };

            //custom
            if (request.NeedsEE)
            {
                modules.Add(Modules.EnhancedEncounter.ToString());
            }
            ;
            if (request.NeedsFTP)
            {
                modules.Add(Modules.FileUpload.ToString());
            }
            ;
            if (request.NeedsQPP)
            {
                modules.Add(Modules.QPP.ToString());
            }

            return(modules);
        }
Exemplo n.º 2
0
        public List <AgreementDocRegistrationModel> GetAgreementDocs(ProviderRegistrationRequest request)
        {
            var docs = new List <AgreementDocRegistrationModel>();

            //TODO: get agreement document information
            return(docs);
        }
        public HttpResponseMessage RoadZenAccountProviderRegistration(ProviderRegistrationRequest registrationRequest)
        {
            Services.Log.Info("New Account Provider Registration Request [API]");

            // Phone Number SS Validation
            if (!Regex.IsMatch(registrationRequest.Phone, "^[0-9]{10}$"))
            {
                Services.Log.Warn("Invalid phone number (must be 10 numeric digits");
                return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid phone number (must be 10 numeric digits"));
            }
            if (!RegexUtilities.IsValidEmail(registrationRequest.Email))
            {
                Services.Log.Warn("Invalid e-mail address");
                return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid e-mail address"));
            }

            // Get the logged-in user.
            var currentUser = this.User as ServiceUser;

            stranddContext context = new stranddContext();

            Account account = context.Accounts.Where(a => a.Phone == registrationRequest.Phone).SingleOrDefault();

            if (account != null)
            {
                string responseText = "Phone Number Already Registered";
                Services.Log.Warn(responseText);
                return(this.Request.CreateResponse(HttpStatusCode.BadRequest, WebConfigurationManager.AppSettings["RZ_MobileClientUserWarningPrefix"] + responseText));
            }

            //Password SS Validation
            if (registrationRequest.Password.Length < 6)
            {
                Services.Log.Warn("Invalid password (at least 6 chars required)");
                return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid password (at least 6 chars required)"));
            }

            byte[] salt = RoadZenSecurityUtils.generateSalt();

            Guid guid = Guid.NewGuid();

            Account newUserAccount = new Account
            {
                Id                      = guid.ToString(),
                Name                    = registrationRequest.Name,
                Phone                   = registrationRequest.Phone,
                Email                   = registrationRequest.Email,
                ProviderUserID          = "RoadZen:" + guid.ToString("N").ToUpper(),
                Salt                    = salt,
                SaltedAndHashedPassword = RoadZenSecurityUtils.hash(registrationRequest.Password, salt)
            };

            context.Accounts.Add(newUserAccount);
            context.SaveChanges();

            Services.Log.Info("Account for [" + newUserAccount.ProviderUserID + "] has been created");
            return(this.Request.CreateResponse(HttpStatusCode.Created, "Account for [" + newUserAccount.ProviderUserID + "] has been created"));
        }
Exemplo n.º 4
0
        //POST registration
        public async Task RegisterNewAccountAsync(ProviderRegistrationRequest request)
        {
            try
            {
                var dto = new AccountRegistrationModel()
                {
                    UserName                 = request.Username,
                    Email                    = request.Email,
                    FirstName                = request.FirstName,
                    LastName                 = request.LastName,
                    PracticeName             = request.ProviderCompany,
                    Tin                      = request.ProviderTaxId,
                    UserPracticeRelation     = string.Empty,
                    PracticeAultCareRelation = string.Empty,
                    PhysicianName            = request.ProviderPhysician,
                    PhysicianPhone           = request.ProviderPhone,
                    VoucherNumber            = string.Empty,
                    ClaimNumber              = string.Empty,
                    Phone                    = request.Phone,
                    Role                     = request.Position,
                    Address                  = new AddressModel()
                    {
                        Address1   = request.ProviderAddress1,
                        Address2   = request.ProviderAddress2,
                        City       = request.ProviderCity,
                        PostalCode = request.ProviderZip,
                        State      = request.ProviderState,
                        CountryId  = 78, //TODO: Stop hardcoding this. 78 is United States in all db environments.
                    },
                    TwoFA = new MultiFactorMethodVM()
                    {
                        Method = 0, MethodValue = "None"
                    },
                    AgreementDocs = new List <AgreementDocRegistrationModel>(),
                    NpiNumbers    = new List <string>()
                    {
                        request.ProviderNPI
                    },
                    RequestedModules = GetModules(request)
                };

                var registrationEndpoint = _httpClient.BaseAddress + "api/Account/register";
                var objectJson           = JsonSerializer.Serialize(dto);
                var buffer      = System.Text.Encoding.UTF8.GetBytes(objectJson);
                var byteContent = new ByteArrayContent(buffer);
                byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

                _log.LogInformation("Beginning POST to AccountService to register provider account for {firstname} {lastname}, with email {email}, for username {username}.", dto.FirstName, dto.LastName, dto.Email, dto.UserName);
                HttpResponseMessage response = await _httpClient.PostAsync(registrationEndpoint, byteContent);

                _log.LogInformation("Finished posting to AccountService to register provider account for {firstname} {lastname}, with email {email}, for username {username}. Response: {statusCode}", dto.FirstName, dto.LastName, dto.Email, dto.UserName, response.StatusCode);
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "Error when submitting provider registration to AccountService for {firstname} {lastname}, with email {email} and username {username}.", request.FirstName, request.LastName, request.Email, request.Username);
            }
        }
        /// <summary>
        /// Executes the cmdlet
        /// </summary>
        protected override void OnProcessRecord()
        {
            ProviderRegistrationRequest providerRegistrationRequest = default;

            if (ConsentToPermissions)
            {
                providerRegistrationRequest = new ProviderRegistrationRequest(new ProviderConsentDefinition(this.ConsentToPermissions));
            }

            this.ConfirmAction(
                processMessage: ProjectResources.RegisterProviderMessage,
                target: this.ProviderNamespace,
                action: () => this.WriteObject(this.ResourceManagerSdkClient.RegisterProvider(providerName: this.ProviderNamespace, providerRegistrationRequest: providerRegistrationRequest)));
        }
        public async Task ProcessAsync(ACFormProcessor processor, FormEntry formEntry)
        {
            try
            {
                var mappings = JsonSerializer.Deserialize <Dictionary <string, string> >(processor.ConversionSpec);

                var formData = JsonSerializer.Deserialize <FormData>(formEntry.Data);


                //this gets the data from the form based on the conversion spec
                _logger.LogInformation("Creating ProviderRegistration submission for FormEntry {formEntry}", formEntry.Id);
                //"UserName": "******",
                formData.data.TryGetValue(mappings["UserName"], out var username);
                //"FirstName": "user-firstname",
                formData.data.TryGetValue(mappings["FirstName"], out var firstname);
                //"MiddleInitial": "user-middleinitial",
                formData.data.TryGetValue(mappings["MiddleInitial"], out var middleInitial);
                //"LastName": "user-lastname",
                formData.data.TryGetValue(mappings["LastName"], out var lastname);
                //"Email": "user-email",
                formData.data.TryGetValue(mappings["Email"], out var email);
                //"Phone": "user-phonenumber",
                formData.data.TryGetValue(mappings["Phone"], out var phone);
                //"Position": "user-position",
                formData.data.TryGetValue(mappings["Position"], out var position);
                //"ProviderNPI": "provider-npi",
                formData.data.TryGetValue(mappings["ProviderNPI"], out var providerNpi);
                //"ProviderTaxId": "provider-taxid",
                formData.data.TryGetValue(mappings["ProviderTaxId"], out var providerTaxId);
                //"ProviderPhysician": "provider-physicianname",
                formData.data.TryGetValue(mappings["ProviderPhysician"], out var providerPhysician);
                //"ProviderCompany": "provider-companyname",
                formData.data.TryGetValue(mappings["ProviderCompany"], out var providerCompany);
                //"ProviderPhone": "provider-companyphone",
                formData.data.TryGetValue(mappings["ProviderPhone"], out var providerPhone);
                //"ProviderAddress1": "provider-addressline1",
                formData.data.TryGetValue(mappings["ProviderAddress1"], out var providerAddress1);
                //"ProviderAddress2": "provider-addressline2",
                formData.data.TryGetValue(mappings["ProviderAddress2"], out var providerAddress2);
                //"ProviderCity": "provider-city",
                formData.data.TryGetValue(mappings["ProviderCity"], out var providerCity);
                //"ProviderState": "provider-state",
                formData.data.TryGetValue(mappings["ProviderState"], out var providerState);
                //"ProviderZip": "provider-Zip",
                formData.data.TryGetValue(mappings["ProviderZip"], out var providerZip);
                //"AccessNeeds": "access-needs",
                formData.data.TryGetValue(mappings["AccessNeeds"], out var accessNeeds);
                //"AccessReason": "access-reason",
                formData.data.TryGetValue(mappings["AccessReason"], out var accessReason);
                //"AccessComments": "access-comments",
                formData.data.TryGetValue(mappings["AccessComments"], out var comments);
                //"NeedsECPA": "access-ecpa",
                formData.data.TryGetValue(mappings["NeedsECPA"], out var needsECPA);
                //"NeedsEE": "access-ee",
                formData.data.TryGetValue(mappings["NeedsEE"], out var needsEE);
                //"NeedsQPP": "access-qpp",
                formData.data.TryGetValue(mappings["NeedsQPP"], out var needsQPP);
                //"NeedsFTP": "access-ftp",
                formData.data.TryGetValue(mappings["NeedsFTP"], out var needsFTP);
                //"IPAddresses": "access-ftp-ips",
                formData.data.TryGetValue(mappings["IPAddresses"], out var ipAddresses);

                var registrationRequest = new ProviderRegistrationRequest
                {
                    FormEntryId    = formEntry.Id,
                    PDFPath        = $"{formEntry.Id}",
                    SubmissionDate = formEntry.SubmissionDate.GetValueOrDefault(),

                    Username          = username?.ToString(),
                    FirstName         = firstname?.ToString(),
                    MiddleInitial     = middleInitial?.ToString(),
                    LastName          = lastname?.ToString(),
                    Email             = email?.ToString(),
                    Phone             = phone?.ToString(),
                    Position          = position?.ToString(),
                    ProviderNPI       = providerNpi?.ToString(),
                    ProviderTaxId     = providerTaxId?.ToString(),
                    ProviderPhysician = providerPhysician?.ToString(),
                    ProviderCompany   = providerCompany?.ToString(),
                    ProviderPhone     = providerPhone?.ToString(),
                    ProviderAddress1  = providerAddress1?.ToString(),
                    ProviderAddress2  = providerAddress2?.ToString(),
                    ProviderCity      = providerCity?.ToString(),
                    ProviderState     = providerState?.ToString(),
                    ProviderZip       = providerZip?.ToString(),
                    AccessNeeds       = accessNeeds?.ToString(),
                    AccessReason      = accessReason?.ToString(),
                    AccessComments    = comments?.ToString(),
                    IPAddresses       = ipAddresses?.ToString(),
                    NeedsECPA         = needsECPA as bool? ?? false,
                    NeedsEE           = needsEE as bool? ?? false,
                    NeedsQPP          = needsQPP as bool? ?? false,
                    NeedsFTP          = needsFTP as bool? ?? false,
                };

                await _registrationDb.AddAsync(registrationRequest);

                await _registrationDb.SaveChangesAsync();

                _logger.LogInformation("Registration submission for FormEntry {formEntry} successfully created", formEntry.Id);

                await _accountService.RegisterNewAccountAsync(registrationRequest);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error submitting registration for Form Entry {formEntry}", formEntry.Id);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Registers a subscription with a resource provider.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceProviderNamespace'>
 /// The namespace of the resource provider to register.
 /// </param>
 /// <param name='properties'>
 /// The third party consent for S2S.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Provider> RegisterAsync(this IProvidersOperations operations, string resourceProviderNamespace, ProviderRegistrationRequest properties = default(ProviderRegistrationRequest), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RegisterWithHttpMessagesAsync(resourceProviderNamespace, properties, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Registers a subscription with a resource provider.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceProviderNamespace'>
 /// The namespace of the resource provider to register.
 /// </param>
 /// <param name='properties'>
 /// The third party consent for S2S.
 /// </param>
 public static Provider Register(this IProvidersOperations operations, string resourceProviderNamespace, ProviderRegistrationRequest properties = default(ProviderRegistrationRequest))
 {
     return(operations.RegisterAsync(resourceProviderNamespace, properties).GetAwaiter().GetResult());
 }