private ErrorResponse ValidateRequest(CheckVcodeRequest data) { if (!ApiValidator.ValidateVerificationId(data.VerificationId, out ErrorResponse error)) { return(error); } ApiValidator.ValidateVerificationCode(data.Code, out error); return(error); }
/// <summary> /// 检测验证码接口。此接口用于企业电子合同平台通过给用户发送短信验证码,以短信授权方式签署合同。此接口配合发送验证码接口使用。 /// /// 用户在企业电子合同平台输入收到的验证码后,由企业电子合同平台调用该接口向腾讯云提交确认受托签署合同验证码命令。验证码验证正确时,本次合同签署的授权成功。 /// </summary> /// <param name="req"><see cref="CheckVcodeRequest"/></param> /// <returns><see cref="CheckVcodeResponse"/></returns> public CheckVcodeResponse CheckVcodeSync(CheckVcodeRequest req) { JsonResponseModel <CheckVcodeResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "CheckVcode"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <CheckVcodeResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
public async Task <IActionResult> Handle(CheckVcodeRequest data) { ErrorResponse validationError = this.ValidateRequest(data); if (validationError != null) { return(new JsonErrorResult(validationError)); } try { using (SqlConnection conn = sqlServer.GetConnection()) { await conn.OpenAsync(); using (SqlCommand cmd = sqlServer.GetSpCommand("dbo.Employee_CheckVerificationCode", conn)) { cmd.AddUniqueIdentifierParam("@VerificationId", data.VerificationId); cmd.AddCharParam("@Code", 6, data.Code); SqlParameter retValParam = cmd.AddReturnValue(); await cmd.ExecuteNonQueryAsync(); int retVal = retValParam.GetInt32OrDefault(); if (retVal < 0) { ErrorResponse errorResponse = this.GetErrorResponse(retVal); return(new JsonErrorResult(errorResponse)); } } } return(new EmptyResult()); } catch (Exception ex) { return(new JsonErrorResult(this.GetExceptionResponse(ex))); } }
public async Task <ApiResponse> CheckVerificationCode(CheckVcodeRequest data) { data.ClientInfo = this._clientInfo; return(await new ApiMethod <CheckVcodeRequest, object>( this._httpClient, this._controllerUriPart, "CheckVcode").Call(data)); }
public async Task <IActionResult> CheckVerificationCode(CheckVcodeRequest data) { return(await GetHandler <CheckVerificationCode>().Handle(data)); }