Example #1
0
        private bool LogOUT()
        {
            Thread t = new Thread(() =>
            {
                try
                {
                    // create/read configuration from a configuration file
                    PayConfiguration config = createConfigFromFile(mPfad);

                    // start a new session
                    PaySession session = new PaySession();

                    // we define a message listener for events (optional)
                    MyMessageListener msgList = new MyMessageListener(lbl_Status, btn_OK);

                    session.setListener(msgList);

                    // login (this is always the first communication to the EFT)
                    mTerminal = session.login(config);

                    // logout at last
                    session.logout();
                }
                catch (PayException x)
                {
                    // catch all PayExceptions and write to console
                    Console.WriteLine(x.toString());
                }
            });

            t.Start();
            return(true);
        }
Example #2
0
        private bool ONLine()
        {
            Thread t = new Thread(() =>
            {
                try
                {
                    //--------------
                    // create/read configuration from a configuration file
                    PayConfiguration config = createConfigFromFile(mPfad);

                    // start a new session
                    PaySession session = new PaySession();

                    // we define a message listener for events (optional)
                    MyMessageListener msgList = new MyMessageListener(lbl_Status, btn_OK);

                    session.setListener(msgList);

                    if (!session.isLoggedIn())
                    {
                        // login (this is always the first communication to the EFT)
                        mTerminal = session.login(config);
                    }


                    try
                    {
                        // Now we start a payment of 1 cent

                        // First we create the result object PayMedia
                        PayMedia media = new PayMedia();

                        // Then we start the authorisation of the card

                        short payType = PayTerminal.__Fields.PAY_TYPE_AUTOMATIC;
                        PayTransaction transaction = mTerminal.payment(mBetrag, payType, media);

                        // When we are here, the given card was accepted. We commit the transaction.
                        // If transaction is null, the device doesn't support commit and we are finished.
                        if (transaction != null)
                        {
                            transaction.commit(media);
                        }
                    }
                    finally
                    {
                    }
                }
                catch (PayException x)
                {
                    // catch all PayExceptions and write to console
                    Console.WriteLine(x.toString());
                }
            });

            t.Start();
            return(true);
        }