Ejemplo n.º 1
0
        public void Test()
        {
            const string data    = "C140626EUR12062,29";
            var          balance = new TransactionBalance(data, _fr);

            var currency = new Currency("EUR");

            Assert.That(balance.Balance, Is.EqualTo(new Money("12062,29", currency, _fr)));
        }
Ejemplo n.º 2
0
        public void Credit_100_Eur_On_20_06_2011_Test()
        {
            const string data    = "C110620EUR100";
            var          balance = new TransactionBalance(data, _fr);

            var currency = new Currency("EUR");

            Assert.AreEqual(new Money("100", currency, _fr), balance.Balance);
            Assert.AreEqual(new Money("100", currency, _fr).Value, balance.Balance.Value);
            Assert.AreEqual(new DateTime(2011, 06, 20), balance.EntryDate);
            Assert.AreEqual(currency, balance.Currency);
            Assert.AreEqual(DebitCredit.Credit, balance.DebitCredit);
        }
Ejemplo n.º 3
0
        private static IEnumerable FlattenThenMap(ICollection <CustomerStatementMessage> statements)
        {
            var flattened = from statement in statements
                            from transaction in statement.Transactions
                            select new { statement, transaction };
            var mapped = flattened.Select(item =>
            {
                var statement   = item.statement;
                var transaction = item.transaction;
                TransactionBalance closingAvailableBalance = statement.ClosingAvailableBalance;
                TransactionBalance closingBalance          = statement.ClosingBalance;
                TransactionBalance forwardAvailableBalance = statement.ForwardAvailableBalance;
                TransactionBalance openingBalance          = statement.OpeningBalance;
                TransactionDetails transactionDetails      = transaction.Details;
                var transactionDescription = transaction.Description.Replace(Environment.NewLine, "");
                AbnAmroTransactionDescription abnAmroTransactionDescription = new AbnAmroTransactionDescription(transactionDescription);
                var entry = new
                {
                    // Statement:
                    Account = statement.Account,
                    ClosingAvailableBalance = closingAvailableBalance,
                    CAB_Balance             = closingAvailableBalance?.Balance?.Value,
                    CAB_Currency            = closingAvailableBalance?.Currency?.Code,
                    CAB_DebitCredit         = closingAvailableBalance?.DebitCredit,
                    CAB_EntryDate           = closingAvailableBalance?.EntryDate.ToIso8601DateOnly(),
                    ClosingBalance          = closingBalance,
                    CB_Balance              = closingBalance?.Balance?.Value,
                    CB_Currency             = closingBalance?.Currency?.Code,
                    CB_DebitCredit          = closingBalance?.DebitCredit,
                    CB_EntryDate            = closingBalance?.EntryDate.ToIso8601DateOnly(),
                    StatementDescription    = statement.Description,
                    ForwardAvailableBalance = statement.ForwardAvailableBalance,
                    FAB_Balance             = forwardAvailableBalance?.Balance?.Value,
                    FAB_Currency            = forwardAvailableBalance?.Currency?.Code,
                    FAB_DebitCredit         = forwardAvailableBalance?.DebitCredit,
                    FAB_EntryDate           = forwardAvailableBalance?.EntryDate.ToIso8601DateOnly(),
                    OpeningBalance          = statement.OpeningBalance,
                    OB_Balance              = openingBalance?.Balance?.Value,
                    OB_Currency             = openingBalance?.Currency?.Code,
                    OB_DebitCredit          = openingBalance?.DebitCredit,
                    OB_EntryDate            = openingBalance?.EntryDate.ToIso8601DateOnly(),
                    RelatedMessage          = statement.RelatedMessage,
                    SequenceNumber          = statement.SequenceNumber,
                    StatementNumber         = statement.StatementNumber,
                    TransactionReference    = statement.TransactionReference,
                    // Transaction:
                    AccountServicingReference = transaction.AccountServicingReference,
                    Amount                 = transaction.Amount,
                    Currency               = transaction.Amount.Currency,
                    Value                  = transaction.Amount.Value,
                    DebitCredit            = transaction.DebitCredit,
                    TransactionDescription = transactionDescription,
                    AATD_BetalingsKenmerk  = abnAmroTransactionDescription.BetalingsKenmerk,
                    AATD_Bic               = abnAmroTransactionDescription.Bic,
                    AATD_Iban              = abnAmroTransactionDescription.Iban,
                    AATD_Incassant         = abnAmroTransactionDescription.Incassant,
                    AATD_Kenmerk           = abnAmroTransactionDescription.Kenmerk,
                    AATD_Machtiging        = abnAmroTransactionDescription.Machtiging,
                    AATD_Naam              = abnAmroTransactionDescription.Naam,
                    AATD_Nr                = abnAmroTransactionDescription.Nr,
                    AATD_TransactionType   = abnAmroTransactionDescription.TransactionType,
                    TransactionDetails     = transactionDetails,
                    TD_Account             = transactionDetails.Account,
                    TD_Description         = transactionDetails.Description,
                    TD_Name                = transactionDetails.Name,
                    EntryDate              = transaction.EntryDate?.ToIso8601DateOnly(),
                    FundsCode              = transaction.FundsCode,
                    Reference              = transaction.Reference,
                    SupplementaryDetails   = transaction.SupplementaryDetails,
                    TransactionType        = transaction.TransactionType,
                    TransactionValue       = transaction.Value,
                    ValueDate              = transaction.ValueDate.ToIso8601DateOnly(),

                    /*
                     *  Statement:
                     *
                     * public string Account { get; }
                     * public TransactionBalance ClosingAvailableBalance { get; }
                     * public TransactionBalance ClosingBalance { get; }
                     * public string Description { get; }
                     * public TransactionBalance ForwardAvailableBalance { get; }
                     * public TransactionBalance OpeningBalance { get; }
                     * public string RelatedMessage { get; }
                     * public int SequenceNumber { get; }
                     * public int StatementNumber { get; }
                     * public string TransactionReference { get; }
                     * public ICollection<Transaction> Transactions { get; }
                     *
                     * TransactionBalance:
                     *
                     * public Money Balance { get; }
                     * public Currency Currency { get; }
                     * public DebitCredit DebitCredit { get; }
                     * public DateTime EntryDate { get; }
                     *
                     * Money:
                     *
                     * public Currency Currency { get; }
                     * public decimal Value { get; }
                     *
                     * Transaction:
                     *
                     * public string AccountServicingReference { get; }
                     * public Money Amount { get; }
                     * public DebitCredit DebitCredit { get; }
                     * public string Description { get; set; }
                     * public TransactionDetails Details { get; set; }
                     * public DateTime? EntryDate { get; }
                     * public string FundsCode { get; set; }
                     * public string Reference { get; }
                     * public string SupplementaryDetails { get; }
                     * public string TransactionType { get; }
                     * public string Value { get; set; }
                     * public DateTime ValueDate { get; }
                     *
                     * TransactionDetails:
                     *
                     * public string Account { get; set; }
                     * public string Description { get; set; }
                     * public string Name { get; set; }
                     *
                     */
                };
                return(entry);
            });

            return(mapped);
        }