示例#1
0
文件: Hbci.cs 项目: sidiandi/sammy
        IList <Statement> DownloadStatement()
        {
            log.DebugFormat("Download {0}", AccountId);
            FinContact       contact = FinContactFolder.Default.FindContact(AccountId);
            List <Statement> s       = new List <Statement>();

            foreach (FinAcctInfo aAcctInfo in contact.UPD)
            {
                try
                {
                    FinAcct acct = aAcctInfo.Acct;
                    log.DebugFormat("Downloading account {0}/{1}", acct.BankCode, acct.AcctNo);
                    FinService service = new FinService(contact, acct.BankCode, acct.AcctNo, acct.Currency);
                    service.LogOn(Password);
                    FinAcctMvmtsSpecifiedPeriod aAcctMvmts = service.DownloadStatement(SwiftDate.NullDate);
                    service.LogOff();

                    if (aAcctMvmts != null)
                    {
                        s.Add(ToStatement(acct, aAcctMvmts.BookedTrans));
                    }
                }
                catch (Exception e)
                {
                    log.Error("Error while downloading " + AccountId, e);
                }
            }
            return(s);
        }
示例#2
0
        protected override ResponseData OnGetResponseData(FinService service, FinOrder order)
        {
            FinAcctMvmtsSpecifiedPeriod aAcctMvmts = order as FinAcctMvmtsSpecifiedPeriod;

            if (aAcctMvmts == null)
            {
                return(null);
            }

            switch (m_nFormat)
            {
            case OutputFormat.CSV:
                return(new ResponseData {
                    Formatted = _GetCsvResponseData(aAcctMvmts)
                });

            case OutputFormat.MT940:
                return(new ResponseData {
                    Formatted = _GetMT940ResponseData(aAcctMvmts)
                });

            case OutputFormat.MT942:
                return(new ResponseData {
                    Formatted = _GetMT942ResponseData(aAcctMvmts)
                });

            case OutputFormat.CSV942:
                return(new ResponseData {
                    Formatted = _GetCsv942ResponseData(aAcctMvmts)
                });

            default:
                return(null);
            }
        }
示例#3
0
        protected override ResponseData OnGetResponseData(FinService service, FinOrder order)
        {
            FinAcctMvmtsSpecifiedPeriod aAcctMvmts = order as FinAcctMvmtsSpecifiedPeriod;

            if (aAcctMvmts == null)
            {
                return(null);
            }

            return(_GetResponseData(aAcctMvmts));
        }
示例#4
0
        private string _GetMT942ResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            FinByteBuffer aBufMT942 = aAcctMvmts.NonbookedTransBuffer;

            if (aBufMT942 == null)
            {
                return(null);
            }

            return(Encoding.GetEncoding(1252).GetString(
                       aBufMT942.Bytes, aBufMT942.Offset, aBufMT942.Length));
        }
示例#5
0
        private string _GetCsv942ResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT942 = aAcctMvmts.NonbookedTrans;

            if (aMT942 == null)
            {
                return(null);
            }

            SwiftInterimTransRept aStmt = SwiftInterimTransRept.ReadMT942(aMT942, true);

            if (aStmt == null)
            {
                return(null);
            }

            return(_GetCsvStatementData(aStmt));
        }
示例#6
0
        private string _GetCsvResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT940 = aAcctMvmts.BookedTrans;

            if (aMT940 == null)
            {
                return(null);
            }

            SwiftStatement aStmt = SwiftStatement.ReadMT940(aMT940, true);

            if (aStmt == null)
            {
                return(null);
            }

            return(_GetCsvStatementData(aStmt));
        }
示例#7
0
        private ResponseData _GetResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT940 = aAcctMvmts.BookedTrans;

            if (aMT940 == null)
            {
                return(null);
            }

            SwiftStatement aStmt = SwiftStatement.ReadMT940(aMT940, true);

            if (aStmt == null)
            {
                return(null);
            }

            return(new ResponseData
            {
                Transactions = GetTransactions(aStmt)
            });
        }
        private string _GetMT942ResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            FinByteBuffer aBufMT942 = aAcctMvmts.NonbookedTransBuffer;
            if (aBufMT942 == null)
            {
                return null;
            }

            return Encoding.GetEncoding(1252).GetString(
                aBufMT942.Bytes, aBufMT942.Offset, aBufMT942.Length);
        }
        private string _GetCsvResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT940 = aAcctMvmts.BookedTrans;
            if (aMT940 == null)
            {
                return null;
            }

            SwiftStatement aStmt = SwiftStatement.ReadMT940(aMT940, true);
            if (aStmt == null)
            {
                return null;
            }

            return _GetCsvStatementData(aStmt);
        }
        private string _GetCsv942ResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT942 = aAcctMvmts.NonbookedTrans;
            if (aMT942 == null)
            {
                return null;
            }

            SwiftInterimTransRept aStmt = SwiftInterimTransRept.ReadMT942(aMT942, true);
            if (aStmt == null)
            {
                return null;
            }

            return _GetCsvStatementData(aStmt);
        }
        private ResponseData _GetResponseData(FinAcctMvmtsSpecifiedPeriod aAcctMvmts)
        {
            SwiftStatementReader aMT940 = aAcctMvmts.BookedTrans;
            if (aMT940 == null)
            {
                return null;
            }

            SwiftStatement aStmt = SwiftStatement.ReadMT940(aMT940, true);
            if (aStmt == null)
            {
                return null;
            }

            return new ResponseData
                       {
                           Transactions = GetTransactions(aStmt)
                       };
        }