public ConfirmPhoneNumberRespond ConfirmPhoneNumber(string userId, string verificationCode)
 {
     var request = new ConfirmPhoneNumberRequest
     {
         UserId = userId,
         VerificationCode = verificationCode
     };
     var result = FacadeRepository.Instance.AccountFacade.ConfirmPhoneNumber(request);
     return result;
 }
 public void WhenผใชUserIdยนยนรหสลบVerificationCode(string userId, string verificationCode)
 {
     var request = new ConfirmPhoneNumberRequest
     {
         UserId = userId,
         VerificationCode = verificationCode
     };
     var result = FacadeRepository.Instance.AccountFacade.ConfirmPhoneNumber(request);
     ScenarioContext.Current.Set(result);
 }
Example #3
0
        public ConfirmPhoneNumberRespond ConfirmPhoneNumber(ConfirmPhoneNumberRequest request)
        {
            var confirmationFailed = new ConfirmPhoneNumberRespond();
            var isArgumentsValid = request != null && !string.IsNullOrEmpty(request.UserId) && !string.IsNullOrEmpty(request.VerificationCode);
            if (!isArgumentsValid) return confirmationFailed;

            var accountDac = FacadeRepository.Instance.AccountDataAccess;
            var selectedVerification = accountDac.GetVerificationPhoneByVerificationCode(request.UserId, request.VerificationCode);

            var isVerificationPass = selectedVerification != null
                && !selectedVerification.CompletedDate.HasValue
                && selectedVerification.UserId.Equals(request.UserId, StringComparison.CurrentCultureIgnoreCase)
                && selectedVerification.VerificationCode.Equals(request.VerificationCode, StringComparison.CurrentCultureIgnoreCase)
                && !string.IsNullOrEmpty(selectedVerification.PhoneNumber);
            if (!isVerificationPass) return confirmationFailed;

            accountDac.VerifyPhoneSuccess(request.UserId, selectedVerification.PhoneNumber, request.VerificationCode);
            return new ConfirmPhoneNumberRespond { IsSuccessed = true };
        }