Exemplo n.º 1
0
 public override string ToString()
 {
     return(string.Format("Pin: {0} Code: {1} Result:{2}",
                          SmartCardData.GetPin(Pin),
                          SmartCardData.GetCode(Code),
                          SmartCardData.GetResult(Result)));
 }
Exemplo n.º 2
0
        public async Task Begin(IEnumerable <object> args)
        {
            var stripe  = "BNA49349824398FHQA".ToCharArray();
            var stripe2 = "BNA49349824298FHQA".ToCharArray();

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Authenticate, Pin.Send, stripe)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Authenticate, Pin.Send, stripe2)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Connect, Pin.Send, stripe)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.BeginTransmit, Pin.Recieve, stripe)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.BinaryTransmit, Pin.Recieve, stripe, "MyTestData".GetBytes(Encoding.ASCII).ToArray())));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.BinaryTransmit, Pin.Recieve, stripe, "MyTestData next bit".GetBytes(Encoding.ASCII).ToArray())));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Disconnect, Pin.Send, stripe)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Request, Pin.Reset, stripe)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Authenticate, Pin.Send, stripe2)));

            Console.WriteLine(_smartCard
                              .Input(SmartCardData.Create(Code.Authenticate, Pin.Send, stripe)));
        }
Exemplo n.º 3
0
        private IResult Handle(ISmartCardData cardData)
        {
            var pin  = SmartCardData.GetPin(cardData.Pin);
            var code = SmartCardData.GetCode(cardData.Code);

            var pinService = _pinServiceFactory
                             .GetPinService(pin);

            if (pinService == null)
            {
                return(SmartCardResult
                       .CreateError(Result.UndeterminedResult));
            }

            return(pinService
                   .Handle(code, _smartCardState, cardData));
        }
Exemplo n.º 4
0
 public ISmartCardData Input(ISmartCardData cardData)
 {
     return(SmartCardData.Create(Handle(cardData)));
 }
Exemplo n.º 5
0
 public SmartCardResult(Pin pin, Code code, Result result)
     : this(SmartCardData.GetPin(pin), SmartCardData.GetCode(code), SmartCardData.GetResult(result))
 {
 }