Exemple #1
0
        private static FinContact GetContactByArguments(StringDictionary arguments)
        {
            string commAddress  = arguments["-commaddress"];
            string fintsVersion = arguments["-fintsversion"];
            string tanProcedure = arguments["-tanprocedure"];
            string tanMediaName = arguments["-tanmedianame"];
            string bankCode     = arguments["-bankcode"];
            string userId       = arguments["-userid"];
            string custId       = arguments["-custid"];

            if (commAddress == null || bankCode == null || userId == null)
            {
                throw new ArgumentException("Bankkontakt nicht vollständig spezifiziert!");
            }

            int finTsVersion = fintsVersion != null?Int32.Parse(fintsVersion) : 300;

            FinContact contact = new FinContact(commAddress, finTsVersion, tanProcedure, bankCode, userId);

            if (tanMediaName != null)
            {
                contact.TanMediaName = tanMediaName;
            }

            if (custId != null)
            {
                contact.DefaultCustID = custId;
            }

            return(contact);
        }
Exemple #2
0
        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);
        }
        private static FinContact GetContactByArguments(StringDictionary arguments)
        {
            string commAddress = arguments["-commaddress"];
            string fintsVersion = arguments["-fintsversion"];
            string tanProcedure = arguments["-tanprocedure"];
            string tanMediaName = arguments["-tanmedianame"];
            string bankCode = arguments["-bankcode"];
            string userId = arguments["-userid"];
            string custId = arguments["-custid"];

            if (commAddress == null || bankCode == null || userId == null)
            {
                throw new ArgumentException("Bankkontakt nicht vollständig spezifiziert!");
            }

            int finTsVersion = fintsVersion != null ? Int32.Parse(fintsVersion) : 300;

            FinContact contact = new FinContact(commAddress, finTsVersion, tanProcedure, bankCode, userId);

            if (tanMediaName != null)
            {
                contact.TanMediaName = tanMediaName;
            }

            if (custId != null)
            {
                contact.DefaultCustID = custId;
            }

            return contact;
        }
Exemple #4
0
        private static FinContact GetContactByName(string contactName)
        {
            FinContact contact = FinContactFolder.Default.FindContact(contactName);

            if (contact == null)
            {
                throw new ArgumentException(String.Format("Bankkontakt {0} nicht gefunden!", contactName));
            }
            return(contact);
        }
 private static FinContact GetContactByFile(string contactFile)
 {
     if (!File.Exists(contactFile))
     {
         throw new ArgumentException(String.Format("Datei {0} nicht gefunden!", contactFile));
     }
     FinContact contact = new FinContact();
     contact.Load(contactFile);
     return contact;
 }
Exemple #6
0
        private static FinContact GetContactByFile(string contactFile)
        {
            if (!File.Exists(contactFile))
            {
                throw new ArgumentException(String.Format("Datei {0} nicht gefunden!", contactFile));
            }
            FinContact contact = new FinContact();

            contact.Load(contactFile);
            return(contact);
        }
        public static FinService GetFinService(FinContact contact, FinDialog dialog, StringDictionary arguments)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            string acctBankCode = arguments[Arguments.AcctBankCode] ?? contact.BankCode;

            if (acctBankCode == null)
            {
                throw new ArgumentException("Bankleitzahl zu Konto fehlt!");
            }

            if (acctBankCode.Length != 8 || !FinUtil.IsDigits(acctBankCode))
            {
                throw new ArgumentException("Bankleitzahl zu Konto ist ungültig!");
            }

            string acctNo = arguments[Arguments.AcctNo];

            if (acctNo == null)
            {
                throw new ArgumentException("Kontonummer fehlt!");
            }

            if (acctNo == "" || acctNo.Length > 30)
            {
                throw new ArgumentException("Kontonummer ist ungültig!");
            }

            string acctCurrency = arguments["-acctcurrency"];

            if (acctCurrency == null)
            {
                acctCurrency = "EUR";
            }
            else if (acctCurrency.Length != 3 || !FinUtil.IsUpperAscii(acctCurrency))
            {
                throw new ArgumentException("Kontowährung ist ungültig!");
            }

            // Die Bankverbindung ist jetzt vollständig spezifiziert und wir können ein
            // FinService Objekt dafür anlegen.
            FinService aService = dialog != null ?
                                  new FinService(dialog, acctBankCode, acctNo, acctCurrency) :
                                  new FinService(contact, acctBankCode, acctNo, acctCurrency);

            return(aService);
        }
        public static FinService GetFinService(FinContact contact, FinDialog dialog, StringDictionary arguments)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            string acctBankCode = arguments[Arguments.AcctBankCode] ?? contact.BankCode;
            if (acctBankCode == null)
            {
                throw new ArgumentException("Bankleitzahl zu Konto fehlt!");
            }

            if (acctBankCode.Length != 8 || !FinUtil.IsDigits(acctBankCode))
            {
                throw new ArgumentException("Bankleitzahl zu Konto ist ungültig!");
            }

            string acctNo = arguments[Arguments.AcctNo];
            if (acctNo == null)
            {
                throw new ArgumentException("Kontonummer fehlt!");
            }

            if (acctNo == "" || acctNo.Length > 30)
            {
                throw new ArgumentException("Kontonummer ist ungültig!");
            }

            string acctCurrency = arguments["-acctcurrency"];
            if (acctCurrency == null)
            {
                acctCurrency = "EUR";
            }
            else if (acctCurrency.Length != 3 || !FinUtil.IsUpperAscii(acctCurrency))
            {
                throw new ArgumentException("Kontowährung ist ungültig!");
            }

            // Die Bankverbindung ist jetzt vollständig spezifiziert und wir können ein
            // FinService Objekt dafür anlegen.
            FinService aService = dialog != null ?
                new FinService(dialog, acctBankCode, acctNo, acctCurrency) :
                new FinService(contact, acctBankCode, acctNo, acctCurrency);

            return aService;
        }