Exemplo n.º 1
0
        public static void GetEscrowTransactions(long toFacebookAccountId, long fromFacebookAccountId, EscrowType transactionType, string timeStamp, bool clearTransactions,
                                                 System.Action <XmlDocument> callback)
        {
            mLogger.DebugFormat("GetEscrowTransactions called to={0} from={1} type={2} ts={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, timeStamp);
            WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "GetEscrowTransactions");

            request.AddParam(kToAccountId, toFacebookAccountId.ToString());
            if (fromFacebookAccountId == 0)
            {
                request.AddParam(kFromAccountId, "");
            }
            else
            {
                request.AddParam(kFromAccountId, fromFacebookAccountId.ToString());
            }
            request.AddParam(kTransactionType, transactionType.ToString());
            request.AddParam(kTransactionTimeStamp, timeStamp);
            // Do we want to immediately clear the transactions after getting them?
            if (clearTransactions)
            {
                request.AddParam(kDeleteTransactions, "1");
            }
            else
            {
                request.AddParam(kDeleteTransactions, "0");
            }
            request.GetWebResponseAsync(callback);
        }
Exemplo n.º 2
0
        public static bool IsRoomOwnerFriend(string roomId, UserId userId)
        {
            WebServiceRequest getRoomOwnerRelationship = new WebServiceRequest(_ServicesSiteRoot, "Friends", "IsRoomOwnerFriend");

            if (userId != null)
            {
                getRoomOwnerRelationship.AddParam("userId", userId.Id.ToString());
            }
            getRoomOwnerRelationship.AddParam("roomId", roomId);
            XmlDocument serviceResponse = getRoomOwnerRelationship.GetWebResponse();


            XmlNodeList isRoomOwnerFriendNode = serviceResponse.GetElementsByTagName("isRoomOwnerFriend");

            if (isRoomOwnerFriendNode.Count > 0)
            {
                if (isRoomOwnerFriendNode[0] != null)
                {
                    if (Convert.ToBoolean(isRoomOwnerFriendNode[0].InnerText))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 3
0
        public static void GetGameData(ServerAccount serverAccount, string[] dataKeys, Action <XmlDocument> result)
        {
            if (mMockGetGameData == null)
            {
                string dataKeysCsv = String.Join(",", dataKeys);
                mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.GetMiniGameUserData called accountId={0} dataKeys={1}", serverAccount.AccountId, dataKeysCsv);
                WebServiceRequest setDataService = new WebServiceRequest(mWebServicesBaseUrl, "MiniGames", "GetMiniGameUserData");
                setDataService.Method = FormMethod.POST;
                setDataService.AddParam("accountId", serverAccount.AccountId.ToString());
                setDataService.AddParam("miniGameId", FASHION_MINIGAME_SERVICE_ID.ToString());
                setDataService.AddParam("miniGameName", FASHION_MINIGAME_NAME);

                setDataService.AddParam("dataKeyCSVList", dataKeysCsv);

                setDataService.GetWebResponseAsync(delegate(XmlDocument response)
                {
                    mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.GetMiniGameUserData responded accountId={0} xmlResponse={1}", serverAccount.AccountId, response.OuterXml);
                    result(response);
                });
            }
            else
            {
                mMockGetGameData(serverAccount, dataKeys, result);
            }
        }
Exemplo n.º 4
0
        public static void GetAllSystemRoomsService(System.Action <XmlDocument> getSystemRoomFinishedCallback)
        {
            mLogger.DebugFormat("GetAllSystemRoomsService called");
            WebServiceRequest getSystemRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetSystemRooms");

            getSystemRoomService.AddParam(kIsEnabled, "1");
            getSystemRoomService.GetWebResponseAsync(getSystemRoomFinishedCallback);
        }
Exemplo n.º 5
0
        public static void DisableRoomService(AccountId accountId, RoomId roomId, System.Action <XmlDocument> disableRoomServiceCallback)
        {
            WebServiceRequest disableRoomInDatabaseService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "DisableRoom");

            disableRoomInDatabaseService.AddParam(kRoomId, roomId.ToString());
            disableRoomInDatabaseService.AddParam(kAccountId, accountId.ToString());
            disableRoomInDatabaseService.GetWebResponseAsync(disableRoomServiceCallback);
        }
Exemplo n.º 6
0
        public static void GetSessionOwnedRoomsService(AccountId accountId, System.Action <XmlDocument> getRoomServiceFinishedCallback)
        {
            mLogger.DebugFormat("GetSessionOwnedRoomsService called accountId={0}", accountId);
            WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms");

            getRoomList.AddParam(kAccountId, accountId.ToString());
            getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback);
        }
Exemplo n.º 7
0
        public static void UpdateRoomDnaService(RoomId roomId, XmlDocument roomDna, System.Action <XmlDocument> updateRoomDnaServiceFinishedCallback)
        {
            mLogger.DebugFormat("UpdateRoomDnaService called roomId={0} roomDna={1}", roomId, roomDna.OuterXml);
            WebServiceRequest updateRoomDna = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "UpdateRoomDNA");

            updateRoomDna.AddParam(kRoomId, roomId.ToString());
            updateRoomDna.AddParam(kRoomDna, roomDna.OuterXml);
            updateRoomDna.GetWebResponseAsync(updateRoomDnaServiceFinishedCallback);
        }
