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);
        }
 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));
 }
예제 #3
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);
        }