public static List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > PreProcessing(TransactionRequest transactionRequest)
        {
            List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > EntryPointPreProcessingIndicators = new List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> >();

            foreach (TerminalSupportedKernelAidTransactionTypeCombination kc in TerminalSupportedKernelAidTransactionTypeCombinations.SupportedContactCombinations)
            {
                EntryPointPreProcessingIndicators eppi = new EntryPointPreProcessingIndicators();
                EntryPointPreProcessingIndicators.Add(Tuple.Create(kc, eppi));
            }
            return(EntryPointPreProcessingIndicators);
        }
Example #2
0
        CombinationSelection_C(EMVTerminalPreProcessingStateEnum parent)
        {
            Tuple <EMVTerminalProcessingOutcome,
                   EMVSelectApplicationResponse,
                   TerminalSupportedKernelAidTransactionTypeCombination,
                   CardKernelAidCombination,
                   List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination> > > result;

            switch (parent)
            {
            case EMVTerminalPreProcessingStateEnum.Preprocessing_StartA:
                result = EMVContactCombinationSelection.CombinationSelection_FromA(cardQProcessor, uiProvider);
                lastCandidateSelected = Tuple.Create(result.Item1, result.Item2, result.Item3, result.Item4);
                break;

            case EMVTerminalPreProcessingStateEnum.ProtocolActivation_StartB:
                result = EMVContactCombinationSelection.CombinationSelection_FromB(cardQProcessor, lastCandidateSelected, candidates, uiProvider);
                break;

            case EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC:
                preProcessingValues.RemoveAll(x => ((TerminalSupportedContactKernelAidTransactionTypeCombination)x.Item1).AIDEnum == ((TerminalSupportedContactKernelAidTransactionTypeCombination)lastCandidateSelected.Item3).AIDEnum);
                candidates.RemoveAll(x => ((TerminalSupportedContactKernelAidTransactionTypeCombination)x.Item1).AIDEnum == ((TerminalSupportedContactKernelAidTransactionTypeCombination)lastCandidateSelected.Item3).AIDEnum);
                result = EMVContactCombinationSelection.CombinationSelection_FromC(cardQProcessor, candidates, uiProvider);
                lastCandidateSelected = Tuple.Create(result.Item1, result.Item2, result.Item3, result.Item4);
                break;

            default:
                throw new EMVProtocolException("unimplemeted TerminalPreProcessingStateEnum in CombinationSelection");
            }

            if (result.Item1.NextProcessState == EMVTerminalPreProcessingStateEnum.EndProcess)
            {
                return(Tuple.Create(result.Item1, (EMVSelectApplicationResponse)null, (TerminalSupportedKernelAidTransactionTypeCombination)null, (CardKernelAidCombination)null, (EntryPointPreProcessingIndicators)null));
            }

            candidates = result.Item5;
            TerminalSupportedKernelAidTransactionTypeCombination terminalCombinationForSelected = result.Item3;

            List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> >
            filteredIndicators = preProcessingValues.Where(x => (((TerminalSupportedContactKernelAidTransactionTypeCombination)x.Item1).AIDEnum == ((TerminalSupportedContactKernelAidTransactionTypeCombination)terminalCombinationForSelected).AIDEnum)).ToList();

            if (filteredIndicators.Count == 0)
            {
                result.Item1.NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess;
                return(Tuple.Create(result.Item1, result.Item2, result.Item3, result.Item4, (EntryPointPreProcessingIndicators)null));
            }

            EntryPointPreProcessingIndicators processingIndicatorsForSelected = filteredIndicators.Select(x => x.Item2).ToList().First();

            return(Tuple.Create(result.Item1, result.Item2, result.Item3, result.Item4, processingIndicatorsForSelected));
        }
 public static KernelBase ActivateKernel(
     TransactionRequest tt,
     CardQProcessor cardInterface,
     PublicKeyCertificateManager publicKeyCertificateManager,
     EMVSelectApplicationResponse response,
     TerminalSupportedKernelAidTransactionTypeCombination terminalCombinationForSelected,
     CardKernelAidCombination cardCombinationForSelected,
     EntryPointPreProcessingIndicators processingIndicatorsForSelected,
     CardExceptionManager cardExceptionManager,
     IConfigurationProvider configProvider
     ) //the response from the selected aid command
 {
     return(new Kernel(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider, response));
 }
        public static KernelBase ActivateKernel(
            TransactionRequest tt,
            CardQProcessor cardInterface,
            TornTransactionLogManager tornTransactionLogManager,
            PublicKeyCertificateManager publicKeyCertificateManager,
            EMVSelectApplicationResponse response,
            TerminalSupportedKernelAidTransactionTypeCombination terminalCombinationForSelected,
            CardKernelAidCombination cardCombinationForSelected,
            EntryPointPreProcessingIndicators processingIndicatorsForSelected,
            CardExceptionManager cardExceptionManager,
            IConfigurationProvider configProvider
            ) //the response from the selected aid command
        {
            switch (((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum)
            {
            case KernelEnum.Kernel1:
                EMVTagsEnum.DataKernelID = DataKernelID.K1;
                return(new Kernel1(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider));

            case KernelEnum.Kernel2:
                EMVTagsEnum.DataKernelID = DataKernelID.K2;
                return(new Kernel2(tt.GetTransactionType_9C(), tornTransactionLogManager, cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider));

            case KernelEnum.Kernel3:
                EMVTagsEnum.DataKernelID = DataKernelID.K3;
                return(new Kernel3(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider));

            case KernelEnum.Kernel4:
                break;

            case KernelEnum.Kernel5:
                break;

            case KernelEnum.Kernel6:
                break;

            case KernelEnum.Kernel7:
                break;

            default:
                throw new EMVProtocolException("Unsupported kernel: " + ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum);
            }
            throw new EMVProtocolException("Unsupported kernel: " + ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum);
        }
Example #5
0
 public Kernel1Database(EntryPointPreProcessingIndicators processingIndicatorsForSelected, PublicKeyCertificateManager publicKeyCertificateManager)
     : base(publicKeyCertificateManager)
 {
     ProcessingIndicatorsForSelected = processingIndicatorsForSelected;
 }
Example #6
0
        public Kernel2(TransactionTypeEnum tt, TornTransactionLogManager tornTransactionLogManager, CardQProcessor cardQProcessor, PublicKeyCertificateManager publicKeyCertificateManager, EntryPointPreProcessingIndicators processingIndicatorsForSelected, CardExceptionManager cardExceptionManager, IConfigurationProvider configProvider)
            : base(cardQProcessor, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider)
        {
            this.tornTransactionLogManager = tornTransactionLogManager;

            database = new Kernel2Database(publicKeyCertificateManager);
            database.InitializeDefaultDataObjects(tt, configProvider);
        }
Example #7
0
        public static List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > PreProcessing(TransactionRequest transactionRequest)
        {
            List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > EntryPointPreProcessingIndicators = new List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> >();

            foreach (TerminalSupportedKernelAidTransactionTypeCombination kcA in TerminalSupportedKernelAidTransactionTypeCombinations.SupportedContactlessCombinations)
            {
                TerminalSupportedContactlessKernelAidTransactionTypeCombination kc = (TerminalSupportedContactlessKernelAidTransactionTypeCombination)kcA;

                if (transactionRequest.GetTransactionType_9C() != kc.TransactionTypeEnum)
                {
                    continue;
                }

                //3.1.1.1
                EntryPointPreProcessingIndicators eppi = new EntryPointPreProcessingIndicators();
                EntryPointPreProcessingIndicators.Add(Tuple.Create(kcA, eppi));
                if (kc.TTQ != null)
                {
                    //3.1.1.2
                    eppi.TTQ = (TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN)kc.TTQ.Clone();
                    eppi.TTQ.Value.OnlineCryptogramRequired = false;
                    eppi.TTQ.Value.CVMRequired = false;
                    eppi.TTQ.Val.Serialize();
                }

                //3.1.1.3
                if (kc.StatusCheckSupportFlag != null && kc.StatusCheckSupportFlag == true && transactionRequest.IsSingleUnitOfCurrency)
                {
                    eppi.StatusCheckRequested = true;
                }

                //3.1.1.4
                if (transactionRequest.GetAmountAuthorized_9F02() == 0)
                {
                    if (kc.ZeroAmountAllowedFlag != null && kc.ZeroAmountAllowedFlag == false)
                    {
                        eppi.ContactlessApplicationNotAllowed = true;
                    }
                    else
                    {
                        eppi.ZeroAmount = true;
                    }
                }

                //3.1.1.5
                if (kc.ReaderContactlessTransactionLimit != null && transactionRequest.GetAmountAuthorized_9F02() > kc.ReaderContactlessTransactionLimit)
                {
                    eppi.ContactlessApplicationNotAllowed = true;
                }

                //3.1.1.6
                if (kc.ReaderContactlessFloorLimit != null && transactionRequest.GetAmountAuthorized_9F02() > kc.ReaderContactlessFloorLimit)
                {
                    eppi.ReaderContactlessFloorLimitExceeded = true;
                }

                //3.1.1.7
                if (kc.ReaderContactlessFloorLimit == null && kc.TerminalFloorLimit_9F1B != null && transactionRequest.GetAmountAuthorized_9F02() > kc.TerminalFloorLimit_9F1B)
                {
                    eppi.ReaderContactlessFloorLimitExceeded = true;
                }

                //3.1.1.8
                if (kc.ReaderCVMRequiredLimit != null && transactionRequest.GetAmountAuthorized_9F02() > kc.ReaderCVMRequiredLimit)
                {
                    eppi.ReaderCVMRequiredLimitExceeded = true;
                }

                if (eppi.TTQ != null)
                {
                    //3.1.1.9
                    if (eppi.ReaderContactlessFloorLimitExceeded)
                    {
                        eppi.TTQ.Value.OnlineCryptogramRequired = true;
                    }

                    //3.1.1.10
                    if (eppi.StatusCheckRequested)
                    {
                        eppi.TTQ.Value.OnlineCryptogramRequired = true;
                    }

                    //3.1.1.11
                    if (eppi.ZeroAmount)
                    {
                        if (!eppi.TTQ.Value.OfflineOnlyReader)
                        {
                            eppi.TTQ.Value.OnlineCryptogramRequired = true;
                        }
                        else
                        {
                            eppi.ContactlessApplicationNotAllowed = true;
                        }
                    }

                    //3.1.1.12
                    if (eppi.ReaderCVMRequiredLimitExceeded)
                    {
                        eppi.TTQ.Value.CVMRequired = true;
                    }

                    eppi.TTQ.Serialize();
                }

                EntryPointPreProcessingIndicators.RemoveAll(x => x.Item2.ContactlessApplicationNotAllowed);
            }
            return(EntryPointPreProcessingIndicators);
        }
Example #8
0
 public Kernel(TransactionTypeEnum tt, CardQProcessor cardQProcessor, PublicKeyCertificateManager publicKeyCertificateManager, EntryPointPreProcessingIndicators processingIndicatorsForSelected, CardExceptionManager cardExceptionManager, IConfigurationProvider configProvider, EMVSelectApplicationResponse emvSelectApplicationResponse)
     : base(cardQProcessor, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider)
 {
     database = new KernelDatabase(publicKeyCertificateManager);
     database.InitializeDefaultDataObjects(tt, configProvider);
     this.emvSelectApplicationResponse = emvSelectApplicationResponse;
 }