예제 #1
0
        public async Task <PinModel> VerifyPinHashAsync(Domain.Processors.VerifyPinParameters data)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            if (data.Requestor is null)
            {
                throw new ArgumentNullException(nameof(data.Requestor));
            }
            _requestor = data.Requestor;

            await LoadPinModelAsync(data.Requestor);

            CheckIsPinLocked();
            CheckIsInGracePeriod();

            if ((data.PinHash.Length != _storedPinModel.PinHash.Length) || !data.PinHash.Equals(_storedPinModel.PinHash))
            {
                await UpdateFailedAttemptsInfoAsync();

                LogFailedVerification();
                throw new Exceptions.PinInvalidException(_storedPinModel.FailedAttemptsCount, GetGracePeriodForFailedCount(_storedPinModel.FailedAttemptsCount));
            }

            await RemoveFailedAttemptsInfoAsync();

            LogSuccessfulVerification();
            return(_storedPinModel);
        }
예제 #2
0
        public async Task <ActionResult> PostVerifyPinAlternativeAsync([FromRoute] string opcoid, [FromRoute] string householdid, [FromRoute] uint profileid, [FromBody] PinHashModel pinDetails)
        {
            var data = new Domain.Processors.VerifyPinParameters()
            {
                Requestor = new Domain.Models.RequestorModel()
                {
                    HouseholdId = householdid,
                    ProfileId   = profileid,
                    OpCoId      = opcoid,
                    PinType     = pinDetails.PinType
                },
                PinHash = pinDetails.PinHash
            };
            await _processor.ProcessRequestAsync(data);

            return(Ok());
        }
예제 #3
0
        public async Task <ActionResult> GetVerifyPinAsync([FromRoute] string opcoid, [FromBody] DataModel.PinVerifyRequestModel request)
        {
            var data = new Domain.Processors.VerifyPinParameters()
            {
                Requestor = new Domain.Models.RequestorModel()
                {
                    HouseholdId = request.Requestor.HouseholdId,
                    ProfileId   = request.Requestor.ProfileId,
                    OpCoId      = opcoid,
                    PinType     = request.PinType
                },
                PinHash = request.PinHash
            };
            await _processor.ProcessRequestAsync(data);

            return(Ok());
        }