public async Task <ResponseModel> Post(PinSecurityChangeModel data) { if (string.IsNullOrEmpty(data.Pin)) { return(ResponseModel.CreateInvalidFieldError("pin", Phrases.FieldShouldNotBeEmpty)); } if (!data.Pin.IsOnlyDigits()) { return(ResponseModel.CreateInvalidFieldError("pin", Phrases.PinShouldContainsDigitsOnly)); } if (data.Pin.Length < 4) { return(ResponseModel.CreateInvalidFieldError("pin", Phrases.MinLengthIs4Digits)); } var clientId = this.GetClientId(); if (string.IsNullOrEmpty(clientId)) { return(ResponseModel <PinSecurityCheckResultModel> .CreateFail(ResponseModel.ErrorCodeType.NotAuthenticated, Phrases.NotAuthenticated)); } await _puPinSecurityRepository.SaveAsync(clientId, data.Pin); return(ResponseModel.CreateOk()); }
public IResponse <ResponseModel> PostPinSecurity(PinSecurityChangeModel pinSecurityChange, string token) { return(Request.Post("/PinSecurity").WithBearerToken(token) .AddJsonBody(pinSecurityChange) .Build().Execute <ResponseModel>()); }