/Aurora/Framework/Modules/IMoneyModule.cs
C# | 144 lines | 88 code | 20 blank | 36 comment | 0 complexity | 55baba7dedb5c904eb044f0ba6c7b453 MD5 | raw file
1/* 2 * Copyright (c) Contributors, http://aurora-sim.org/, http://opensimulator.org/ 3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * * Neither the name of the Aurora-Sim Project nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28using System; 29using System.Collections.Generic; 30using Aurora.Framework.PresenceInfo; 31using OpenMetaverse; 32 33namespace Aurora.Framework.Modules 34{ 35 //public delegate void ObjectPaid(UUID objectID, UUID agentID, int amount); 36 // For legacy money module. Fumi.Iseki 37 public delegate bool ObjectPaid(UUID objectID, UUID agentID, int amount); 38 39 // For DTL money module. 40 public delegate bool PostObjectPaid(uint localID, ulong regionHandle, UUID agentID, int amount); 41 42 public enum TransactionType 43 { 44 SystemGenerated = 0, 45 GroupCreate = 1002, 46 UploadFee = 1101, 47 AuctionFee = 1102, 48 ClassifiedFee = 1103, 49 DirectoryFee = 2003, 50 ClassifiedRenewFee = 2005, 51 Inventory = 3000, 52 ObjectBuy = 5000, 53 Gift = 5001, 54 LandSale = 5002, 55 LandPassFee = 5006, 56 PayIntoObject = 5008, 57 ObjectPaysAvatar = 5009, 58 GroupLiability = 6003, 59 GroupDividend = 6004, 60 StipendPayment = 10000 61 } 62 63 public class GroupBalance : IDataTransferable 64 { 65 public int TotalTierDebit = 0; 66 public int TotalTierCredits = 0; 67 public int ParcelDirectoryFee = 0; 68 public int LandFee = 0; 69 public int ObjectFee = 0; 70 public int GroupFee = 0; 71 public DateTime StartingDate; 72 73 public override void FromOSD(OpenMetaverse.StructuredData.OSDMap map) 74 { 75 TotalTierDebit = map["TotalTierDebit"]; 76 TotalTierCredits = map["TotalTierCredits"]; 77 ParcelDirectoryFee = map["ParcelDirectoryFee"]; 78 LandFee = map["LandFee"]; 79 ObjectFee = map["ObjectFee"]; 80 GroupFee = map["GroupFee"]; 81 StartingDate = map["StartingDate"]; 82 } 83 84 public override OpenMetaverse.StructuredData.OSDMap ToOSD() 85 { 86 OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); 87 88 map["TotalTierDebit"] = TotalTierDebit; 89 map["TotalTierCredits"] = TotalTierCredits; 90 map["ParcelDirectoryFee"] = ParcelDirectoryFee; 91 map["LandFee"] = LandFee; 92 map["ObjectFee"] = ObjectFee; 93 map["GroupFee"] = GroupFee; 94 map["StartingDate"] = StartingDate; 95 96 return map; 97 } 98 } 99 100 public interface IMoneyModule 101 { 102 int UploadCharge { get; } 103 int GroupCreationCharge { get; } 104 int ClientPort { get; } 105 106 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 107 int amount); 108 109 int Balance(UUID agentID); 110 bool Charge(IClientAPI client, int amount); 111 bool Charge(UUID agentID, int amount, string text); 112 113 event ObjectPaid OnObjectPaid; 114 event PostObjectPaid OnPostObjectPaid; 115 116 bool Transfer(UUID toID, UUID fromID, int amount, string description); 117 bool Transfer(UUID toID, UUID fromID, int amount, string description, TransactionType type); 118 119 bool Transfer(UUID toID, UUID fromID, UUID toObjectID, UUID fromObjectID, int amount, string description, 120 TransactionType type); 121 122 /// <summary> 123 /// Get a list of transactions that have occured over the given interval (0 is this period of interval days, positive #s go back previous sets) 124 /// </summary> 125 /// <param name="groupID"></param> 126 /// <param name="agentID">Requesting agentID (must be checked whether they can call this)</param> 127 /// <param name="currentInterval"></param> 128 /// <param name="intervalDays"></param> 129 List<GroupAccountHistory> GetTransactions(UUID groupID, UUID agentID, int currentInterval, int intervalDays); 130 131 GroupBalance GetGroupBalance(UUID groupID); 132 } 133 134 public delegate void UserDidNotPay(UUID agentID, string paymentTextThatFailed); 135 136 public delegate bool CheckWhetherUserShouldPay(UUID agentID, string paymentTextThatFailed); 137 138 public interface IScheduledMoneyModule 139 { 140 event UserDidNotPay OnUserDidNotPay; 141 event CheckWhetherUserShouldPay OnCheckWhetherUserShouldPay; 142 bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge); 143 } 144}