public VoidPaymentResponse Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResponse();

            result.AddError("Void method not supported");
            return(result);
        }
Esempio n. 2
0
        public void OnVoidPaymentResponse(VoidPaymentResponse response)
        {
            OnVoidPaymentResponseMessage voidPaymentResponse = new OnVoidPaymentResponseMessage();

            voidPaymentResponse.payload = response;
            WebSocket.Send(Serialize(voidPaymentResponse));
        }
Esempio n. 3
0
        public void OnVoidPaymentResponse(VoidPaymentResponse response)
        {
            bool voided = false;

            foreach (POSOrder order in Store.Orders)
            {
                foreach (POSPayment payment in order.Payments)
                {
                    if (payment.PaymentID == response.PaymentId)
                    {
                        payment.PaymentStatus = POSPayment.Status.VOIDED;
                        voided = true;
                        break;
                    }
                }
                if (voided)
                {
                    break;
                }
            }
            uiThread.Send(delegate(object state) {
                VoidButton.Enabled = false;
                // shortbut to refresh UI
                OrderPaymentsView.SelectedItems[0].SubItems[0].Text = POSPayment.Status.VOIDED.ToString();
            }, null);
        }
Esempio n. 4
0
        public void OnVoidPaymentResponse(VoidPaymentResponse response)
        {
            OnVoidPaymentResponseMessage message = new OnVoidPaymentResponseMessage();

            message.payload = response;
            WebSocket.Send(JsonUtils.serialize(message));
        }
Esempio n. 5
0
        public VoidPaymentResponse Process(VoidPaymentRequest request)
        {
            Transaction tx = new Transaction();

            tx.TestMode = request.Test;

            tx.SetRequestParameter("VPSProtocol", "3.00");
            tx.SetRequestParameter("TxType", "VOID");

            tx.SetRequestParameter("Vendor", request.Vendor);
            tx.SetRequestParameter("VendorTxCode", request.VendorTxCode);
            tx.SetRequestParameter("VPSTxId", request.VPSTxId);
            tx.SetRequestParameter("SecurityKey", request.SecurityKey);
            tx.SetRequestParameter("TxAuthNo", request.TxAuthNo);

            tx.SendVoid();

            // Receive Response
            var response = new VoidPaymentResponse();

            response.VPSProtocol = tx.GetResponseParameter("VPSProtocol");
            response.TxType = "VOID";

            response.Status = tx.GetResponseParameter("Status");
            response.StatusDetail = tx.GetResponseParameter("StatusDetail");

            if (!String.IsNullOrEmpty(response.StatusDetail))
                response.StatusDetail = response.StatusDetail.Replace("'", "`");

            return response;
        }
Esempio n. 6
0
 public override void OnVoidPaymentResponse(VoidPaymentResponse response)
 {
     System.Console.WriteLine("Void Response: " + response.Result);
     //this.cloverConnector.Voids.Remove(this);
     this.cloverConnector     = null;
     this.voidPaymentResponse = response;
     this.hasResponse         = true;
 }
        public void VoidPaymentResponse(HttpListenerContext context)
        {
            VoidPaymentResponse response = ParseResponse <VoidPaymentResponse>(context);

            if (response != null)
            {
                connectorListener.ForEach(listener => listener.OnVoidPaymentResponse(response));
            }
            SendTextResponse(context, "");
        }
Esempio n. 8
0
 public void OnVoidPaymentResponse(VoidPaymentResponse response)
 {
     if (response.Success)
     {
         uiThread.Send(delegate(object state)
         {
         }, null);
     }
     else if (response.Result.Equals(ResponseCode.FAIL))
     {
         uiThread.Send(delegate(object state)
         {
         }, null);
     }
 }
Esempio n. 9
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 VoidPaymentResponse(HttpListenerContext context)
 {
     try
     {
         VoidPaymentResponse response = ParseResponse <VoidPaymentResponse>(context);
         if (response != null)
         {
             connectorListener.ForEach(listener => listener.OnVoidPaymentResponse(response));
         }
         SendTextResponse(context, "");
     }
     catch (Exception e)
     {
         context.Response.StatusCode        = 400;
         context.Response.StatusDescription = e.Message;
         SendTextResponse(context, "error processing request");
     }
 }
