/// <summary>
        /// This handles parsing the generic message and figuring
        /// out which handler should be used for processing
        /// </summary>
        /// <param name="message">The message.</param>
        public void onMessage(string message)
        {
#if DEBUG
            Console.WriteLine("Received raw message: " + message);
#endif
            //CloverTransportObserver
            // Deserialize the message object to a real object, and figure
            RemoteMessage rMessage = JsonUtils.deserializeSDK <RemoteMessage>(message);
            remoteMessageVersion = Math.Max(remoteMessageVersion, rMessage.version);

            switch (rMessage.method)
            {
            case Methods.BREAK:
                break;

            case Methods.ACK:
                AcknowledgementMessage ackMessage = JsonUtils.deserializeSDK <AcknowledgementMessage>(rMessage.payload);
                notifyObserverAck(ackMessage);
                break;

            case Methods.CASHBACK_SELECTED:
                CashbackSelectedMessage cbsMessage = JsonUtils.deserializeSDK <CashbackSelectedMessage>(rMessage.payload);
                notifyObserversCashbackSelected(cbsMessage);
                break;

            case Methods.DISCOVERY_RESPONSE:
                DiscoveryResponseMessage drMessage = JsonUtils.deserializeSDK <DiscoveryResponseMessage>(rMessage.payload);
                deviceInfo.name   = drMessage.name;
                deviceInfo.serial = drMessage.serial;
                deviceInfo.model  = drMessage.model;
                notifyObserversDiscoveryResponse(drMessage);
                break;

            case Methods.FINISH_CANCEL:
                FinishCancelMessage finishCancelMessage = JsonUtils.deserializeSDK <FinishCancelMessage>(rMessage.payload);
                notifyObserversFinishCancel(finishCancelMessage.requestInfo);
                break;

            case Methods.FINISH_OK:
                FinishOkMessage fokmsg = JsonUtils.deserializeSDK <FinishOkMessage>(rMessage.payload);
                notifyObserversFinishOk(fokmsg);
                break;

            case Methods.KEY_PRESS:
                KeyPressMessage kpm = JsonUtils.deserializeSDK <KeyPressMessage>(rMessage.payload);
                notifyObserversKeyPressed(kpm);
                break;

            case Methods.ORDER_ACTION_RESPONSE:
                break;

            case Methods.PARTIAL_AUTH:
                PartialAuthMessage partialAuth = JsonUtils.deserializeSDK <PartialAuthMessage>(rMessage.payload);
                notifyObserversPartialAuth(partialAuth);
                break;

            case Methods.PAYMENT_VOIDED:
                // this seems to only gets called if a Signature is "Canceled" on the device
                break;

            case Methods.CONFIRM_PAYMENT_MESSAGE:
                setPaymentConfirmationIdle(false);
                ConfirmPaymentMessage confirmPaymentMessage = JsonUtils.deserializeSDK <ConfirmPaymentMessage>(rMessage.payload);
                notifyObserversConfirmPayment(confirmPaymentMessage);
                break;

            case Methods.TIP_ADDED:
                TipAddedMessage tipMessage = JsonUtils.deserializeSDK <TipAddedMessage>(rMessage.payload);
                notifyObserversTipAdded(tipMessage);
                break;

            case Methods.TX_START_RESPONSE:
                TxStartResponseMessage txsrm = JsonUtils.deserializeSDK <TxStartResponseMessage>(rMessage.payload);
                notifyObserversTxStartResponse(txsrm);
                break;

            case Methods.TX_STATE:
                TxStateMessage txStateMsg = JsonUtils.deserializeSDK <TxStateMessage>(rMessage.payload);
                notifyObserversTxState(txStateMsg);
                break;

            case Methods.UI_STATE:
                UiStateMessage uiStateMsg = JsonUtils.deserializeSDK <UiStateMessage>(rMessage.payload);
                notifyObserversUiState(uiStateMsg);
                break;

            case Methods.VERIFY_SIGNATURE:
                paymentRejected = false;
                VerifySignatureMessage vsigMsg = JsonUtils.deserializeSDK <VerifySignatureMessage>(rMessage.payload);
                notifyObserversVerifySignature(vsigMsg);
                break;

            case Methods.REFUND_RESPONSE:
                RefundResponseMessage refRespMsg = JsonUtils.deserializeSDK <RefundResponseMessage>(rMessage.payload);
                notifyObserversRefundPaymentResponse(refRespMsg);
                break;

            case Methods.TIP_ADJUST_RESPONSE:
                TipAdjustResponseMessage tipAdjustMsg = JsonUtils.deserializeSDK <TipAdjustResponseMessage>(rMessage.payload);
                notifyObserversTipAdjusted(tipAdjustMsg);
                break;

            case Methods.REFUND_REQUEST:
                //Outbound no-op
                break;

            case Methods.VAULT_CARD_RESPONSE:
                VaultCardResponseMessage vcrMsg = JsonUtils.deserializeSDK <VaultCardResponseMessage>(rMessage.payload);
                notifyObserversVaultCardResponse(vcrMsg);
                break;

            case Methods.CARD_DATA_RESPONSE:
                ReadCardDataResponseMessage rcdrMsg = JsonUtils.deserializeSDK <ReadCardDataResponseMessage>(rMessage.payload);
                notifyObserversReadCardDataResponse(rcdrMsg);
                break;

            case Methods.CAPTURE_PREAUTH_RESPONSE:
                CapturePreAuthResponseMessage carMsg = JsonUtils.deserializeSDK <CapturePreAuthResponseMessage>(rMessage.payload);
                notifyObserversCapturePreAuthResponse(carMsg);
                break;

            case Methods.CLOSEOUT_RESPONSE:
                CloseoutResponseMessage crMsg = JsonUtils.deserializeSDK <CloseoutResponseMessage>(rMessage.payload);
                notifyObserversCloseoutResponse(crMsg);
                break;

            case Methods.RETRIEVE_PENDING_PAYMENTS_RESPONSE:
                RetrievePendingPaymentsResponseMessage rpprMsg = JsonUtils.deserializeSDK <RetrievePendingPaymentsResponseMessage>(rMessage.payload);
                notifyObserversPendingPaymentsResponse(rpprMsg);
                break;

            case Methods.ACTIVITY_RESPONSE:
                ActivityResponseMessage arm = JsonUtils.deserializeSDK <ActivityResponseMessage>(rMessage.payload);
                notifyObserversActivityResponse(arm);
                break;

            case Methods.ACTIVITY_MESSAGE_FROM_ACTIVITY:
                ActivityMessageFromActivity amfa = JsonUtils.deserializeSDK <ActivityMessageFromActivity>(rMessage.payload);
                notifyObserversActivityMessage(amfa);
                break;

            case Methods.RESET_DEVICE_RESPONSE:
                ResetDeviceResponseMessage rdrm = JsonUtils.deserializeSDK <ResetDeviceResponseMessage>(rMessage.payload);
                notifyObserversDeviceReset(rdrm);
                break;

            case Methods.RETRIEVE_DEVICE_STATUS_RESPONSE:
                RetrieveDeviceStatusResponseMessage rdsrm = JsonUtils.deserializeSDK <RetrieveDeviceStatusResponseMessage>(rMessage.payload);
                notifyObserversRetrieveDeviceStatusResponse(rdsrm);
                break;

            case Methods.DISCOVERY_REQUEST:
                //Outbound no-op
                break;

            case Methods.ORDER_ACTION_ADD_DISCOUNT:
                //Outbound no-op
                break;

            case Methods.ORDER_ACTION_ADD_LINE_ITEM:
                //Outbound no-op
                break;

            case Methods.ORDER_ACTION_REMOVE_LINE_ITEM:
                //Outbound no-op
                break;

            case Methods.ORDER_ACTION_REMOVE_DISCOUNT:
                //Outbound no-op
                break;

            case Methods.PRINT_CREDIT:
                CreditPrintMessage cpm = JsonUtils.deserializeSDK <CreditPrintMessage>(rMessage.payload);
                notifyObserversPrintCredit(cpm);
                break;

            case Methods.PRINT_CREDIT_DECLINE:
                DeclineCreditPrintMessage dcpm = JsonUtils.deserializeSDK <DeclineCreditPrintMessage>(rMessage.payload);
                notifyObserversPrintCreditDecline(dcpm);
                break;

            case Methods.PRINT_PAYMENT:
                PaymentPrintMessage ppm = JsonUtils.deserializeSDK <PaymentPrintMessage>(rMessage.payload);
                notifyObserversPrintPayment(ppm);
                break;

            case Methods.PRINT_PAYMENT_DECLINE:
                DeclinePaymentPrintMessage dppm = JsonUtils.deserializeSDK <DeclinePaymentPrintMessage>(rMessage.payload);
                notifyObserversPrintPaymentDecline(dppm);
                break;

            case Methods.PRINT_PAYMENT_MERCHANT_COPY:
                PaymentPrintMerchantCopyMessage ppmcm = JsonUtils.deserializeSDK <PaymentPrintMerchantCopyMessage>(rMessage.payload);
                notifyObserversPrintMerchantCopy(ppmcm);
                break;

            case Methods.REFUND_PRINT_PAYMENT:
                RefundPaymentPrintMessage rppm = JsonUtils.deserializeSDK <RefundPaymentPrintMessage>(rMessage.payload);
                notifyObserversPrintRefund(rppm);
                break;

            case Methods.RETRIEVE_PAYMENT_RESPONSE:
                RetrievePaymentResponseMessage rprm = JsonUtils.deserializeSDK <RetrievePaymentResponseMessage>(rMessage.payload);
                notifyObserversRetrievePaymentResponse(rprm);
                break;

            case Methods.GET_PRINTERS_RESPONSE:
                RetrievePrintersResponseMessage rtrm = JsonUtils.deserializeSDK <RetrievePrintersResponseMessage>(rMessage.payload);
                notifyObserversRetrievePrinterResponse(rtrm);
                break;

            case Methods.PRINT_JOB_STATUS_RESPONSE:
                PrintJobStatusResponseMessage pjsrm = JsonUtils.deserializeSDK <PrintJobStatusResponseMessage>(rMessage.payload);
                notifyObserversRetrievePrintJobStatus(pjsrm);
                break;

            case Methods.PRINT_IMAGE:
                //Outbound no-op
                break;

            case Methods.PRINT_TEXT:
                //Outbound no-op
                break;

            case Methods.SHOW_ORDER_SCREEN:
                //Outbound no-op
                break;

            case Methods.SHOW_PAYMENT_RECEIPT_OPTIONS:
                //Outbound no-op
                break;

            case Methods.SHOW_REFUND_RECEIPT_OPTIONS:
                //Outbound no-op
                break;

            case Methods.SHOW_CREDIT_RECEIPT_OPTIONS:
                //Outbound no-op
                break;

            case Methods.SHOW_THANK_YOU_SCREEN:
                //Outbound no-op
                break;

            case Methods.SHOW_WELCOME_SCREEN:
                //Outbound no-op
                break;

            case Methods.SIGNATURE_VERIFIED:
                //Outbound no-op
                break;

            case Methods.TERMINAL_MESSAGE:
                //Outbound no-op
                break;

            case Methods.TX_START:
                //Outbound no-op
                break;

            case Methods.VOID_PAYMENT:
                //Outbound no-op
                break;

            case Methods.CLOSEOUT_REQUEST:
                //Outbound no-op
                break;

            case Methods.VAULT_CARD:
                //Outbound no-op
                break;

            case Methods.CARD_DATA:
                //Outbound no-op
                break;
            }
        }