K
K
Kverty2021-02-18 14:36:28
Java
Kverty, 2021-02-18 14:36:28

How to programmatically send a check by Evotor online cash register?

I am writing my application for the online cash register Evotor 5 (works on Android).
It is necessary to make the function of generating and sending a check. More precisely, the function is written, but for some reason it does not work.
Specific problem: executing PrintSellReceiptCommand gives the error "Delivery option isn't paid". What it means is not clear.
The Evotor API documentation is either incomplete or just not clear to me. The difficulty is that the equipment and the Evotor library are specific, there is practically zero information about them.
I will be glad to any help in solving the problem, including paid. I also published a task on Freelance, but this is more of a question than a task.
Here is the code for generating and sending a check. I quote it in full, because it is not clear what exactly causes the error.

List<Position> positions = new ArrayList<>();
positions.add(
        Position.Builder.newInstance(
                UUID.randomUUID().toString(),
                null,
                "Тестовый товар",
                "шт",
                0,
                new BigDecimal(1),
                new BigDecimal(3)
        ).build()
);

Map<Payment, BigDecimal> payments = new HashMap<Payment, BigDecimal>();
payments.put(new Payment(
        UUID.randomUUID().toString(),
        new BigDecimal(sum),
        null, // Deprecated
        new PaymentPerformer(
                new PaymentSystem(PaymentType.ELECTRON, "Bank", "Cashless"),
                null,
                null,
                null,
                null
        ),
        null,
        null,
        null,
        null
),new BigDecimal(sum));

PrintGroup printGroup = new PrintGroup(UUID.randomUUID().toString(),
        PrintGroup.Type.CASH_RECEIPT, null, null, null, null, false);
Receipt.PrintReceipt printReceipt = new Receipt.PrintReceipt(
        printGroup,
        positions,
        payments,
        new HashMap<Payment, BigDecimal>(), new HashMap<String, BigDecimal>()
);
ArrayList<Receipt.PrintReceipt> printReceipts = new ArrayList<>();
printReceipts.add(printReceipt);

PrintSellReceiptCommand command = new PrintSellReceiptCommand(printReceipts,null,null,email,new BigDecimal(0),address,place,null);

command.process(MainActivity.this, new IntegrationManagerCallback() {
    @Override
    public void run(IntegrationManagerFuture future) {
        IntegrationManagerFuture.Result result2 = null;
        try {
            result2 = future.getResult();
            switch (result2.getType()) {
                case OK:
                    // ...
                    break;
                case ERROR:
                    Error error = result2.getError(); // здесь выдаётся ошибка Delivery option isn't paid
                    break;
            }
        } catch (IntegrationException e) {
            e.printStackTrace();
        }
    }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question