Esempio n. 11
0
 public void OnVoidPaymentResponse(VoidPaymentResponse response) => VoidPaymentResponse?.Invoke(this, response);
        private void websocket_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            // do the parsing of the message, targeted for the callback listener
            JObject jsonObj = null;

            try
            {
                jsonObj = (JObject)JsonConvert.DeserializeObject(e.Message);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message + " => " + e.Message);
                listeners.ForEach(listener => listener.OnError(exc));
                return;
            }

            JToken method = jsonObj.GetValue(ServicePayloadConstants.PROP_METHOD);

            if (method == null)
            {
                listeners.ForEach(listener => listener.OnError(new NullReferenceException("Invalid message: " + e.Message)));
                return;
            }
            JObject         payload = (JObject)jsonObj.GetValue(ServicePayloadConstants.PROP_PAYLOAD);
            WebSocketMethod wsm     = (WebSocketMethod)Enum.Parse(typeof(WebSocketMethod), method.ToString());

            switch (wsm)
            {
            case WebSocketMethod.DeviceActivityStart:
            {
                CloverDeviceEvent deviceEvent = JsonUtils.deserialize <CloverDeviceEvent>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceActivityStart(deviceEvent));
                break;
            }

            case WebSocketMethod.DeviceActivityEnd:
            {
                CloverDeviceEvent deviceEvent = JsonUtils.deserialize <CloverDeviceEvent>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceActivityEnd(deviceEvent));
                break;
            }

            case WebSocketMethod.DeviceConnected:
            {
                listeners.ForEach(listener => listener.OnDeviceConnected());
                break;
            }

            case WebSocketMethod.DeviceDisconnected:
            {
                listeners.ForEach(listener => listener.OnDeviceDisconnected());
                break;
            }

            case WebSocketMethod.DeviceReady:
            {
                listeners.ForEach(listener => listener.OnDeviceReady());
                break;
            }

            case WebSocketMethod.SignatureVerifyRequest:
            {
                SignatureVerifyRequest        svr     = JsonUtils.deserialize <SignatureVerifyRequest>(payload.ToString());
                WebSocketSigVerRequestHandler handler = new WebSocketSigVerRequestHandler(this, svr);
                listeners.ForEach(listener => listener.OnSignatureVerifyRequest(handler));
                break;
            }

            case WebSocketMethod.SaleResponse:
            {
                SaleResponse sr = JsonUtils.deserialize <SaleResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnSaleResponse(sr));
                break;
            }

            case WebSocketMethod.AuthResponse:
            {
                AuthResponse sr = JsonUtils.deserialize <AuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnAuthResponse(sr));
                break;
            }

            case WebSocketMethod.RefundPaymentResponse:
            {
                RefundPaymentResponse sr = JsonUtils.deserialize <RefundPaymentResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnRefundPaymentResponse(sr));
                break;
            }

            case WebSocketMethod.VoidPaymentResponse:
            {
                VoidPaymentResponse sr = JsonUtils.deserialize <VoidPaymentResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnVoidPaymentResponse(sr));
                break;
            }

            case WebSocketMethod.ManualRefundResponse:
            {
                ManualRefundResponse sr = JsonUtils.deserialize <ManualRefundResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnManualRefundResponse(sr));
                break;
            }

            case WebSocketMethod.TipAdjustAuthResponse:
            {
                TipAdjustAuthResponse taar = JsonUtils.deserialize <TipAdjustAuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnAuthTipAdjustResponse(taar));
                break;
            }

            case WebSocketMethod.VaultCardResponse:
            {
                VaultCardResponse vcr = JsonUtils.deserialize <VaultCardResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnVaultCardResponse(vcr));
                break;
            }
            }
        }
