Попытка отправки строковой команды = "SALE,100.00"; // Команда продажи за 100 долларов США
string command = $"
SALE{amount:F2}{referenceNumber}";
Но из них отображается ошибка
"\0\fPOS0110E/003"
public async Task ProcessSale(decimal amount, string referenceNumber)
{
string command = "SALE,100.00"; // Sale command for $100
//string command = $"SALE{amount:F2}{referenceNumber}";
return await terminal.SendCommandAsync(command);
}
var manager = new PaxTerminalManager("172.16.10.212", 8888);
bool success = await manager.PerformSale(50.00m, "INV001");
if (success)
{
Console.WriteLine("Sale transaction completed successfully.");
}
else
{
Console.WriteLine("Sale transaction failed.");
}
async Task ProcessPayment()
{
var terminal = new PaxTerminal("172.16.10.212", 8888);
await terminal.ConnectAsync();
var transactions = new PaxTransactions(terminal);
try
{
string result = await transactions.ProcessSale(50.00m, "INV001");
var response = PaxResponseHandler.ParseResponse(result);
if (response.IsError)
{
Console.WriteLine($"Error occurred: {response.GetErrorMessage()}");
}
else
{
Console.WriteLine("Transaction successful");
}
// Parse the result here. The exact format will depend on your PAX terminal's configuration.
}
catch (Exception ex)
{
Console.WriteLine($"Error processing transaction: {ex.Message}");
}
finally
{
terminal.Disconnect();
}
}
PaxTerminalManager.cs
public class PaxTerminalManager
{
private PaxTerminal terminal;
private PaxTransactions transactions;
public PaxTerminalManager(string ipAddress, int port)
{
terminal = new PaxTerminal(ipAddress, port);
transactions = new PaxTransactions(terminal);
}
public async Task PerformSale(decimal amount, string referenceNumber)
{
int maxRetries = 3;
for (int attempt = 1; attempt Status == "E";
public string GetErrorMessage()
{
switch (ErrorCode)
{
case "001":
return "Invalid transaction type";
case "002":
return "Invalid amount";
case "003":
return "Communication error";
// Add more error codes as needed
default:
return "Unknown error";
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... p-protocol
Попытка интегрировать Pax A-80 с .Net с использованием протокола TCPIP. ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Обратный adb не работает при отладке сети adb tcpip/adb (беспроводная сеть)
Anonymous » » в форуме Android - 0 Ответы
- 120 Просмотры
-
Последнее сообщение Anonymous
-