Example #1
0
        public bool Settle(decimal price, Resources quota, DateTime now, TransactionReason reason)
        {
            var returnValue = Subject.Settle(price, quota, LastSettled, now, reason);

            LastSettled = now;
            return(returnValue);
        }
Example #2
0
        private static void AddAdjustmentChild(Transaction parent, Transactions availableTransactions, decimal amount
                                               , TransactionReason transactionReason, string adjustmentTag)
        {
            ImportInfo matcherImportInfo;

            if (availableTransactions.HasImportInfo(ImportInfoId))
            {
                matcherImportInfo = availableTransactions.GetImportInfo(ImportInfoId);
            }
            else
            {
                matcherImportInfo = new ImportInfo(ImportInfoId, ImportInfoId, null, null, ImportInfoId, null);   //TODO: how can we accomodate manufatured import?
            }
            AccountInfo accountInfo = availableTransactions.GetAccountInfo(parent.AccountId);

            if (amount != 0)
            {
                var tx = new Transaction(matcherImportInfo.Id, accountInfo,
                                         new Transaction.ImportedValues()
                {
                    Amount               = amount,
                    EntityName           = "{0} - {1}".FormatEx(adjustmentTag, parent.EntityName),
                    EntityNameNormalized = "{0} - {1}".FormatEx(adjustmentTag, parent.EntityName),
                    InstituteReference   = "{0}.{1}".FormatEx(adjustmentTag, parent.InstituteReference),
                    RequiresParent       = true,
                    SubAccountName       = parent.SubAccountName,
                    TransactionDate      = parent.TransactionDate,
                    TransactionReason    = transactionReason,
                    LineNumber           = null
                });
                availableTransactions.AddNew(tx, accountInfo, matcherImportInfo, false);

                availableTransactions.RelateParentChild(parent.Id, tx.Id);
            }
        }
Example #3
0
        private void OnTransactionReasonAdd(object sender, TransactionReason e)
        {
            _manager.AddReason(e);

            (this.View as Form).Close();

            GlobalSettings.Instance.TransactionReasons = _manager.GetReasons();
        }
Example #4
0
 public UserTransaction(Guid id, DateTime time, decimal amount, TransactionReason reason, User?payer, User receiver)
 {
     Id       = id;
     Time     = time;
     Amount   = amount;
     Reason   = reason;
     Payer    = payer;
     Receiver = receiver;
 }
Example #5
0
        private TransactionReason CreateReason()
        {
            TransactionReason r = new TransactionReason
            {
                ShortDesctiption = ShortDescriptionTextBox.Text,
                LongDesctiption  = LongDescriptionTextBox.Text
            };

            return(r);
        }
Example #6
0
        public bool TrySettle(BillingCycleEntry entry, TransactionReason reason)
        {
            // if the entry is a social project, use its resources instead of quota
            var quota = entry.Subject.Project != null && entry.Subject.Project.Domain.Id == Shared.Constants.SocialDomainId
                ? entry.Subject.Project.Resources
                : entry.Quota;

            // if the entry is a UserProjectAssignment, the price should always to zero
            var price = entry.SubjectType == SubjectType.UserProjectAssignment
                ? 0
                : CalculatePrice(quota);

            return(entry.Settle(price, quota, DateTime.UtcNow, reason));
        }
Example #7
0
        private void AddTransaction(AccountId accountId, double amount, TransactionReason reason, DateTimeOffset occurred)
        {
            var account = _collection.Find(_ => _.Id == accountId).SingleOrDefault();

            if (account != null)
            {
                account.Transactions.Add(new Transaction
                {
                    Amount   = amount,
                    Reason   = reason,
                    Occurred = occurred
                });
                _collection.ReplaceOne(_ => _.Id == accountId, account);
            }
        }
Example #8
0
        private void AddToTotalByReason(TransactionReason transactionReason, decimal amount)
        {
            var current = this.totalsByReason.GetValueOrDefault(transactionReason);

            this.totalsByReason[transactionReason] = current + amount;
        }
Example #9
0
 bool IBillingCycleSubject.Settle(decimal price, Resources quota, DateTime lastSettled, DateTime now, TransactionReason reason)
 {
     return(BillingCycleSubject.Settle(price, quota, lastSettled, now, reason));
 }
Example #10
0
 public OrgTransaction Receive(IPayer from, User fromUser, decimal amount, TransactionReason reason, DateTime time)
 {
     return(Receiver.Receive(from, fromUser, amount, reason, time));
 }
Example #11
0
 public OrgTransaction Pay(IReceiver receiver, decimal amount, TransactionReason reason, DateTime time)
 {
     return(Payer.Pay(receiver, amount, reason, time));
 }
 public bool RecordTransaction(long CustomerID, float Amount, TransactionType Type, TransactionReason Reason)
 {
     return false;
 }
Example #13
0
 public void AddReason(TransactionReason r)
 {
     _repo.AddReason(r);
 }
Example #14
0
 public Task <bool> AboutTransactionAsync(TransactionReason reason, string email, Transactions transaction) =>
 _notifyAboutTransaction[reason].Invoke(email, transaction);