public static UserInterfaceRequest ProtocolActivation( EntryPointEnum entryPoint, TransactionRequest transactionRequest, List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > preProcessingIndicators, EMVTerminalProcessingOutcome preProcessingOutcome, bool restart) { #region 3.2.1.1 if (!restart) #endregion { if (entryPoint == EntryPointEnum.StartB) { List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> > preProcessingIndicatorsNew = new List <Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> >(); //3.2.1.1 foreach (Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> kc in preProcessingIndicators) { preProcessingIndicatorsNew.Add(Tuple.Create(kc.Item1, new EntryPointPreProcessingIndicators())); } preProcessingIndicators = preProcessingIndicatorsNew; foreach (Tuple <TerminalSupportedKernelAidTransactionTypeCombination, EntryPointPreProcessingIndicators> kc in preProcessingIndicators) { if (((TerminalSupportedContactlessKernelAidTransactionTypeCombination)kc.Item1).TTQ != null) { kc.Item2.TTQ = (TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN)((TerminalSupportedContactlessKernelAidTransactionTypeCombination)kc.Item1).TTQ.Clone(); kc.Item2.TTQ.Value.OnlineCryptogramRequired = false; kc.Item2.TTQ.Value.CVMRequired = false; } } } //clear the candidate list } #region 3.2.1.2 else #endregion { if (preProcessingOutcome.UIRequestOnRestartPresent) { return(preProcessingOutcome.UserInterfaceRequest); } } #region 3.2.1.2 if (!restart || (preProcessingOutcome != null && !preProcessingOutcome.UIRequestOnRestartPresent)) #endregion { UserInterfaceRequest userInterfaceRequest = new UserInterfaceRequest() { MessageIdentifier = MessageIdentifiersEnum.PresentCard, Status = StatusEnum.ReadyToRead, }; return(userInterfaceRequest); } return(null); }
private void Ta_ProcessCompleted(object sender, EventArgs e) { try { EMVTerminalProcessingOutcome tpo = (EMVTerminalProcessingOutcome)(e as TerminalProcessingOutcomeEventArgs).TerminalProcessingOutcome; if (tpo == null)//error occurred, error displayed via Ta_ExceptionOccured { return; } if (tpo.UIRequestOnOutcomePresent) { SetStatusLabel(string.Format("{0}\n{1}", tpo.UserInterfaceRequest.MessageIdentifier, tpo.UserInterfaceRequest.Status)); } TLV dataRecord = tpo.DataRecord; TLV discretionaryData = tpo.DiscretionaryData; if (dataRecord != null) { int depth = 0; StringBuilder sb = new StringBuilder(); sb.AppendLine(dataRecord.ToPrintString(ref depth)); depth = 0; if (discretionaryData != null) { sb.AppendLine(discretionaryData.ToPrintString(ref depth)); } SetCardDetailsLabel(sb.ToString()); if (dataRecord.Children.Get(EMVTagsEnum.TRANSACTION_TYPE_9C_KRN.Tag).Value[0] == (byte)TransactionTypeEnum.Refund) { SetStatusLabel("Refund Processed"); } else { if (((dataRecord.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.ARQC) { if (tpo.CVM == KernelCVMEnum.ONLINE_PIN) { ContentDialogResult pinResult = ContentDialogResult.None; Task.Run(async() => pinResult = await CapturePin()).Wait(); if (pinResult != ContentDialogResult.Primary) { SetStatusLabel("Pin Capture Cancelled - Cancelling transaction"); SetProcessButtonEnabled(true); return; } } SetCancelButtonEnabled(false);//need to change online request to run in a thread than can be cancelled, else we have to disable the button ApproverResponse onlineResponse = onlineApprover.DoOnlineAuth( new ApproverRequest() { DataRecord = dataRecord, DiscretionaryData = discretionaryData, DefaultCurrency = ta.GetDefaultTLV(EMVTagsEnum.TRANSACTION_CURRENCY_CODE_5F2A_KRN.Tag), TCPClientStream = tcpClientStream }); SetStatusLabel(onlineResponse.ResponseMessage); } if (((dataRecord.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.TC) { SetCancelButtonEnabled(false);//need to change online request to run in a thread than can be cancelled, else we have to disable the button ApproverResponse onlineResponse = onlineApprover.DoAdvice( new ApproverRequest() { DataRecord = dataRecord, DiscretionaryData = discretionaryData, DefaultCurrency = ta.GetDefaultTLV(EMVTagsEnum.TRANSACTION_CURRENCY_CODE_5F2A_KRN.Tag), TCPClientStream = tcpClientStream }, true); SetStatusLabel(onlineResponse.ResponseMessage); } } } } catch (Exception ex) { ta.CancelTransactionRequest(); SetStatusLabel(ex.Message); } finally { SetProcessButtonEnabled(true); SetCancelButtonEnabled(true); } }