Exemplo n.º 8
0
        private void MoneyPaymentsLogService(string timeStamp, string xmlData, Action <XmlDocument> logServiceCallback)
        {
            WebServiceRequest moneyPaymentsLogService = new WebServiceRequest(mWebServicesBaseUrl, "MoneyPaymentsLog", "WritePaymentsLog");

            moneyPaymentsLogService.Method = FormMethod.POST;
            moneyPaymentsLogService.AddParam("key", mKey);
            moneyPaymentsLogService.AddParam("timeStamp", timeStamp);
            moneyPaymentsLogService.AddParam("xmlData", xmlData);
            moneyPaymentsLogService.GetWebResponseAsync(logServiceCallback);
        }
Exemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="getAssetsServiceCallback"></param>
        public static void GetAssetsService(System.Action <XmlDocument> getAssetsServiceCallback)
        {
            mLogger.Info("GetAssetsService called");
            WebServiceRequest getAssetList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, kInventory, kGetAssetList);

            getAssetList.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.Info("GetAssetsService responded");
                getAssetsServiceCallback(xmlResponse);
            });
        }
Exemplo n.º 10
0
        public XmlDocument GetTheUserInformationFromHangoutId(string hangoutUserId, string baseServicesRoot)
        {
            XmlDocument userInformation = null;

            WebServiceRequest request = new WebServiceRequest(baseServicesRoot, "Accounts", "GetAccounts");

            request.AddParam("accountId", hangoutUserId);
            userInformation = request.GetWebResponse();

            return(userInformation);
        }
Exemplo n.º 11
0
        public static void GetRoomService(RoomId roomId, System.Action <XmlDocument> getRoomServiceFinishedCallback)
        {
            mLogger.DebugFormat("GetRoomService called roomId={0}", roomId);
            WebServiceRequest getRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms");

            getRoomService.AddParam(kRoomId, roomId.ToString());
            getRoomService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("GetRoomService responded roomId={0} xmlResponse={1}", roomId, xmlResponse.OuterXml);
                getRoomServiceFinishedCallback(xmlResponse);
            });
        }
Exemplo n.º 12
0
        private void GetApproveDenyWords()
        {
            string webServiceUrl = ConfigurationSettings.AppSettings["WebServicesBaseUrl"];

            if (String.IsNullOrEmpty(webServiceUrl))
            {
                throw new Exception("App/Web config does not contain a definition for 'WebServicesBaseUrl'");
            }
            WebServiceRequest getApproveDenyWordsRequest = new WebServiceRequest(webServiceUrl, "Logging", "GetApproveDenyWordList");

            getApproveDenyWordsRequest.GetWebResponseAsync(ProcessApproveDenyWords);
        }
