private void cmdCancelTx_Clicked(object sender, EventArgs e) { Stop(); txResult = TxResult.Cancelled; SetTxFinalResultLabel(""); SetStatusLabel(new UIMessageEventArgs(MessageIdentifiersEnum.ClearDisplay, StatusEnum.EndProcessing), InterFaceType.Cancelled); TxCompleted?.Invoke(this, new TxCompletedEventArgs(txResult, InterFaceType.Cancelled, Optional <TLV> .CreateEmpty(), Optional <QRDEList> .CreateEmpty())); }
private void ProcessCompletion(TerminalProcessingOutcomeEventArgs e, InterFaceType interFaceType) { TLV data = null; TLV discretionaryData = null; QRDEList qrData = null; try { long?amount = Convert.ToInt64(totalAmount.Total); TerminalProcessingOutcome tpo = e.TerminalProcessingOutcome; if (tpo == null)//error occurred, error displayed via Ta_ExceptionOccured { return; } if (tpo is EMVTerminalProcessingOutcome) { data = ((EMVTerminalProcessingOutcome)tpo).DataRecord; discretionaryData = ((EMVTerminalProcessingOutcome)tpo).DiscretionaryData; qrData = ((EMVTerminalProcessingOutcome)tpo).QRData; if (data != null) //error { SetStatusLabel(new UIMessageEventArgs(MessageIdentifiersEnum.RemoveCard, StatusEnum.EndProcessing), interFaceType); //may be a contactless magstripe transaction if (data.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag) == null) { txResult = TxResult.ContactlessMagOnline; } else { if (((data.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.ARQC) { if (interFaceType == InterFaceType.Contact) { throw new EMVProtocolException("Invalid state for contact, gen ac 2 returned arqc?"); } CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN cvmr = new CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN(data.Children.Get(EMVTagsEnum.CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN.Tag)); if (cvmr.Value.GetCVMPerformed() == CVMCode.EncipheredPINVerifiedOnline) { ContactlessApp_PinRequest(data.Children); } txResult = TxResult.ContactlessOnline; } if (((data.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.TC) { txResult = TxResult.Approved; } if (((data.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.AAC) { txResult = TxResult.Declined; } } } else if (qrData != null) { if (interFaceType == InterFaceType.QRCodeScanned) { txResult = TxResult.QRCodeScanned; } else if (interFaceType == InterFaceType.QRCodeToPoll) { txResult = TxResult.QRCodeToPoll; } } else { txResult = TxResult.Declined; } SetTxFinalResultLabel(txResult.ToString()); } else { SetStatusLabel(new UIMessageEventArgs(tpo.UserInterfaceRequest.MessageIdentifier, tpo.UserInterfaceRequest.Status), interFaceType); } } catch (Exception ex) { Device.BeginInvokeOnMainThread(() => { UIMessageEventArgs ui = new UIMessageEventArgs(MessageIdentifiersEnum.TryAgain, StatusEnum.ProcessingError) { AdditionalMessage = ex.Message }; SetStatusLabel(ui, interFaceType); }); } finally { StopContactPaymentApp(); StopContactlessPaymentApp(); StopQRCodePollPaymentApp(); #region Merge EMV Lists if (discretionaryData != null) { if (data != null) { data.Children.AddListToList(discretionaryData.Children); } } #endregion TxCompleted?.Invoke(this, new TxCompletedEventArgs(txResult, interFaceType, Optional <TLV> .Create(data), Optional <QRDEList> .Create(qrData))); } }