public void StartTransactionRequest(ref TransactionRequest tr, string barcodeValue) { //unpack barcode QRDEList listOut = new QRDEList(); listOut.Deserialize(barcodeValue); int depth = 0; Logger.Log("Barcode Scanned:"); Logger.Log(listOut.ToPrintString(ref depth)); long amount = Convert.ToInt64(listOut.Get(EMVQRTagsEnum.TRANSACTION_AMOUNT_54.Tag).Value); long amountOther = 0; tr = new TransactionRequest(amount + amountOther, amountOther, TransactionTypeEnum.PurchaseGoodsAndServices); EMVTerminalProcessingOutcome processingOutcome = new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = false, UIRequestOnRestartPresent = false, QRData = listOut, }; OnProcessCompleted(processingOutcome); }
protected override void DoEntryPointA(TransactionRequest tr) { this.tr = tr; #region 3.1.1.1 - 3.1.1.12 Preprocessing Start A preProcessingValues = EMVContactlessPreProcessing.PreProcessing(tr); #endregion #region 3.1.1.13 - Preprocessing Start A if (preProcessingValues.Count == 0) #endregion { EMVTerminalProcessingOutcome processingOutcome = new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = true, UserInterfaceRequest = new UserInterfaceRequest() { MessageIdentifier = MessageIdentifiersEnum.PleaseInsertOrSwipeCard, Status = StatusEnum.ProcessingError }, UIRequestOnRestartPresent = false }; OnProcessCompleted(processingOutcome); return; } DoEntryPointB(EMVTerminalPreProcessingStateEnum.Preprocessing_StartA); }
protected void OnProcessCompleted(EMVTerminalProcessingOutcome po) { try { TerminalProcessingOutcomeEventArgs tpo = new TerminalProcessingOutcomeEventArgs() { TerminalProcessingOutcome = po }; ProcessCompleted?.Invoke(this, tpo); } catch (Exception ex) { Logger.Log("Error in OnProcessCompleted:" + ex.Message); return; } }
public void CancelTransactionRequest() { StopTerminalApplication(); EMVTerminalProcessingOutcome processingOutcomeOUT = new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = true }; UserInterfaceRequest uird = new UserInterfaceRequest() { MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead }; processingOutcomeOUT.UserInterfaceRequest = uird; OnProcessCompleted(processingOutcomeOUT); }
public void StartTransactionRequest(TransactionRequest tr, string barcodeValue) { //add tracking id QRDEList listOut = new QRDEList(); listOut.Deserialize(barcodeValue); int depth = 0; Logger.Log("Barcode Presented:"); Logger.Log(listOut.ToPrintString(ref depth)); EMVTerminalProcessingOutcome processingOutcome = new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = false, UIRequestOnRestartPresent = false, QRData = listOut, }; OnProcessCompleted(processingOutcome); }
protected override void DoEntryPointA(TransactionRequest tr) { this.tr = tr; //get a list of supported aids for the transaction type preProcessingValues = EMVContactPreProcessing.PreProcessing(tr); if (preProcessingValues.Count == 0) { EMVTerminalProcessingOutcome processingOutcome = new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = true, UserInterfaceRequest = new UserInterfaceRequest() { MessageIdentifier = MessageIdentifiersEnum.PleaseInsertOrSwipeCard, Status = StatusEnum.ProcessingError }, UIRequestOnRestartPresent = false }; OnProcessCompleted(processingOutcome); return; } DoEntryPointB(EMVTerminalPreProcessingStateEnum.Preprocessing_StartA); }
protected void OnProcessCompleted(EMVTerminalProcessingOutcome po) { try { if (po == null) //exception occurred { return; } switch (po.NextProcessState) { case EMVTerminalPreProcessingStateEnum.ProtocolActivation_StartB: DoEntryPointB(EMVTerminalPreProcessingStateEnum.ProtocolActivation_StartB); break; case EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC: DoEntryPointC(EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC); break; case EMVTerminalPreProcessingStateEnum.EndProcess: //cardQProcessor.StopServiceQProcess(); TerminalProcessingOutcomeEventArgs tpo = new TerminalProcessingOutcomeEventArgs() { TerminalProcessingOutcome = po }; ProcessCompleted?.Invoke(this, tpo); break; default: throw new EMVProtocolException("Unimplemeted TerminalPreProcessingStateEnum in OnProcessCompleted"); } } catch (Exception ex) { Logger.Log("Error in OnProcessCompleted:" + ex.Message); return; } }
protected virtual EMVTerminalProcessingOutcome StartServiceQPRocess(KernelBase kernel) { while (1 == 1) { try { if (cancellationTokenForTerminalApplication.Token.IsCancellationRequested) { cancellationTokenForTerminalApplication.Dispose(); return(null); } if (kernel.KernelQ.GetOutputQCount() == 0) { Task.Run(async() => await Task.Delay(1)).Wait(); continue; } KernelResponseBase k2Response = kernel.KernelQ.DequeueFromOutput(true); if (k2Response == null) { Task.Run(async() => await Task.Delay(1)).Wait(); continue; } Logger.Log("Terminal received signal:" + k2Response.KernelReaderTerminalServiceResponseEnum); switch (k2Response.KernelReaderTerminalServiceResponseEnum) { case KernelReaderTerminalServiceResponseEnum.DEK: DATA_NEEDED_DF8106_KRN2 dataNeeded = ((KernelDEKResponse)k2Response).DataNeeded; DATA_TO_SEND_FF8104_KRN2 dataToSend = ((KernelDEKResponse)k2Response).DataToSend; TLVList requestInput = new TLVList(); //Logger.Log("------------------DEK Request Start-------------------"); foreach (string tag in dataNeeded.Value.Tags) { TLV found = terminalConfigurationData.TerminalConfigurationDataObjects.Get(tag); if (found == null) { Logger.Log("Tag Requested Of Terminal By Kernel Not Found:" + tag); throw new EMVTerminalException("cound not find tag for data needed: " + tag); } requestInput.AddToList(found); //int depth = 0; //Logger.Log("Tag Requested From Terminal:" + found.ToPrintString(ref depth)); } //Logger.Log("------------------DEK Request End-------------------"); KernelRequest request = new KernelRequest(KernelTerminalReaderServiceRequestEnum.DET, requestInput); kernel.KernelQ.EnqueueToInput(request); break; //continue processing case KernelReaderTerminalServiceResponseEnum.OUT: KernelOUTResponse outResponse = (KernelOUTResponse)k2Response; EMVTerminalProcessingOutcome processingOutcomeOUT = new EMVTerminalProcessingOutcome() { CVM = outResponse.OutcomeParameterSet_DF8129.Value.CVM }; switch (outResponse.OutcomeParameterSet_DF8129.Value.Start) { case Kernel2StartEnum.A: throw new Exception("Kernel2StartEnum.A Not Implemented"); case Kernel2StartEnum.B: if (outResponse.UserInterfaceRequest_DF8116 != null) { OnUserInterfaceRequest(CreateUIMessageEventArgs( outResponse.UserInterfaceRequest_DF8116.Value.KernelMessageidentifierEnum, outResponse.UserInterfaceRequest_DF8116.Value.KernelStatusEnum, Formatting.ConvertToInt32(outResponse.UserInterfaceRequest_DF8116.Value.HoldTime))); } else { OnUserInterfaceRequest(new UIMessageEventArgs(MessageIdentifiersEnum.TransmissionError, StatusEnum.EndProcessing)); } processingOutcomeOUT.NextProcessState = EMVTerminalPreProcessingStateEnum.ProtocolActivation_StartB; return(processingOutcomeOUT); case Kernel2StartEnum.C: processingOutcomeOUT.NextProcessState = EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC; return(processingOutcomeOUT); case Kernel2StartEnum.D: throw new Exception("Kernel2StartEnum.D Not Implemented"); case Kernel2StartEnum.N_A: if (outResponse.UserInterfaceRequest_DF8116 != null) { string s1 = outResponse.UserInterfaceRequest_DF8116.Value.KernelMessageidentifierEnum.ToString(); string s2 = outResponse.UserInterfaceRequest_DF8116.Value.KernelStatusEnum.ToString(); string s3 = ""; if (outResponse.UserInterfaceRequest_DF8116.Value.ValueQualifierEnum != ValueQualifierEnum.NONE) { s3 = outResponse.UserInterfaceRequest_DF8116.Value.ValueQualifierEnum + " : " + Formatting.BcdToString(outResponse.UserInterfaceRequest_DF8116.Value.ValueQualifier); } string s4 = ""; if (outResponse.OutcomeParameterSet_DF8129.Value.CVM != KernelCVMEnum.NO_CVM) { s4 = outResponse.OutcomeParameterSet_DF8129.Value.CVM.ToString(); } OnUserInterfaceRequest(CreateUIMessageEventArgs( outResponse.UserInterfaceRequest_DF8116.Value.KernelMessageidentifierEnum, outResponse.UserInterfaceRequest_DF8116.Value.KernelStatusEnum, string.Format("{0}:{1}", s3, s4))); } processingOutcomeOUT.DataRecord = outResponse.DataRecord_FF8105; processingOutcomeOUT.DiscretionaryData = outResponse.DiscretionaryData_FF8106; int depth = 0; if (outResponse.UserInterfaceRequest_DF8116 != null) { Logger.Log(outResponse.UserInterfaceRequest_DF8116.ToPrintString(ref depth)); } depth = 0; Logger.Log(outResponse.OutcomeParameterSet_DF8129.ToPrintString(ref depth)); depth = 0; if (outResponse.ErrorIndication_DF8115 != null) { Logger.Log(outResponse.ErrorIndication_DF8115.ToPrintString(ref depth)); } depth = 0; if (outResponse.DataRecord_FF8105 != null) { Logger.Log(outResponse.DataRecord_FF8105.ToPrintString(ref depth)); } depth = 0; if (outResponse.DiscretionaryData_FF8106 != null) { Logger.Log(outResponse.DiscretionaryData_FF8106.ToPrintString(ref depth)); } processingOutcomeOUT.NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess; return(processingOutcomeOUT); default: throw new Exception("Unknown outResponse.OutcomeParameterSet_DF8129.Value.Start:" + outResponse.OutcomeParameterSet_DF8129.Value.Start.ToString()); } case KernelReaderTerminalServiceResponseEnum.UI: KernelUIResponse uiResponse = (KernelUIResponse)k2Response; if (uiResponse.UserInterfaceRequest_DF8116 != null) { string s1 = uiResponse.UserInterfaceRequest_DF8116.Value.KernelMessageidentifierEnum.ToString(); string s2 = uiResponse.UserInterfaceRequest_DF8116.Value.KernelStatusEnum.ToString(); OnUserInterfaceRequest(CreateUIMessageEventArgs( uiResponse.UserInterfaceRequest_DF8116.Value.KernelMessageidentifierEnum, uiResponse.UserInterfaceRequest_DF8116.Value.KernelStatusEnum, Formatting.ConvertToInt32(uiResponse.UserInterfaceRequest_DF8116.Value.HoldTime))); } int depthUI = 0; if (uiResponse.UserInterfaceRequest_DF8116 != null) { Logger.Log(uiResponse.UserInterfaceRequest_DF8116.ToPrintString(ref depthUI)); } break; case KernelReaderTerminalServiceResponseEnum.PIN: // display pin screen OnPinRequest(new EventArgs()); break; case KernelReaderTerminalServiceResponseEnum.TRM: OnTRMRequest(new EventArgs()); break; case KernelReaderTerminalServiceResponseEnum.ONLINE: KernelOnlineResponse onlineResponse = (KernelOnlineResponse)k2Response; OnOnlineRequest(new OnlineEventArgs(onlineResponse.data, onlineResponse.discretionaryData)); break; default: throw new Exception("Unknown Kernel1ReaderTerminalServiceResponseEnum:" + k2Response.KernelReaderTerminalServiceResponseEnum); } kernel.KernelQ.DequeueFromOutput(false); //only remove message when finished processing } catch (Exception ex) { OnExceptionOccured(ex); return(null); } } }