Exemplo n.º 1
0
        private OpmVerificationResult Verify(EanEicCode code)
        {
            CheckResult codeValid = EanEicCheckerHttpClient.Post(code);

            if (codeValid.ResultCode != CheckResultCode.EanOk && codeValid.ResultCode != CheckResultCode.EicOk)
            {
                throw new EanEicCodeInvalidException();
            }

            //OK, code is valid, try to find the record in the OpmRepository
            Opm opmForCode;

            if (OpmRepository.TryGetOpm(code, out opmForCode))
            {
                return(new OpmVerificationResult(true));
            }
            return(new OpmVerificationResult(false));
        }
Exemplo n.º 2
0
        private OpmVerificationResult Verify(EanEicCode code)
        {
            CheckResult codeValid = EanEicCheckerHttpClient.Post(code);

            if (codeValid.ResultCode != CheckResultCode.EanOk && codeValid.ResultCode != CheckResultCode.EicOk)
            {
                //TODO SP: what to do now - maybe better to just return 'false'
                throw new ArgumentException("The supplied code is not valid." + "\n" + codeValid.Description);
            }

            //OK, code is valid, try to find it in the OpmRepository
            Opm opmForCode;

            if (OpmRepository.TryGetOpm(code, out opmForCode))
            {
                return(new OpmVerificationResult(true));
            }
            return(new OpmVerificationResult(false));
        }