Exemplo n.º 13
0
        public static void CreateNewRoomService(AccountId accountId, string roomName, PrivacyLevel privacyLevel, System.Action <XmlDocument> createRoomFinishedCallback)
        {
            mLogger.DebugFormat("CreateNewRoomService called accountId={0} roomName={1} privacyLevel={2}", accountId, roomName, privacyLevel);
            WebServiceRequest createRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "CreateRoom");

            createRoomService.Encrypted = true;
            createRoomService.AddParam(kAccountId, accountId.ToString());
            createRoomService.AddParam(kRoomName, roomName);
            createRoomService.AddParam(kPrivacyLevel, ((int)privacyLevel).ToString());
            createRoomService.AddParam(kDefaultRoomId, "1");
            createRoomService.GetWebResponseAsync(createRoomFinishedCallback);
        }
Exemplo n.º 14
0
        public static void GetServerAccountForAccountId(string accountId, Action <XmlDocument> getServerAccountForAccountIdCallback)
        {
            mLogger.DebugFormat("GetServerAccountForAccountId called accountId={0}", accountId);
            WebServiceRequest getServerAccountForAccountIdService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "GetAccounts");

            getServerAccountForAccountIdService.AddParam(ConstStrings.kAccountId, accountId);
            getServerAccountForAccountIdService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("GetServerAccountForAccountId responded accountId={0}", accountId);
                getServerAccountForAccountIdCallback(xmlResponse);
            });
        }
Exemplo n.º 15
0
        public static void GetSessionOwnedRoomsWithPrivacyService(AccountId accountId, PrivacyLevel privacyLevel, System.Action <XmlDocument> getRoomServiceFinishedCallback)
        {
            mLogger.DebugFormat("GetSessionOwnedRoomsWithPrivacyService called accountId={0} privacyLevel={1}", accountId, privacyLevel);
            WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms");

            getRoomList.AddParam(kAccountId, accountId.ToString());
            if (privacyLevel != PrivacyLevel.Default)
            {
                getRoomList.AddParam(kPrivacyLevel, ((uint)privacyLevel).ToString());
            }
            getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback);
        }
Exemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverAccount"></param>
        /// <param name="getAvatarForUserServiceCallback"></param>
        public static void GetAvatarForUser(ServerAccount serverAccount, Action <XmlDocument> getAvatarForUserServiceCallback)
        {
            mLogger.DebugFormat("GetAvatarForUser called accountId={0}", serverAccount.AccountId);
            WebServiceRequest getAvatarList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "GetAvatars");

            getAvatarList.AddParam(kAccountId, serverAccount.AccountId.ToString());
            getAvatarList.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("GetAvatarForUser responded accountId={0}, xmlReponse={1}", serverAccount.AccountId, xmlResponse.OuterXml);
                getAvatarForUserServiceCallback(xmlResponse);
            });
        }
Exemplo n.º 17
0
        public static void GetAllFacebookFriends(long facebookAccountId, string sessionKey, System.Action <XmlDocument> getAllFacebookFriendsServiceCallback)
        {
            mLogger.InfoFormat("GetAllFacebookFriends called fbAccountId={0}", facebookAccountId);
            WebServiceRequest getFacebookFriendsService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Facebook", "GetAllFacebookFriends");

            getFacebookFriendsService.AddParam(kFbAccountId, facebookAccountId.ToString());
            getFacebookFriendsService.AddParam(kSessionKey, sessionKey);
            getFacebookFriendsService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.Info("GetAllFacebookFriends responded");
                getAllFacebookFriendsServiceCallback(xmlResponse);
            });
        }
Exemplo n.º 18
0
        public static void RemoveSession(AccountId accountId, string sessionId, Action <XmlDocument> updateStateServerCallback)
        {
            mLogger.DebugFormat("RemoveSession called accountId={0} sessionId={1}", accountId, sessionId);
            WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "RemoveSession");

            bossService.AddParam("accountId", accountId.ToString());
            bossService.AddParam("sessionId", sessionId);
            bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("RemoveSession responded accountId={0} sessionId={1}", accountId, sessionId);
                updateStateServerCallback(xmlResponse);
            });
        }
