// Methods /// <summary> /// Displays a message in the PinPad display with the default, safe, method /// </summary> /// <param name="message">Message to display</param> /// <returns>true if message is displayed in the PinPad</returns> public bool DisplayMessage(SimpleMessageProperty message) { DspRequest request = new DspRequest(); request.DSP_MSG.Value = message; return this.communication.SendRequestAndVerifyResponseCode(request); }
// Interfaced methods /// <summary> /// Show message on pinpad screen. /// </summary> /// <param name="firstLine">The first line of the message, shown at the first screen line. Must have 16 characters or less.</param> /// <param name="secondLine">The second line of the message, shown at the second screen line. Must have 16 characters or less.</param> /// <param name="paddingType">At what alignment the message is present. It default value is left alignment.</param> /// <returns>Whether the message could be shown with success or not.</returns> /// <exception cref="System.ArgumentOutOfRangeException">This exception is thrown only if one (or both) of the messages exceed the limit of 16 characters.</exception> public bool ShowMessage(string firstLine, string secondLine = null, Sdk.Model.DisplayPaddingType paddingType = DisplayPaddingType.Left) { if (firstLine != null && firstLine.Length > 16) { firstLine = firstLine.Substring(0, 16); } if (secondLine != null && secondLine.Length > 16) { secondLine = secondLine.Substring(0, 16); } try { SimpleMessageProperty message = new SimpleMessageProperty(firstLine, secondLine, paddingType); return this.DisplayMessage (message); } catch (ArgumentOutOfRangeException) { throw; } catch (Exception) { return false; } }
/// <summary> /// Gets the PinBlock and KeySerialNumber of a card using DUKPT mode /// </summary> /// <param name="cryptographyMode">Cryptography Mode</param> /// <param name="keyIndex">Pinpad Key Index</param> /// <param name="pan">Card Pan</param> /// <param name="pinMinLength">Card Pin Minimum length</param> /// <param name="pinMaxLength">Card Pin Maximum length</param> /// <param name="message">Pin Entry Message</param> /// <param name="pinBlock">Retrieved pin block or null on failure</param> /// <param name="ksn">Retrieved key serial number of null on failure</param> /// <returns>true on success, false on failure</returns> public bool GetDukptPin(CryptographyMode cryptographyMode, int keyIndex, string pan, int pinMinLength, int pinMaxLength, SimpleMessageProperty message, out HexadecimalData pinBlock, out HexadecimalData ksn) { // Creater GPN request: GpnRequest request = new GpnRequest(); request.GPN_METHOD.Value = new CryptographyMethod(KeyManagementMode.DerivedUniqueKeyPerTransaction, cryptographyMode); request.GPN_KEYIDX.Value = keyIndex; request.GPN_WKENC.Value = new HexadecimalData(new byte[0]); request.GPN_PAN.Value = pan; // Settings to capture PIN: GpnPinEntryRequest entry = new GpnPinEntryRequest(); entry.GPN_MIN.Value = pinMinLength; entry.GPN_MAX.Value = pinMaxLength; entry.GPN_MSG.Value = message; request.GPN_ENTRIES.Value.Add(entry); // Sends the request and gets it's response: GpnResponse response = this.Communication.SendRequestAndReceiveResponse <GpnResponse>(request); // If none response war received: if (response == null) { pinBlock = null; ksn = null; return(false); } // If a response was received: else { pinBlock = response.GPN_PINBLK.Value; ksn = response.GPN_KSN.Value; return(true); } }
/// <summary> /// Constructor /// </summary> /// <param name="message">PinPad message</param> public PinpadNotificationEventArgs(SimpleMessageProperty message) { this.Message = message; }