public override ISignatureResponse PromptForSignature(string transactionId = null) { var response = _controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A20_DO_SIGNATURE, (transactionId != null) ? 1 : 0, ControlCodes.FS, transactionId ?? string.Empty, ControlCodes.FS, (transactionId != null) ? "00" : "", ControlCodes.FS, 300 )); var signatureResponse = new SignatureResponse(response); if (signatureResponse.DeviceResponseCode == "000000") { return(GetSignatureFile()); } return(signatureResponse); }
public override IDeviceResponse Cancel() { if (_controller.ConnectionMode == ConnectionModes.HTTP) { throw new MessageException("The cancel command is not available in HTTP mode"); } try { _controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A14_CANCEL)); return(null); } catch (MessageException exc) { if (!exc.Message.Equals("Terminal returned EOT for the current message.")) { throw; } return(null); } }
internal byte[] DoTransaction(string messageId, string txnType, params IRequestSubGroup[] subGroups) { var commands = new List <object> { txnType, ControlCodes.FS }; if (subGroups.Length > 0) { commands.Add(subGroups[0]); for (int i = 1; i < subGroups.Length; i++) { commands.Add(ControlCodes.FS); commands.Add(subGroups[i]); } } var message = TerminalUtilities.BuildRequest(messageId, commands.ToArray()); return(_interface.Send(message)); }
// A04 - SET VARIABLE public IDeviceResponse DisableHostResponseBeep() { var response = controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A04_SET_VARIABLE, "01", ControlCodes.FS, "hostRspBeep", ControlCodes.FS, "N", ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS, ControlCodes.FS )); return(new PaxTerminalResponse(response, PAX_MSG_ID.A05_RSP_SET_VARIABLE)); }
internal T SendMessage <T>(string message, params string[] messageIds) where T : SipBaseResponse { var response = _interface.Send(TerminalUtilities.BuildRequest(message, Format)); return((T)Activator.CreateInstance(typeof(T), response, messageIds)); }
// A26 - REBOOT public IDeviceResponse Reboot() { var response = controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A26_REBOOT)); return(new PaxDeviceResponse(response, PAX_MSG_ID.A27_RSP_REBOOT)); }
public IBatchCloseResponse BatchClose() { var response = controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.B00_BATCH_CLOSE, DateTime.Now.ToString("YYYYMMDDhhmmss"))); return(new BatchCloseResponse(response)); }
// A00 - INITIALIZE public IInitializeResponse Initialize() { var response = controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A00_INITIALIZE)); return(new InitializeResponse(response)); }
// A16 - RESET public IDeviceResponse Reset() { var response = controller.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A16_RESET)); return(new PaxTerminalResponse(response, PAX_MSG_ID.A17_RSP_RESET)); }
internal IDeviceMessage BuildProcessTransaction(TerminalAuthBuilder builder) { string message = string.Empty; // Pay@Table functionalities if (_settings.ConnectionMode.Equals(ConnectionModes.PAY_AT_TABLE)) { if (builder.PayAtTableResponse != null && builder.AdditionalMessage != null) { StringBuilder payAtTableResp = new StringBuilder(); string privData = builder.PayAtTableResponse.ToString(); if (privData.Length < 10) { for (int i = privData.Length; i < 10; i++) { privData += (char)ControlCodes.SP; } } decimal?patAmount = ValidateAmount(builder.Amount); string patCurrency = ValidateCurrency(builder.CurrencyCode); int additionalMsg = (int?)builder.AdditionalMessage ?? 0; payAtTableResp.Append(PAYATTABLE_RESP.PAT_EPOS_NUMBER); payAtTableResp.Append(PAYATTABLE_RESP.PAT_STATUS); payAtTableResp.Append(patAmount?.ToString("00000000")); payAtTableResp.Append(additionalMsg); payAtTableResp.Append(patCurrency); payAtTableResp.Append(privData); message = payAtTableResp.ToString(); } else if (!string.IsNullOrEmpty(builder.FilePath)) { message = TerminalUtilities.GetTextContent(builder.FilePath); } else { throw new BuilderException("PayAtTable Response type and Additional message cannot be null."); } } else { // Standard functionalities int referenceNumber = builder.ReferenceNumber; decimal?amount = builder.Amount; int returnRep = 1; int paymentMode = 0; int paymentType = (int)((IngenicoInterface)_interface).paymentMethod; string currencyCode = "826"; string privateData = "EXT0100000"; int immediateAnswer = 0; int forceOnline = 0; string extendedData = "0000000000"; decimal?cashbackAmount = builder.CashBackAmount; string authCode = builder.AuthCode; string tableId = builder.TableNumber; // Validations if (referenceNumber == default(int) && RequestIdProvider != null) { referenceNumber = RequestIdProvider.GetRequestId(); } amount = ValidateAmount(amount); // Tax free Refund handling if (paymentType == (int)PaymentType.Refund && builder.TaxFreeType == TaxFreeType.CASH) { paymentType = (int)PaymentType.TaxFreeCashRefund; } else if (paymentType == (int)PaymentType.Refund && builder.TaxFreeType == TaxFreeType.CREDIT) { paymentType = (int)PaymentType.TaxFreeCreditRefund; } paymentMode = ValidatePaymentMode(builder.PaymentMode); currencyCode = ValidateCurrency((string.IsNullOrEmpty(builder.CurrencyCode) ? currencyCode : builder.CurrencyCode)); if (!string.IsNullOrEmpty(tableId)) { ValidateTableId(tableId); extendedData = INGENICO_REQ_CMD.TABLE_WITH_ID.FormatWith(tableId); } else if (!string.IsNullOrEmpty(authCode)) { extendedData = INGENICO_REQ_CMD.AUTHCODE.FormatWith(authCode); } else if (cashbackAmount != null) { ValidateCashbackAmount(cashbackAmount); cashbackAmount *= 100; extendedData = INGENICO_REQ_CMD.CASHBACK.FormatWith(Convert.ToInt64(Math.Round(cashbackAmount.Value, MidpointRounding.AwayFromZero))); } // Concat all data to create a request string. var sb = new StringBuilder(); sb.Append(referenceNumber.ToString("00").Substring(0, 2)); sb.Append(amount?.ToString("00000000")); sb.Append(returnRep); sb.Append(paymentMode); sb.Append(paymentType); sb.Append(currencyCode); sb.Append(privateData); sb.Append("A01" + immediateAnswer); sb.Append("B01" + forceOnline); sb.Append(extendedData); message = sb.ToString(); } return(TerminalUtilities.BuildRequest(message, _settings.ConnectionMode)); }
internal byte[] DoSend(string messageId, params object[] elements) { return(_interface.Send(TerminalUtilities.BuildRequest(messageId, elements))); }
// A16 - RESET public PaxDeviceResponse Reset() { var response = _interface.Send(TerminalUtilities.BuildRequest(PAX_MSG_ID.A16_RESET)); return(new PaxDeviceResponse(response, PAX_MSG_ID.A17_RSP_RESET)); }