public LoginResponse parseRequest()
        {
            PosClient posClient = new PosClient("127.0.0.1", 4245);

            posClient.ConnectAndLogin(request.merchantIdentifier, request.merchantSecret, Payworks.PayClient.Environment.TEST, (devices, error) =>
            {
                if (error != null)
                {
                    Console.WriteLine(error);
                }
                if (devices != null)
                {
                    CyberSourceClass.dev = devices[0];
                }
            });
            LoginResponse resp = new LoginResponse();

            resp.merchantid = request.merchantId;
            resp.status     = "OK";
            return(resp);
        }
        public void startDeviceTransaction()
        {
            transactionParameters        = new TransactionParameters.Builder().Charge(8, Currency.USD).Subject("Bunch of bamboozles").CustomIdentifier("123abc123").Build();
            transactionProcessParameters = new TransactionProcessParameters.Builder().Build();
            posClient = new PosClient("127.0.0.1", 4245);
            switch (posClient.State)
            {
            case ClientState.INITIALIZED:
                Console.WriteLine("Connection was initailized but not connected");
                break;

            case ClientState.CONNECTED:
                Console.WriteLine("Connection was initailized and we are connected");
                break;

            case ClientState.DISCONNECTED:
                Console.WriteLine("Connection was initailized but we are disconnected");
                break;
            }
            ConnectAndLoginCompleted c = new ConnectAndLoginCompleted(handleConfirmation);

            posClient.ConnectAndLogin(mercIdentifier, merchSecret, Payworks.PayClient.Environment.TEST, c);
            if (posClient.State.Equals(ClientState.CONNECTED))
            {
                Console.WriteLine("we got a connection. Press any key to continue.");
                Console.ReadLine();
            }

            Console.WriteLine("Waiting for transaction task.");
            Console.ReadLine();
            posClient.GetTransactionModule().GetTransaction("123abc123",
                                                            (transaction, error) =>
            {
                if (transaction.Status.Equals(TransactionState.ACCEPTED))
                {
                    Console.WriteLine("Test transaction was accepted. Press any key to exit.");
                    Console.ReadLine();
                }
            });
        }