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); }
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); } }
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); }
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); }
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); }
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); }
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); }
/// <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); }); }
/// <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); }); }
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); }); }
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); }
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); }); }
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); }
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); }
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)); } }
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); }); }
/// <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); }); }
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); }); }
/// <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); }); }
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); }); }
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); }); }
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); }
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); }); }
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); }); }
/// <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); }); }
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); }); }
private void ServicesHealthCheck(Guid sessionId) { System.Action <XmlDocument> servicesHealthCheckCallBack = delegate(XmlDocument xmlResponse) { Message adminMessage = new Message(); List <object> data = new List <object>(); data.Add(xmlResponse.InnerXml); adminMessage.AdminDataMessage(data); adminMessage.Callback = (int)MessageSubType.HealthCheck; SendMessageToClient(adminMessage, sessionId); }; WebServiceRequest healthCheckService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "HealthCheck", "HealthCheck"); healthCheckService.GetWebResponseAsync(servicesHealthCheckCallBack); }
/// <summary> /// the expected output of the returned xml is: /// <Accounts> /// <Account AccountId="1000002" FBAccountId="1520031799" PIAccountId="728" PISecureKey="B3EF252C9CFFC2BEF3A098CF128CB0511C4B923B4062960B41B01AC6440AA82D" NickName="Matt" FirstName="Matt" LastName"Schmeer"> /// </Account> /// </Accounts> /// </summary> public static void CreateServerAccount(string fbAccountId, string fbSessionKey, string nickName, string firstName, string lastName, string campaignId, string referrerId, Action <XmlDocument> createServerAccountCallback) { mLogger.DebugFormat("CreateServerAccount called fbAccountId={0} sessionKey={1} nickname={2} firstname={3} lastname={4}", fbAccountId, fbSessionKey, nickName, firstName, lastName); WebServiceRequest createServerAccountService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "CreateAccountFromFacebook"); createServerAccountService.AddParam(ConstStrings.kFbAccountId, fbAccountId); createServerAccountService.AddParam(ConstStrings.kFbSessionKey, fbSessionKey); createServerAccountService.AddParam(ConstStrings.kNickName, nickName); createServerAccountService.AddParam(ConstStrings.kFirstName, firstName); createServerAccountService.AddParam(ConstStrings.kLastName, lastName); createServerAccountService.AddParam(ConstStrings.kCampaignId, campaignId); createServerAccountService.AddParam(ConstStrings.kReferrerId, referrerId); createServerAccountService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("CreateServerAccount responded fbAccountId={0} sessionKey={1} nickname={2}", fbAccountId, fbSessionKey, nickName); createServerAccountCallback(xmlResponse); }); }
public static void ClearEscrowTransactions(long toFacebookAccountId, long fromFacebookAccountId, string transactionType, string timeStamp, System.Action <XmlDocument> callback) { mLogger.DebugFormat("ClearEscrowTransactions called to={0} from={1} type={2} ts={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, timeStamp); WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "ClearEscrowTransactions"); request.AddParam(kToAccountId, toFacebookAccountId.ToString()); if (fromFacebookAccountId == 0) { request.AddParam(kFromAccountId, ""); } else { request.AddParam(kFromAccountId, fromFacebookAccountId.ToString()); } request.AddParam(kTransactionType, transactionType); request.AddParam(kTransactionTimeStamp, timeStamp); request.GetWebResponseAsync(callback); }
public static void GetSessionOwnedRoomsWithPrivacyService(IList <AccountId> accountIds, PrivacyLevel privacyLevel, System.Action <XmlDocument> getRoomServiceFinishedCallback) { mLogger.DebugFormat("GetSessionOwnedRoomsWithPrivacyService called accountIds={0} privacyLevel={1}", accountIds, privacyLevel); WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms"); AccountId[] accountIdArray = new AccountId[accountIds.Count]; accountIds.CopyTo(accountIdArray, 0); string[] accountIdStringArray = Array.ConvertAll <AccountId, string>(accountIdArray, new Converter <AccountId, string>( delegate(AccountId accountId) { return(accountId.ToString()); } )); string accountIdsCommaSeperatedString = String.Join(",", accountIdStringArray); getRoomList.AddParam(kAccountIdCsvList, accountIdsCommaSeperatedString); if (privacyLevel != PrivacyLevel.Default) { getRoomList.AddParam(kPrivacyLevel, ((uint)privacyLevel).ToString()); } getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback); }