package examples;

public class PaymentWithCancel {
    public static void main(String[] args) {
        device.Pinpad pp = new device.Pinpad();

        try {
            pp.ttkSession.connect();
            int amount = 32200;

            //pay
            ttk.commands.Command payment = new ttk.commands.Payment(pp, amount);
            ttk.Buffer paymentResult = payment.run();

            //cancel
            ttk.commands.Cancel cancel = new ttk.commands.Cancel(pp, amount);
            cancel.setErn(payment.getErn());
            ttk.Buffer cancelResult = cancel.run();

            pp.ttkSession.disconnect();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
