Exemple #1
0
        private void RegisterMoneyTransfer(Transaction <MoneyTransferAccepted> transaction, PersonData receiverData, float amount)
        {
            var senderData = RetrieveData(transaction.Content.Transfer.Content.SenderId);

            if (senderData.MaxTransferableAmount < amount)
            {
                var doubtFactor = InvalidTransferDoubtFactor * (1 - senderData.MaxTransferableAmount / amount);
                senderData.Doubt(doubtFactor);
                receiverData.Doubt(doubtFactor);
                return;
            }
            senderData.GetRelation(receiverData.Id).Strengthen();
            receiverData.GetRelation(senderData.Id).Strengthen();
            senderData.AddMoney(new ConfidenceValue(1, -amount), transaction.Id);
            receiverData.AddMoney(new ConfidenceValue(1, amount), transaction.Id);
        }