internal static void SendSemafoneMaskedDtmf(string webSocket, SemafoneDtmf semafoneDtmf) { if (string.IsNullOrEmpty(webSocket)) { TpsLogManager <Semafone> .Warn("sendSemafoneMaskedDTMF : Client has either been disconnected or doesn't exist"); } try { string message = JsonConvert.SerializeObject(semafoneDtmf);; SemafoneConnection.SemafoneConnectionInstance.SendWebSocketMessage(webSocket, message); TpsLogManager <Semafone> .Info("SemafoneMaskedDTMF semafone message sent to " + webSocket); TpsLogManager <Semafone> .Info(message); } catch (Exception ex) { SemafoneConnection.SemafoneConnectionInstance.SendWebSocketMessage(webSocket, ex.Message); TpsLogManager <Semafone> .Error("sendSemafoneMaskedDTMF : " + ex.Message); } }
/// <summary> /// When we subscribe to events, this method will be called /// </summary> /// <param name="notificationEvent"></param> private void OnEvent(INotificationCallbackEvent notificationEvent) { foreach (ElementSessionType element in notificationEvent.Payload.elements) { if (element.enabled && element.state == ElementSessionStateType.ACTIVE || element.state == ElementSessionStateType.COMPLETE) { var el = new PciElement(); el.State = element.state.ToString(); el.ValidationState = element.validationState.ToString(); el.Enabled = (element.enabled ? "true" : "false"); el.Name = element.name.ToString(); el.Data = element.data; el.Length = element.length.ToString(); el.Sizemin = element.size.min.ToString(); el.Sizemax = element.size.max.ToString(); if (notificationEvent.Payload.sessionData.Length >= 4) { PropertyEntryType propertyEntryType; for (int i = 0; i <= 4; i++) { propertyEntryType = (PropertyEntryType)notificationEvent.Payload.sessionData.GetValue(i); if (propertyEntryType.name.Equals("cardGroup.panLength")) { Console.WriteLine(propertyEntryType.name + " is " + propertyEntryType.Value); TpsLogManager <Semafone> .Debug(propertyEntryType.name + " is " + propertyEntryType.Value); el.PanLength = propertyEntryType.Value; } if (propertyEntryType.name.Equals("cardGroup.cvcLength")) { Console.WriteLine(propertyEntryType.name + " is " + propertyEntryType.Value); TpsLogManager <Semafone> .Debug(propertyEntryType.name + " is " + propertyEntryType.Value); el.CvcLength = propertyEntryType.Value; } if (propertyEntryType.name.Equals("cardGroup.issueNoReq")) { Console.WriteLine(propertyEntryType.name + " is " + propertyEntryType.Value); TpsLogManager <Semafone> .Debug(propertyEntryType.name + " is " + propertyEntryType.Value); el.IssueNoReq = propertyEntryType.Value; } if (propertyEntryType.name.Equals("cardGroup.validFromReq")) { Console.WriteLine(propertyEntryType.name + " is " + propertyEntryType.Value); TpsLogManager <Semafone> .Debug(propertyEntryType.name + " is " + propertyEntryType.Value); el.ValidFromReq = propertyEntryType.Value; } if (propertyEntryType.name.Equals("cardGroup.name")) { Console.WriteLine(propertyEntryType.name + " is " + propertyEntryType.Value); TpsLogManager <Semafone> .Debug(propertyEntryType.name + " is " + propertyEntryType.Value); el.CardType = propertyEntryType.Value; } } } if (el.Name == "CVC") { _inCvc = true; } SemafoneDtmf semafoneDtmf = new SemafoneDtmf() { Semafone = new SemafonePciElement() { Dtmf = el } }; SendSemafoneMaskedDtmf(_webSocket, semafoneDtmf); Console.WriteLine(String.Format("State:[{0}] ValidationState:[{1}] Enabled:[{2}] {3}:[{4,-20}] Length:[{5}] Size:[{6}] ", element.state, element.validationState, element.enabled ? "yes" : "no", element.name, element.data, element.length, element.size )); } } // Check if we've automatically exited from secure mode if (!_secureDataClient.IsInSecureMode(_secureDataSession)) { // send an exited secure mode response to the server IsInSecureMode = false; SemafoneExitSecureModeHandset semafoneHandset = new SemafoneExitSecureModeHandset(); semafoneHandset.Semafone = new SemafoneExitSecureMode() { Exitsecuremode = true }; string message = JsonConvert.SerializeObject(semafoneHandset); SemafoneConnection.SemafoneConnectionInstance.SendWebSocketMessage(_webSocket, message); TpsLogManager <Semafone> .Info("Exit secure mode semafone message has been sent for " + _webSocket); TpsLogManager <Semafone> .Info(message); // stop listening for anymore events StopListeningForEvents(); } }