Beispiel #1
0
        public static ExternalBankDataProfile FromIdentity(int externalBankDataProfileId)
        {
            ExternalBankDataProfile result = new ExternalBankDataProfile();

            // Ugly hack for now

            if (externalBankDataProfileId == SESebId)
            {
                result.Name    = "SEB";
                result.Country = Country.FromCode("SE");
                result.Culture = "sv-SE";

                result.FieldNames[ExternalBankDataFieldName.Date]           = "Bokföringsdatum";
                result.FieldNames[ExternalBankDataFieldName.Description]    = "Text/mottagare";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Belopp";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo";
                result.FieldNames[ExternalBankDataFieldName.NotUniqueId]    = "Verifikationsnummer";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Unknown; // no inline fees
                result.Precision  = ExternalBankDateTimePrecision.Day;

                result.BankDataAccountReader  = StockBankDataReaders.TabSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = StockBankDataReaders.SEPaymentsBankgiroReader;

                return(result);
            }

            if (externalBankDataProfileId == PaypalId)
            {
                result.Name    = "Paypal";
                result.Country = null;
                result.Culture = "sv-SE"; // what the actual f**k? Paypal's giving me sv-SE culture in export file

                result.FieldNames[ExternalBankDataFieldName.Date]             = "Date";
                result.FieldNames[ExternalBankDataFieldName.Time]             = "Time";
                result.FieldNames[ExternalBankDataFieldName.TimeZone]         = "Time Zone";
                result.FieldNames[ExternalBankDataFieldName.Description]      = "Name";
                result.FieldNames[ExternalBankDataFieldName.Currency]         = "Currency";
                result.FieldNames[ExternalBankDataFieldName.TransactionGross] = "Gross";
                result.FieldNames[ExternalBankDataFieldName.TransactionFee]   = "Fee";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet]   = "Net";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance]   = "Balance";
                result.FieldNames[ExternalBankDataFieldName.UniqueId]         = "Transaction ID";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Negative;
                result.Precision  = ExternalBankDateTimePrecision.Second;

                result.BankDataAccountReader  = StockBankDataReaders.TabSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = null; // No aggregated payments with Paypal

                return(result);
            }

            throw new ArgumentException("Unrecognized profile Id");
        }
        static public ExternalBankDataProfile FromIdentity (int externalBankDataProfileId)
        {
            ExternalBankDataProfile result = new ExternalBankDataProfile();

            // Ugly hack for now

            if (externalBankDataProfileId == SESebId)
            {
                result.Name = "SEB";
                result.Country = Country.FromCode("SE");
                result.Culture = "sv-SE";

                result.FieldNames[ExternalBankDataFieldName.Date] = "Bokföringsdatum";
                result.FieldNames[ExternalBankDataFieldName.Description] = "Text/mottagare";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Belopp";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo";
                result.FieldNames[ExternalBankDataFieldName.NotUniqueId] = "Verifikationsnummer";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Unknown; // no inline fees
                result.Precision = ExternalBankDateTimePrecision.Day;

                result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = StockBankDataReaders.SEPaymentsBankgiroReader;

                return result;
            }

            if (externalBankDataProfileId == PaypalId)
            {
                result.Name = "Paypal";
                result.Country = null;
                result.Culture = "sv-SE"; // what the actual f**k? Paypal's giving me sv-SE culture in export file

                result.FieldNames[ExternalBankDataFieldName.Date] = "Date";
                result.FieldNames[ExternalBankDataFieldName.Time] = "Time";
                result.FieldNames[ExternalBankDataFieldName.TimeZone] = "Time Zone";
                result.FieldNames[ExternalBankDataFieldName.Description] = "Name";
                result.FieldNames[ExternalBankDataFieldName.Currency] = "Currency";
                result.FieldNames[ExternalBankDataFieldName.TransactionGross] = "Gross";
                result.FieldNames[ExternalBankDataFieldName.TransactionFee] = "Fee";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Net";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Balance";
                result.FieldNames[ExternalBankDataFieldName.UniqueId] = "Transaction ID";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Negative;
                result.Precision = ExternalBankDateTimePrecision.Second;

                result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = null; // No aggregated payments with Paypal

                return result;
            }

            throw new ArgumentException("Unrecognized profile Id");
        }
        public static ExternalBankDataProfile FromIdentity(int externalBankDataProfileId)
        {
            ExternalBankDataProfile result = new ExternalBankDataProfile();

            result.ExternalBankDataProfileId = externalBankDataProfileId;

            // Ugly hack for now

            if (externalBankDataProfileId == SESebId)
            {
                result.Name    = "SEB";
                result.Country = Country.FromCode("SE");
                result.Culture = "sv-SE";

                result.FieldNames[ExternalBankDataFieldName.Date] = "Bokföringsdatum";
                result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Text/mottagare";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet]     = "Belopp";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance]     = "Saldo";
                result.FieldNames[ExternalBankDataFieldName.NotUniqueId]        = "Verifikationsnummer";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Unknown; // no inline fees
                result.Precision  = ExternalBankDateTimePrecision.Day;

                result.BankDataAccountReader  = StockBankDataReaders.CommaSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = StockBankDataReaders.SEPaymentsBankgiroReader;

                return(result);
            }

            if (externalBankDataProfileId == PaypalId)
            {
                result.Name    = "Paypal";
                result.Country = null;
                result.Culture = "sv-SE"; // what the actual f**k? Paypal's giving me sv-SE culture in export file

                result.FieldNames[ExternalBankDataFieldName.Date]               = "Date";
                result.FieldNames[ExternalBankDataFieldName.Time]               = "Time";
                result.FieldNames[ExternalBankDataFieldName.TimeZone]           = "Time Zone";
                result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Name";
                result.FieldNames[ExternalBankDataFieldName.Currency]           = "Currency";
                result.FieldNames[ExternalBankDataFieldName.TransactionGross]   = "Gross";
                result.FieldNames[ExternalBankDataFieldName.TransactionFee]     = "Fee";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet]     = "Net";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance]     = "Balance";
                result.FieldNames[ExternalBankDataFieldName.UniqueId]           = "Transaction ID";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Negative;
                result.Precision  = ExternalBankDateTimePrecision.Second;

                result.BankDataAccountReader  = StockBankDataReaders.CommaSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = null; // No aggregated payments with Paypal

                return(result);
            }

            if (externalBankDataProfileId == DEPostbankId)
            {
                result.Name                = "DE Postbank";
                result.Country             = Country.FromCode("DE");
                result.Culture             = "de-DE";
                result.IgnoreInitialLines  = 8; // increased by one in Postbank-DE "new" interface 2019
                result.InitialReplacements = ";|\t| €||Referenz NOTPROVIDED Verwendungszweck|";

                result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungsdatum";
                result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary]   = "Buchungsdetails";
                result.FieldNames[ExternalBankDataFieldName.DescriptionSecondary] = "Umsatzart";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet]       = "Betrag (€)";
                result.FieldNames[ExternalBankDataFieldName.AccountBalance]       = "Saldo (€)";

                result.LatestTransactionLocation = LatestTransactionLocation.Top;
                result.FeeSignage = FeeSignage.Unknown; // no inline fees
                result.Precision  = ExternalBankDateTimePrecision.Day;

                result.BankDataAccountReader  = StockBankDataReaders.CommaSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = null; // No aggregated payments with Postbank

                result.FieldDelimiter = ';';          // DE Postbank uses semicolon as delimiter for no reason in particular

                return(result);
            }

            if (externalBankDataProfileId == CZFioId)
            {
                // Czech Fio Bank

                result.Name     = "CZ Fio";
                result.Country  = Country.FromCode("CZ");
                result.Culture  = "cs-CZ";
                result.Encoding = "UTF-8";

                result.InitialReplacements = ";|\t|Kč|";                     // before CSV helper is implemented, replace field separators with tabs; remove currency symbols

                result.FieldNames[ExternalBankDataFieldName.Date] = "Datum"; // in dd.mm.yyyy format
                result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Zpráva pro příjemce";
                result.FieldNames[ExternalBankDataFieldName.CounterpartyName]   = "Název protiúčtu";
                //result.FieldNames[ExternalBankDataFieldName.CounterpartyAccount] = "Protiúčet";
                //result.FieldNames[ExternalBankDataFieldName.CounterpartyBank] = "Kód banky";
                result.FieldNames[ExternalBankDataFieldName.DescriptionSecondary] = "Typ";
                result.FieldNames[ExternalBankDataFieldName.TransactionNet]       = "Objem";   // has comma as radix
                result.FieldNames[ExternalBankDataFieldName.Currency]             = "Měna";    // must be czk
                result.FieldNames[ExternalBankDataFieldName.AccountBalance]       = "Balance"; // not originally in file, must be manually added

                result.LatestTransactionLocation = LatestTransactionLocation.Bottom;
                result.FeeSignage = FeeSignage.Unknown; // no inline fees
                result.Precision  = ExternalBankDateTimePrecision.Day;
                result.DateTimeCustomFormatString = "dd.MM.yyyy";

                result.BankDataAccountReader  = StockBankDataReaders.CommaSeparatedValuesAccountReader;
                result.BankDataPaymentsReader = null; // No aggregated payments with Postbank

                result.FieldDelimiter = ';';          // CZ Fio uses semicolon as delimiter for no reason in particular

                return(result);
            }

            throw new ArgumentException("Unrecognized profile Id");
        }