Object passed in to request the voiding of a payment
Inheritance: BaseRequest
示例#1
0
        public static void testPaymentAndVoid(CloverConnector cloverConnector, TestConnectorListener connListener)
        {
            //BEGIN: Test Void
            SaleRequest paymentRequest = new SaleRequest();
            paymentRequest.ExternalId = ExternalIDUtil.GenerateRandomString(13);

            paymentRequest.Amount = 1324;
            paymentRequest.TipAmount = 123;

            System.Console.WriteLine("Preparing To Test Sale: $" + paymentRequest.Amount * 100.00);
            System.Console.WriteLine("Press Any Key to Continue...");
            System.Console.ReadKey();

            //cloverConnector.Sales += paymentListener;
            cloverConnector.Sale(paymentRequest);

            while (!connListener.hasResponse)
            {
                System.Console.WriteLine("Waiting for paymentResponse");
                System.Threading.Thread.Sleep(1000);
            }

            SaleResponse response = connListener.saleResponse;
            string paymentId = response.Payment.id;
            string orderId = response.Payment.order.id;
            string employeeId = response.Payment.employee.id;

            VoidPaymentRequest voidRequest = new VoidPaymentRequest();
            voidRequest.OrderId = orderId;
            voidRequest.PaymentId = paymentId;
            voidRequest.EmployeeId = employeeId;
            voidRequest.VoidReason = VoidReason.USER_CANCEL.ToString();

            cloverConnector.VoidPayment(voidRequest);

            while (!connListener.hasResponse)
            {
                System.Console.WriteLine("Waiting for voidResponse");
                System.Threading.Thread.Sleep(1000);
            }

            VoidPaymentResponse voidResponse = connListener.voidPaymentResponse;
            System.Console.WriteLine(voidResponse.Result);
            //END: Test Void
        }
 public void VoidPayment(VoidPaymentRequest request)
 {
     Send("/VoidPayment", request);
 }
        //////////////// Void methods /////////////
        private void VoidButton_Click(object sender, EventArgs e)
        {
            VoidPaymentRequest request = new VoidPaymentRequest();
            if (OrderPaymentsView.SelectedItems.Count == 1)
            {
                POSPayment payment = ((POSPayment)OrderPaymentsView.SelectedItems[0].Tag);
                request.PaymentId = payment.PaymentID;
                request.EmployeeId = payment.EmployeeID;
                request.OrderId = payment.OrderID;
                request.VoidReason = "USER_CANCEL";

                cloverConnector.VoidPayment(request);
            }
        }
        public void VoidPayment(VoidPaymentRequest request)
        {
            if (websocket != null)
            {
                VoidPaymentRequestMessage message = new VoidPaymentRequestMessage();
                message.payload = request;
                websocket.Send(JsonUtils.serialize(message));

            }
        }