Exemple #1
0
 public string GetSource(YodleeTransactionLevel transaction)
 {
     if (transaction.description.simple == null)
     {
         return(transaction.description.original);
     }
     else
     {
         return(transaction.description.simple);
     }
 }
Exemple #2
0
 public int GetCFClassificationSign(YodleeTransactionLevel transaction, List <CFClassification> classifications)
 {
     if (transaction.baseType == "DEBIT")
     {
         return(classifications.Where(x => x.Name == "Expense").Select(x => x.Sign).FirstOrDefault());
     }
     else
     {
         return(classifications.Where(x => x.Name == "Income").Select(x => x.Sign).FirstOrDefault());
     }
 }
Exemple #3
0
        public AutomateReturn AddTransaction(YodleeTransactionLevel transaction, string accId, List <CFType> types, ManualCashFlow manual, List <CFClassification> classifications, Account account)
        {
            AutomateReturn automateReturn = new AutomateReturn();

            automateReturn.AutomatedCashFlow = new AutomatedCashFlow()
            {
                ID                 = Guid.NewGuid().ToString(),
                AccountId          = accId,
                Amount             = transaction.amount.amount,
                CFClassificationId = GetCFClassification(transaction, classifications),
                CFTypeId           = types.Where(x => x.YodleeId == transaction.categoryId).Select(x => x.Id).FirstOrDefault(),
                DateBooked         = transaction.transactionDate,
                DateCaptured       = transaction.createdDate,
                SourceOfExpense    = GetSource(transaction),
                YodleeId           = transaction.id
            };
            if (automateReturn.AutomatedCashFlow.DateBooked == DateTime.MinValue)
            {
                automateReturn.AutomatedCashFlow.DateBooked = automateReturn.AutomatedCashFlow.DateCaptured;
            }

            if (manual != null)
            {
                automateReturn.ManualCashFlow = manual;
                automateReturn.ManualCashFlow.AutomatedCashFlowId = automateReturn.AutomatedCashFlow.ID;
                automateReturn.AutomatedCashFlow.CFTypeId         = manual.CFTypeId;
                automateReturn.AccountChange = new AccountChange()
                {
                    AccountChangeId = ""
                };
                automateReturn.AutomatedCashFlow.Validated = true;
            }
            else
            {
                AccountChange change = new AccountChange();
                automateReturn.AccountChange  = change.AddAccountChange(automateReturn.AutomatedCashFlow, account, GetCFClassificationSign(transaction, classifications));
                automateReturn.ManualCashFlow = new ManualCashFlow()
                {
                    Id = ""
                };
                automateReturn.AutomatedCashFlow.Validated = false;
            }
            return(automateReturn);
        }