Exemplo n.º 19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="avatarId"></param>
        /// <param name="avatarDna"></param>
        /// <param name="updateAvatarDnaServiceFinishedCallback"></param>
        public static void UpdateAvatarDna(AvatarId avatarId, XmlDocument avatarDna, System.Action <XmlDocument> updateAvatarDnaServiceFinishedCallback)
        {
            mLogger.DebugFormat("UpdateAvatarDna called avatarId={0}", avatarId);
            WebServiceRequest updateAvatarDna = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "UpdateAvatarDNA");

            updateAvatarDna.AddParam(kAvatarId, avatarId.ToString());
            updateAvatarDna.AddParam(kAvatarDna, avatarDna.OuterXml);
            updateAvatarDna.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("UpdateAvatarDna responded avatarId={0}", avatarId);
                updateAvatarDnaServiceFinishedCallback(xmlResponse);
            });
        }
Exemplo n.º 20
0
        /// <summary>
        /// Gets all system avatars
        /// </summary>
        /// <param name="getSystemAvatarsCallback"></param>
        public static void GetSystemAvatars(Action <XmlDocument> getSystemAvatarsCallback)
        {
            mLogger.Debug("GetSystemAvatars called");
            // For now we just return all the system avatars to choose from
            WebServiceRequest getAvatarService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "GetSystemAvatars");

            getAvatarService.Method = FormMethod.POST;
            getAvatarService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.Debug("GetAvatarForUser responded");
                getSystemAvatarsCallback(xmlResponse);
            });
        }
Exemplo n.º 21
0
 private void GetTransactionsToNotify(Action <XmlDocument> getTransactionToNotifyCallback)
 {
     try
     {
         WebServiceRequest getTransactionToNotifyService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "MoneyPaymentsLog", "GetTransactionsToNotify");
         getTransactionToNotifyService.AddParam("state", "3");
         getTransactionToNotifyService.GetWebResponseAsync(getTransactionToNotifyCallback);
     }
     catch (Exception ex)
     {
         mLogger.Error(String.Format("Error in GetTransactionsToNotify {0} ", ex));
     }
 }
Exemplo n.º 22
0
        public static void InitStateServer(string ipAddress, string port, Action <XmlDocument> initStateServerCallback)
        {
            mLogger.DebugFormat("InitStateServer called ipAddress={0} port={1}", ipAddress, port);
            WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "InitStateServer");

            bossService.AddParam("stateServerIp", ipAddress);
            bossService.AddParam("port", port);
            bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("InitStateServer responded ipAddress={0} port={1}", ipAddress, port);
                initStateServerCallback(xmlResponse);
            });
        }
Exemplo n.º 23
0
        public static void UpdateAccountData(AccountId accountId, XmlDocument accountDataXml, Action <XmlDocument> updatedAccountDataCallback)
        {
            mLogger.DebugFormat("UpdateAccountData called accountId={0}", accountId);
            WebServiceRequest updateAccountDataService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "UpdateAccountData");

            updateAccountDataService.AddParam(ConstStrings.kAccountId, accountId.ToString());
            updateAccountDataService.AddParam(ConstStrings.kAccountData, accountDataXml.OuterXml);
            updateAccountDataService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("UpdateAccountData responded accountId={0}", accountId);
                updatedAccountDataCallback(xmlResponse);
            });
        }
Exemplo n.º 24
0
        private void SetDefaultRoom(ServerAccount userAccount, RoomId roomId)
        {
            WebServiceRequest setDefaultRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "SetDefaultRoom");

            setDefaultRoomService.AddParam("accountId", userAccount.AccountId.ToString());
            setDefaultRoomService.AddParam("roomId", roomId.ToString());

            Action <XmlDocument> setDefaultRoomServiceCallback = delegate(XmlDocument xmlResponse)
            {
                //TODO: error checking?
            };

            setDefaultRoomService.GetWebResponseAsync(setDefaultRoomServiceCallback);
        }
Exemplo n.º 25
0
        private XmlDocument ProcessCallBack(string xmlInfo, string baseServicesRoot)
        {
            UTF8Encoding encoding = new UTF8Encoding();

            Byte[] byteArray = encoding.GetBytes(xmlInfo);

            WebServiceRequest request = new WebServiceRequest(baseServicesRoot, "PaymentItemsService", "PayPalCallback");

            request.AddParam("xmlInfoBinary", byteArray);

            XmlDocument xmlResponse = request.GetWebResponse();

            return(xmlResponse);
        }
