Exemple #1
0
        public void BBANIBANPaymentType(DanishFormatFieldBase _field, CreditorTransPayment tran)
        {
            var field = _field as BECFormatFields;

            var countryId = string.Empty;
            var iban      = string.Empty;
            var swift     = string.Empty;
            var bban      = string.Empty;
            var regNum    = string.Empty;

            field.SwiftAddress = string.Empty;
            field.CountryCode  = string.Empty;

            if (tran._PaymentMethod == PaymentTypes.IBAN)
            {
                iban = tran.PaymentId ?? string.Empty;
                if (iban != string.Empty)
                {
                    iban      = iban.ToUpper();
                    countryId = iban.Substring(0, 2);
                }
                field.ToAccountNumber = string.Empty;
            }
            else
            {
                bban   = tran.PaymentId ?? string.Empty;
                bban   = Regex.Replace(bban, "[^0-9]", "");
                regNum = bban.Substring(0, 4);
                bban   = bban.Remove(0, 4);
                bban   = bban.PadLeft(10, '0');
                field.ToAccountNumber = string.Format("{0}{1}", regNum, bban);
            }

            swift = tran._SWIFT ?? string.Empty;
            if (swift != string.Empty)
            {
                swift = Regex.Replace(swift, "[^\\w\\d]", "");
                swift = swift.ToUpper();
                if (swift.Length >= 6)
                {
                    countryId = countryId == string.Empty ? swift.Substring(4, 2) : countryId;
                }
            }


            if (tran._PaymentMethod == PaymentTypes.VendorBankAccount && countryId != string.Empty && countryId != BaseDocument.COUNTRY_DK)
            {
                field.TransTypeCommand = BECPayFormat.TRANSTYPE_ERH400;

                bban = tran.PaymentId ?? string.Empty;
                bban = Regex.Replace(bban, "[^0-9]", "");
                field.ToAccountNumber = bban;
                field.PaymentId       = swift;
            }


            field.SwiftAddress = swift;
            field.ReceiverIBAN = iban;
            field.CountryCode  = countryId;
        }
