Ejemplo n.º 1
0
        public static Messages.Response EpaymentProcess(Messages.Request request)
        {
            float  amount   = request.Parameters.Value <float>("amount");
            string device   = request.Parameters.Value <string>("device");
            string protocol = request.Parameters.Value <string>("protocol");
            string port     = request.Parameters.Value <string>("port");
            string data     = request.Parameters.Value <string>("data");
            int    pos      = request.Parameters.Value <int>("pos");

            PaymentRequest paymentRequest = new PaymentRequest(amount);

            ConcertProtocol concertProtocol = ConcertProtocol.find(protocol);

            concertProtocol.Terminal = new SerialTerminal(port);

            Issue issue = concertProtocol.SendPaymentRequest(paymentRequest);

            if (issue.Type == Issue.SUCCESS)
            {
                return(request.Success(issue.Response));
            }
            else
            {
                return(request.Failure("", issue.Message));
            }
        }