Exemplo n.º 26
0
        public static void UpdateServerPaymentItemsAccount(string accountId, string paymentItemsAccountId, string secureKey, Action <XmlDocument> updatePaymentItemAccountCallback)
        {
            mLogger.InfoFormat("UpdateServerPaymentItemsAccount called accountId={0} PIAccountId={1}", accountId, paymentItemsAccountId);
            WebServiceRequest updatePaymentItemsAccountService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "UpdateAccountWithPaymentItemsInfo");

            updatePaymentItemsAccountService.AddParam(ConstStrings.kAccountId, accountId);
            updatePaymentItemsAccountService.AddParam(ConstStrings.kPaymentItemsAccountId, paymentItemsAccountId);
            updatePaymentItemsAccountService.AddParam(ConstStrings.kPiSecureId, secureKey);
            updatePaymentItemsAccountService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.InfoFormat("UpdateServerPaymentItemsAccount responded accountId={0} PIAccountId={1}", accountId, paymentItemsAccountId);
                updatePaymentItemAccountCallback(xmlResponse);
            });
        }
Exemplo n.º 27
0
        public static void UpdateStateServer(string stateServerId, int population, string isEnabled, Action <XmlDocument> updateStateServerCallback)
        {
            mLogger.DebugFormat("UpdateStateServer called stateServerId={0} population={1} isEnabled={2}", stateServerId, population, isEnabled);
            WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "UpdateStateServer");

            bossService.AddParam("stateServerId", stateServerId);
            bossService.AddParam("population", population.ToString());
            bossService.AddParam("isEnabled", isEnabled);
            bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("UpdateStateServer responded stateServerId={0} population={1} isEnabled={2}", stateServerId, population, isEnabled);
                updateStateServerCallback(xmlResponse);
            });
        }
Exemplo n.º 28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="accountIds"></param>
        /// <param name="getAvatarForUserServiceCallback"></param>
        public static void GetAvatarForUsers(IEnumerable <AccountId> accountIds, Action <XmlDocument> getAvatarForUserServiceCallback)
        {
            string accountIdsString = AccountsXmlUtil.GetCommaSeperatedListOfAccountIdsFromList(accountIds);

            mLogger.DebugFormat("GetAvatarForUsers called accountIds={0}", accountIdsString);

            WebServiceRequest getAvatarList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "GetAvatars");

            getAvatarList.AddParam(kAccountIdCsvList, accountIdsString);
            getAvatarList.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("GetAvatarForUsers responded accountIds={0} xmlReponse={1}", accountIdsString, xmlResponse.OuterXml);
                getAvatarForUserServiceCallback(xmlResponse);
            });
        }
Exemplo n.º 29
0
        public static void CreateEscrowTransaction(long toFacebookAccountId, long fromFacebookAccountId, string transactionType, int value,
                                                   System.Action <XmlDocument> callback)
        {
            mLogger.DebugFormat("CreateEscrowTransaction called to={0} from={1} type={2} value={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, value);
            WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "CreateEscrowTransaction");

            request.AddParam(kToAccountId, toFacebookAccountId.ToString());
            request.AddParam(kFromAccountId, fromFacebookAccountId.ToString());
            request.AddParam(kTransactionType, transactionType);
            request.AddParam(kValue, value.ToString());
            request.GetWebResponseAsync(delegate(XmlDocument xmlResponse)
            {
                mLogger.DebugFormat("CreateEscrowTransaction responded xml={0}", xmlResponse.OuterXml);
                callback(xmlResponse);
            });
        }
Exemplo n.º 30
0
        private XmlDocument ProcessAdminPaymentItem(PaymentCommand paymentCommand, string baseServicesRoot)
        {
            ServiceCommandSerializer serializer = new ServiceCommandSerializer();
            string xmlPaymentItemsMessage       = serializer.SerializeCommandData(paymentCommand, typeof(PaymentCommand));

            UTF8Encoding encoding = new UTF8Encoding();

            Byte[] byteArray = encoding.GetBytes(xmlPaymentItemsMessage);

            WebServiceRequest request = new WebServiceRequest(baseServicesRoot, "PaymentItemsService", "ProcessAdminPaymentItemXml");

            request.AddParam("paymentCommand", byteArray);

            XmlDocument xmlResponse = request.GetWebResponse();

            return(xmlResponse);
        }