Exemple #1
0
        public XmlRpcResponse currencyNotify(XmlRpcRequest request, IPEndPoint ep)
        {
            XmlRpcResponse r           = new XmlRpcResponse();
            Hashtable      requestData = m_communication.ValidateRequest(request);

            if (requestData != null)
            {
                string method = (string)requestData["method"];
                switch (method)
                {
                case "notifyDeliverObject": r.Value = deliverObject(requestData);
                    break;

                case "notifyOnObjectPaid": r.Value = onObjectPaid(requestData);
                    break;

                case "notifyLandBuy": r.Value = landBuy(requestData);
                    break;

                case "notifyChangePrimPermission": r.Value = changePrimPermissions(requestData);
                    break;

                case "notifyBalanceUpdate": r.Value = balanceUpdate(requestData);
                    break;

                case "notifyGetVersion": r.Value = GetVersion(requestData);
                    break;

                default: m_log.ErrorFormat("[{0}]: Method {1} is not supported", Name, method);
                    break;
                }
            }
            else
            {
                r.SetFault(-1, "Could not validate the request");
            }
            return(r);
        }
Exemple #2
0
        public XmlRpcResponse currencyNotify(XmlRpcRequest request, IPEndPoint ep)
        {
            XmlRpcResponse r = new XmlRpcResponse();

            try
            {
                Hashtable requestData       = (Hashtable)request.Params[0];
                Hashtable communicationData = (Hashtable)request.Params[1];

                #region // Debug
#if DEBUG
                m_log.Debug("[OMECONOMY]: currencyNotify(...)");
                foreach (DictionaryEntry requestDatum in requestData)
                {
                    m_log.Debug("[OMECONOMY]:   " + requestDatum.Key.ToString() + " " + (string)requestDatum.Value);
                }
                foreach (DictionaryEntry communicationDatum in communicationData)
                {
                    m_log.Debug("[OMECONOMY]:   " + communicationDatum.Key.ToString() + " " + (string)communicationDatum.Value);
                }
#endif
                #endregion

                String method = (string)requestData["method"];
                requestData.Remove("method");
                if (CommunicationHelpers.ValidateRequest(communicationData, requestData, gatewayURL))
                {
                    switch (method)
                    {
                    case "notifyDeliverObject": r.Value = deliverObject(requestData);
                        break;

                    case "notifyOnObjectPaid": r.Value = onObjectPaid(requestData);
                        break;

                    case "notifyLandBuy": r.Value = landBuy(requestData);
                        break;

                    case "notifyChangePrimPermission": r.Value = changePrimPermissions(requestData);
                        break;

                    case "notifyBalanceUpdate": r.Value = balanceUpdate(requestData);
                        break;

                    case "notifyGetVersion": r.Value = GetVersion(requestData);
                        break;

                    default: m_log.ErrorFormat("[OMECONOMY]: Method {1} is not supported", Name, method);
                        break;
                    }
                }
                else
                {
                    throw new Exception("Hash values do not match");
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[OMECONOMY]: genericNotify() Exception: {1} - {2}", Name, e.Message, e.StackTrace);
                r.SetFault(1, "Could not parse the requested method");
            }
            return(r);
        }