Ejemplo n.º 1
0
        CombinationSelection_FromA(CardQProcessor cardInterfaceManager, TLV iad, TLV scriptData)
        {
            List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> > candidates = new List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> >();

            EMVSelectPPSEResponse responsePPSE = FinalCombinationSelection_Step1(cardInterfaceManager);

            #region 3.3.2.4
            if (responsePPSE.Succeeded && responsePPSE.GetDirectoryEntries_61() != null)
            #endregion
            {
                #region 3.3.2.3
                if (responsePPSE.Succeeded)
                {
                    candidates = FinalCombinationSelection_Step2(responsePPSE.GetDirectoryEntries_61());
                }
                #endregion

                #region 3.3.2.7
                if (candidates.Count == 0)
                #endregion
                {
                    return(Tuple.Create(
                               new EMVTerminalProcessingOutcome()
                    {
                        NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess,
                        UIRequestOnOutcomePresent = true,
                        UserInterfaceRequest = new UserInterfaceRequest()
                        {
                            MessageIdentifier = MessageIdentifiersEnum.InsertSwipeOrTryAnotherCard, Status = StatusEnum.ReadyToRead
                        },
                        UIRequestOnRestartPresent = false,
                    }, (EMVSelectApplicationResponse)null, (TerminalSupportedKernelAidTransactionTypeCombination)null, (CardKernelAidCombination)null,
                               (List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> >)null));
                }
            }

            return(ProcessCandidates(cardInterfaceManager, candidates, iad, scriptData));
        }
        CombinationSelection_FromA(CardQProcessor cardInterfaceManager, IUICallbackProvider uiProvider)
        {
            List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> > candidates = new List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> >();

            #region 12.3.2 Book1 12.2.2 and 12.3.2 Step 1
            EMVSelectPPSEResponse responsePPSE = SelectPSEApplication(cardInterfaceManager);

            //card blocked
            if (responsePPSE.SW1 == 0x6A && responsePPSE.SW2 == 0x81)
            {
                return(Tuple.Create(
                           new EMVTerminalProcessingOutcome()
                {
                    NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess,
                    UIRequestOnOutcomePresent = true,
                    UserInterfaceRequest = new UserInterfaceRequest()
                    {
                        MessageIdentifier = MessageIdentifiersEnum.InsertSwipeOrTryAnotherCard, Status = StatusEnum.ReadyToRead
                    },
                    UIRequestOnRestartPresent = false,
                }, (EMVSelectApplicationResponse)null, (TerminalSupportedKernelAidTransactionTypeCombination)null, (CardKernelAidCombination)null,
                           (List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> >)null));
            }
            #endregion

            //cards supports selection by PSE
            if (responsePPSE.Succeeded && responsePPSE.GetSFI_88() != null)
            {
                #region 12.3.2 12.3.2 Book1 Step 2
                TLVList records = ReadAllPSERecords(responsePPSE.GetSFI_88(), cardInterfaceManager);
                #endregion

                //do matching
                #region 12.3.2 Book1 12.3.2 Step 3
                candidates = CreateCandidateListFromPSERecords(records);
                #endregion

                #region 12.3.2 Book1 Step 4 and 5
                if (candidates.Count != 0)
                {
                    return(ProcessCandidates(cardInterfaceManager, candidates, uiProvider));
                }
                #endregion
            }
            candidates = CreateCandidateListByDirMethod(cardInterfaceManager);
            if (candidates.Count == 0)
            {
                return(Tuple.Create(
                           new EMVTerminalProcessingOutcome()
                {
                    NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess,
                    UIRequestOnOutcomePresent = true,
                    UserInterfaceRequest = new UserInterfaceRequest()
                    {
                        MessageIdentifier = MessageIdentifiersEnum.TryAnotherCard, Status = StatusEnum.ReadyToRead
                    },
                    UIRequestOnRestartPresent = false,
                }, (EMVSelectApplicationResponse)null, (TerminalSupportedKernelAidTransactionTypeCombination)null, (CardKernelAidCombination)null,
                           (List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> >)null));
            }
            return(ProcessCandidates(cardInterfaceManager, candidates, uiProvider));
        }