public IHttpActionResult GetAccountSettings()
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("GetAccountSettings Call Recevied.");
         }
         return(Ok(_userApplicationService.GetAccountSettings(HeaderParamUtility.GetApikey(Request))));
     }
     catch (InstanceNotFoundException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (NullReferenceException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult SubmitMfaSettings(MfaSettingsParams mfaSettingsParams)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("Submit Email Settings Call Recevied");
         }
         string apikey = HeaderParamUtility.GetApikey(Request);
         if (!string.IsNullOrEmpty(apikey))
         {
             List <Tuple <string, string, bool> > mfaSettingsList = new List <Tuple <string, string, bool> >();
             foreach (var setting in mfaSettingsParams.MfaSettingsList)
             {
                 mfaSettingsList.Add(new Tuple <string, string, bool>(setting.MfaSubscriptionId,
                                                                      setting.MfaSubscriptionName, setting.Enabled));
             }
             return(Ok(_userApplicationService.SubmitMfaSettings(new MfaSettingsCommand(mfaSettingsParams.ApiKeyMfa,
                                                                                        mfaSettingsParams.ApiKeyPassword, apikey, mfaSettingsList))));
         }
         else
         {
             throw new Exception("API Key not recieved");
         }
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidDataException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult SubmitEmailSettings(EmailSettingsParams emailSettingsParams)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("Submit Email Settings Call Recevied");
         }
         string apikey = HeaderParamUtility.GetApikey(Request);
         if (!string.IsNullOrEmpty(apikey))
         {
             return(Ok(_userApplicationService.SubmitEmailSettings(new EmailSettingsCommand(apikey,
                                                                                            emailSettingsParams.AdministrativeEmails, emailSettingsParams.NewsLetterEmails))));
         }
         else
         {
             throw new Exception("API Key not recieved");
         }
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidDataException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Submit Email Settings Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult GetVerifyForTier2([FromBody] Tier2Param param)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("GetVerifyForTier2 Call Recevied, parameters:" + param);
         }
         _userTierLevelApplicationService.ApplyForTier2Verification(
             new VerifyTier2Command(HeaderParamUtility.GetApikey(Request), param.AddressLine1, param.AddressLine2,
                                    param.AddressLine3, param.State, param.City, param.ZipCode));
         return(Ok());
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier2 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier2 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (ArgumentNullException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier2 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier2 Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult ChangePassword([FromBody] ChangePasswordParams changePasswordParams)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("ChangePassword Call Recevied, parameters:" + changePasswordParams);
         }
         return(Ok(_userApplicationService.ChangePassword(new ChangePasswordCommand(
                                                              HeaderParamUtility.GetApikey(Request), changePasswordParams.OldPassword,
                                                              changePasswordParams.NewPassword))));
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangePassword Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangePassword Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (ArgumentNullException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangePassword Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangePassword Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult DeleteSecurityKeyPair(string keyDescription)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("DeleteSecurityKeyPair Call Recevied, keyDescription:" + keyDescription);
         }
         _securityKeysApplicationService.DeleteSecurityKeyPair(keyDescription,
                                                               HeaderParamUtility.GetApikey(Request));
         return(Ok());
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("DeleteSecurityKeyPair Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("DeleteSecurityKeyPair Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidDataException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("DeleteSecurityKeyPair Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("DeleteSecurityKeyPair Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult GetTier3Details()
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("GetTier2Details Call Recevied");
         }
         return(Ok(_userTierLevelApplicationService.GetTier3Details(HeaderParamUtility.GetApikey(Request))));
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetTier2Details Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetTier2Details Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (ArgumentNullException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetTier2Details Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetTier2Details Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult GetUserSecurityKeys()
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("GetUserSecurityKeys Call Recevied");
         }
         return(Ok(_securityKeysApplicationService.GetSecurityKeysPairList(HeaderParamUtility.GetApikey(Request))));
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetUserSecurityKeys Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetUserSecurityKeys Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidDataException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetUserSecurityKeys Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetUserSecurityKeys Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
Example #9
0
 public IHttpActionResult Logout()
 {
     try
     {
         if (Log.IsDebugEnabled)
         {
             Log.Debug("Logout Call Recevied");
         }
         return
             (Ok(_logoutApplicationService.Logout(new LogoutCommand(HeaderParamUtility.GetApikey(Request)))));
     }
     catch (InstanceNotFoundException exception)
     {
         if (Log.IsErrorEnabled)
         {
             Log.Error("Logout Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (Log.IsErrorEnabled)
         {
             Log.Error("Logout Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (Log.IsErrorEnabled)
         {
             Log.Error("Logout Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult GetVerifyForTier1([FromBody] Tier1Param param)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("GetVerifyForTier1 Call Recevied, parameters:" + param);
         }
         _userTierLevelApplicationService.ApplyForTier1Verification(new VerifyTier1Command(param.PhoneNumber,
                                                                                           HeaderParamUtility.GetApikey(Request), param.FullName, Convert.ToDateTime(param.DateOfBirth)));
         return(Ok());
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier1 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier1 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (ArgumentNullException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier1 Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("GetVerifyForTier1 Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
        public async Task <IHttpActionResult> GetVerifyForTier3([FromBody] Tier3Param param)
        {
            try
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("GetVerifyForTier2 Call Recevied, parameters:" + param);
                }
                MemoryStream memoryStream = null;
                if (!string.IsNullOrEmpty(param.FileName))
                {
                    memoryStream = new MemoryStream();
                    var provider = new MultipartFormDataStreamProvider(ServerUploadFolder);
                    await Request.Content.ReadAsMultipartAsync(provider);

                    foreach (var file in provider.Contents)
                    {
                        file.CopyToAsync(memoryStream);
                        if (log.IsDebugEnabled)
                        {
                            log.Debug("GetVerifyForTier2 File Recevied");
                        }
                    }
                }
                _userTierLevelApplicationService.ApplyForTier3Verification(
                    new VerifyTier3Command(HeaderParamUtility.GetApikey(Request), param.Ssn, param.Nin,
                                           param.DocumentType, param.FileName, memoryStream));
                return(Ok());
            }
            catch (InvalidOperationException exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetVerifyForTier2 Call Exception ", exception);
                }
                return(BadRequest(exception.Message));
            }
            catch (InvalidCredentialException exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetVerifyForTier2 Call Exception ", exception);
                }
                return(BadRequest(exception.Message));
            }
            catch (ArgumentNullException exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetVerifyForTier2 Call Exception ", exception);
                }
                return(BadRequest(exception.Message));
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetVerifyForTier2 Call Exception ", exception);
                }
                return(InternalServerError());
            }
        }
 public IHttpActionResult ChangeSettings([FromBody] ChangeSettingsParams changeSettingsParams)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("ChangeSettings Call Recevied, parameters:" + changeSettingsParams);
         }
         ;
         return(Ok(_userApplicationService.ChangeSettings(new ChangeSettingsCommand(HeaderParamUtility.GetApikey(Request),
                                                                                    changeSettingsParams.Email, changeSettingsParams.PgpPublicKey, changeSettingsParams.Language,
                                                                                    changeSettingsParams.TimeZone, changeSettingsParams.IsDefaultAutoLogout,
                                                                                    changeSettingsParams.AutoLogoutMinutes))));
     }
     catch (InstanceNotFoundException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (NullReferenceException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ChangeSettings Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }
 public IHttpActionResult CreateSecurityKey(CreateUserGeneratedSecurityKeyPair command)
 {
     try
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("CreateSecurityKey Call Recevied, parameters:");
         }
         return(Ok(_securityKeysApplicationService.CreateUserGeneratedKey(command, HeaderParamUtility.GetApikey(Request))));
     }
     catch (InvalidOperationException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("CreateSecurityKey Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidCredentialException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("CreateSecurityKey Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (InvalidDataException exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("CreateSecurityKey Call Exception ", exception);
         }
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("CreateSecurityKey Call Exception ", exception);
         }
         return(InternalServerError());
     }
 }