Esempio n. 13
0
 public void OnVoidPaymentResponse(VoidPaymentResponse response) => Event?.Invoke(this, EventFrom("VoidPaymentResponse", response));
        private void websocket_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            // do the parsing of the message, targeted for the callback listener
            JObject jsonObj = null;

            try
            {
                jsonObj = (JObject)JsonConvert.DeserializeObject(e.Message);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message + " => " + e.Message);
                listeners.ForEach(listener => listener.OnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.EXCEPTION, 0, exc.Message + " => " + e.Message)));
                return;
            }

            JToken method = jsonObj.GetValue(ServicePayloadConstants.PROP_METHOD);

            if (method == null)
            {
                listeners.ForEach(listener => listener.OnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.VALIDATION_ERROR, 0, "Invalid message: " + e.Message)));
                return;
            }
            JObject         payload = (JObject)jsonObj.GetValue(ServicePayloadConstants.PROP_PAYLOAD);
            WebSocketMethod wsm     = (WebSocketMethod)Enum.Parse(typeof(WebSocketMethod), method.ToString());

            switch (wsm)
            {
            case WebSocketMethod.DeviceActivityStart:
            {
                CloverDeviceEvent deviceEvent = JsonUtils.deserialize <CloverDeviceEvent>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceActivityStart(deviceEvent));
                break;
            }

            case WebSocketMethod.DeviceActivityEnd:
            {
                CloverDeviceEvent deviceEvent = JsonUtils.deserialize <CloverDeviceEvent>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceActivityEnd(deviceEvent));
                break;
            }

            case WebSocketMethod.DeviceError:
            {
                CloverDeviceErrorEvent deviceErrorEvent = JsonUtils.deserialize <CloverDeviceErrorEvent>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceError(deviceErrorEvent));
                break;
            }

            case WebSocketMethod.DeviceConnected:
            {
                listeners.ForEach(listener => listener.OnDeviceConnected());
                break;
            }

            case WebSocketMethod.DeviceDisconnected:
            {
                listeners.ForEach(listener => listener.OnDeviceDisconnected());
                break;
            }

            case WebSocketMethod.DeviceReady:
            {
                MerchantInfo merchantInfo = JsonUtils.deserialize <MerchantInfo>(payload.ToString());
                listeners.ForEach(listener => listener.OnDeviceReady(merchantInfo));
                break;
            }

            case WebSocketMethod.VerifySignatureRequest:
            {
                VerifySignatureRequest        svr     = JsonUtils.deserialize <VerifySignatureRequest>(payload.ToString());
                WebSocketSigVerRequestHandler handler = new WebSocketSigVerRequestHandler(this, svr);
                listeners.ForEach(listener => listener.OnVerifySignatureRequest(handler));
                break;
            }

            case WebSocketMethod.SaleResponse:
            {
                SaleResponse sr = JsonUtils.deserialize <SaleResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnSaleResponse(sr));
                break;
            }

            case WebSocketMethod.PreAuthResponse:
            {
                PreAuthResponse pr = JsonUtils.deserialize <PreAuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnPreAuthResponse(pr));
                break;
            }

            case WebSocketMethod.AuthResponse:
            {
                AuthResponse ar = JsonUtils.deserialize <AuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnAuthResponse(ar));
                break;
            }

            case WebSocketMethod.CapturePreAuthResponse:
            {
                CapturePreAuthResponse ar = JsonUtils.deserialize <CapturePreAuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnCapturePreAuthResponse(ar));
                break;
            }

            case WebSocketMethod.RefundPaymentResponse:
            {
                RefundPaymentResponse sr = JsonUtils.deserialize <RefundPaymentResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnRefundPaymentResponse(sr));
                break;
            }

            case WebSocketMethod.VoidPaymentResponse:
            {
                VoidPaymentResponse sr = JsonUtils.deserialize <VoidPaymentResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnVoidPaymentResponse(sr));
                break;
            }

            case WebSocketMethod.ManualRefundResponse:
            {
                ManualRefundResponse sr = JsonUtils.deserialize <ManualRefundResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnManualRefundResponse(sr));
                break;
            }

            case WebSocketMethod.TipAdjustAuthResponse:
            {
                TipAdjustAuthResponse taar = JsonUtils.deserialize <TipAdjustAuthResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnTipAdjustAuthResponse(taar));
                break;
            }

            case WebSocketMethod.VaultCardResponse:
            {
                VaultCardResponse vcr = JsonUtils.deserialize <VaultCardResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnVaultCardResponse(vcr));
                break;
            }

            case WebSocketMethod.ReadCardDataResponse:
            {
                ReadCardDataResponse rcdr = JsonUtils.deserialize <ReadCardDataResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnReadCardDataResponse(rcdr));
                break;
            }

            case WebSocketMethod.CloseoutResponse:
            {
                CloseoutResponse cr = JsonUtils.deserialize <CloseoutResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnCloseoutResponse(cr));
                break;
            }

            case WebSocketMethod.ConfirmPaymentRequest:
            {
                ConfirmPaymentRequest cpr = JsonUtils.deserialize <ConfirmPaymentRequest>(payload.ToString());
                listeners.ForEach(listener => listener.OnConfirmPaymentRequest(cpr));
                break;
            }

            case WebSocketMethod.RetrievePendingPaymentsResponse:
            {
                RetrievePendingPaymentsResponse rppr = JsonUtils.deserialize <RetrievePendingPaymentsResponse>(payload.ToString());
                listeners.ForEach(listener => listener.OnRetrievePendingPaymentsResponse(rppr));
                break;
            }

            case WebSocketMethod.PrintManualRefundDeclinedReceipt:
            {
                PrintManualRefundDeclineReceiptMessage pmrdrm = JsonUtils.deserialize <PrintManualRefundDeclineReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintManualRefundDeclineReceipt(pmrdrm));
                break;
            }

            case WebSocketMethod.PrintManualRefundReceipt:
            {
                PrintManualRefundReceiptMessage pmrrm = JsonUtils.deserialize <PrintManualRefundReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintManualRefundReceipt(pmrrm));
                break;
            }

            case WebSocketMethod.PrintPaymentDeclinedReceipt:
            {
                PrintPaymentDeclineReceiptMessage ppdrm = JsonUtils.deserialize <PrintPaymentDeclineReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintPaymentDeclineReceipt(ppdrm));
                break;
            }

            case WebSocketMethod.PrintPaymentMerchantCopyReceipt:
            {
                PrintPaymentMerchantCopyReceiptMessage ppmcrm = JsonUtils.deserialize <PrintPaymentMerchantCopyReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintPaymentMerchantCopyReceipt(ppmcrm));
                break;
            }

            case WebSocketMethod.PrintPaymentReceipt:
            {
                PrintPaymentReceiptMessage pprm = JsonUtils.deserialize <PrintPaymentReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintPaymentReceipt(pprm));
                break;
            }

            case WebSocketMethod.PrintPaymentRefundReceipt:
            {
                PrintRefundPaymentReceiptMessage prprm = JsonUtils.deserialize <PrintRefundPaymentReceiptMessage>(payload.ToString());
                listeners.ForEach(listener => listener.OnPrintRefundPaymentReceipt(prprm));
                break;
            }
            }
        }
Esempio n. 15
0
 public void OnVoidPaymentResponse(VoidPaymentResponse response)
 {
     Send("/VoidPaymentResponse", Serialize(response));
 }
 public VoidPaymentResponse Void(VoidPaymentRequest voidPaymentRequest)
 {
     var result = new VoidPaymentResponse();
     result.AddError("Void method not supported");
     return result;
 }
Esempio n. 17
0
 public void OnVoidPaymentResponse(VoidPaymentResponse response)
 {
     Program.WriteLine(MethodBase.GetCurrentMethod().Name);
 }
 public void OnVoidPaymentResponse(VoidPaymentResponse p0)
 {
 }
 public void VoidPaymentResponse(VoidPaymentResponse response)
 {
     connectorListener.ForEach(listener => listener.OnVoidPaymentResponse(response));
 }