Exemple #2
0
        public void BBANIBANPaymentType(DanishFormatFieldBase _field, CreditorTransPayment tran)
        {
            var field = _field as DanskBankFormatFields;

            var countryId = string.Empty;
            var iban      = string.Empty;
            var swift     = string.Empty;
            var bban      = string.Empty;

            field.SwiftAddress = string.Empty;
            field.CountryCode  = string.Empty;

            if (tran._PaymentMethod == PaymentTypes.IBAN)
            {
                iban = tran.PaymentId ?? string.Empty;
                if (iban != string.Empty)
                {
                    iban      = Regex.Replace(iban, "[^\\w\\d]", "");
                    iban      = iban.ToUpper();
                    countryId = iban.Substring(0, 2);
                }
            }
            else
            {
                bban = tran.PaymentId ?? string.Empty;
                bban = Regex.Replace(bban, "[^0-9]", "");
                string regNum = bban.Substring(0, 4);
                bban = bban.Remove(0, 4);
                bban = bban.PadLeft(10, '0');
                bban = string.Format("{0}{1}", regNum, bban);
            }

            swift = tran._SWIFT ?? string.Empty;
            if (swift != string.Empty)
            {
                swift     = Regex.Replace(swift, "[^\\w\\d]", "");
                swift     = swift.ToUpper();
                countryId = countryId == string.Empty ? swift.Substring(4, 2) : countryId;
            }

            field.SwiftAddress    = swift;
            field.ReceiverIBAN    = iban;
            field.ToAccountNumber = bban;
            field.CountryCode     = countryId;
        }
        public void DomesticPaymentType(DanishFormatFieldBase _field, CreditorTransPayment tran)
        {
            var field = _field as BankDataFormatFields;

            field.SwiftAddress = string.Empty;
            field.CountryCode  = string.Empty;

            field.FormType = "Vendor Bank Account";

            var bban = tran.PaymentId ?? string.Empty;

            bban = Regex.Replace(bban, "[^0-9]", "");
            string regNum = bban.Substring(0, 4);

            bban = bban.Remove(0, 4);
            bban = bban.PadLeft(10, '0');

            field.ToAccountRegNr  = NETSNorge.processString(regNum, 4, false);
            field.ToAccountNumber = NETSNorge.processString(bban, 10, false);
        }
        public void SharedForeignReceiverBankInfo(DanishFormatFieldBase field, CreditorTransPayment tran)
        {
            var countryId = string.Empty;
            var iban      = string.Empty;
            var bban      = string.Empty;

            if (tran._PaymentMethod == PaymentTypes.IBAN)
            {
                field.FormType = "IBAN";
                iban           = tran.PaymentId ?? string.Empty;
                if (iban != string.Empty)
                {
                    iban      = Regex.Replace(iban, "[^\\w\\d]", "");
                    iban      = iban.ToUpper();
                    countryId = iban.Substring(0, 2);
                }
            }
            else
            {
                field.FormType = "Vendor Bank Account";
                bban           = tran.PaymentId ?? string.Empty;
                bban           = Regex.Replace(bban, "[^0-9]", "");
            }

            var swift = tran._SWIFT ?? string.Empty;

            if (swift != string.Empty)
            {
                swift = Regex.Replace(swift, "[^\\w\\d]", "");
                swift = swift.ToUpper();
                if (swift.Length > 6)
                {
                    countryId = countryId == string.Empty ? swift.Substring(4, 2) : countryId;
                }
            }

            field.SwiftAddress    = swift;
            field.ReceiverIBAN    = iban;
            field.ToAccountNumber = bban;
            field.CountryCode     = countryId;
        }
        public void SharedFIKPayment(DanishFormatFieldBase field, CreditorTransPayment tran)
        {
            var ocrLine = tran.PaymentId;

            ocrLine = ocrLine.Replace(" ", "");
            ocrLine = ocrLine.Replace("+71<", "");
            ocrLine = ocrLine.Replace(">71<", "");
            ocrLine = ocrLine.Replace("+73<", "");
            ocrLine = ocrLine.Replace(">73<", "");
            ocrLine = ocrLine.Replace("+75<", "");
            ocrLine = ocrLine.Replace(">75<", "");
            ocrLine = ocrLine.Replace("+04<", "");
            ocrLine = ocrLine.Replace(">04<", "");
            ocrLine = ocrLine.Replace("<", "");
            ocrLine = ocrLine.Replace(">", "");

            var paymID          = string.Empty;
            var creditorAccount = string.Empty;

            if (tran._PaymentMethod == PaymentTypes.PaymentMethod4) //FIK73
            {
                ocrLine         = ocrLine.Replace("+", "");
                creditorAccount = ocrLine;
            }
            else
            {
                int index = ocrLine.IndexOf("+");
                if (index > 0)
                {
                    paymID          = ocrLine.Substring(0, index);
                    creditorAccount = ocrLine.Remove(0, index + 1);
                }
            }

            switch (tran._PaymentMethod)
            {
            case PaymentTypes.PaymentMethod3:
                field.FormType = BankFormatBase.FIK71;
                if (paymID.Length > BaseDocument.FIK71LENGTH)
                {
                    paymID = paymID.Substring(paymID.Length - BaseDocument.FIK71LENGTH, BaseDocument.FIK71LENGTH);
                }
                else
                {
                    paymID = paymID.PadLeft(BaseDocument.FIK71LENGTH, '0');
                }
                break;

            case PaymentTypes.PaymentMethod4:
                field.FormType = BankFormatBase.FIK73;

                break;

            case PaymentTypes.PaymentMethod5:
                field.FormType = BankFormatBase.FIK75;
                if (paymID.Length > BaseDocument.FIK75LENGTH)
                {
                    paymID = paymID.Substring(paymID.Length - BaseDocument.FIK75LENGTH, BaseDocument.FIK75LENGTH);
                }
                else
                {
                    paymID = paymID.PadLeft(BaseDocument.FIK75LENGTH, '0');
                }
                break;

            case PaymentTypes.PaymentMethod6:
                field.FormType = BankFormatBase.FIK04;
                if (paymID.Length > BaseDocument.FIK04LENGTH)
                {
                    paymID = paymID.Substring(paymID.Length - BaseDocument.FIK04LENGTH, BaseDocument.FIK04LENGTH);
                }
                else
                {
                    paymID = paymID.PadLeft(BaseDocument.FIK04LENGTH, '0');
                }
                break;
            }

            field.PaymentId       = paymID;
            field.ToAccountNumber = creditorAccount;
        }
        public void SharedCodeForCreateBankFormatFields(Company company, CreditorTransPayment tran, CreditorPaymentFormat paymentFormat, BankStatement bankAccount, DanishFormatFieldBase danishFields)
        {
            danishFields.TransferDate = tran.PaymentDate;
            danishFields.Currency     = tran.Trans._Currency != 0 ? (Currencies)tran.Trans._Currency : company._CurrencyId;

            var regNum = bankAccount._BankAccountPart1 ?? string.Empty;
            var bban   = bankAccount._BankAccountPart2 ?? string.Empty;

            regNum = Regex.Replace(regNum, "[^0-9]", "");
            bban   = Regex.Replace(bban, "[^0-9]", "");
            bban   = bban.PadLeft(10, '0');

            danishFields.FromAccountNumber = string.Format("{0}{1}", regNum, bban);
        }