public ISerializedAccount Serialize(SerializeMethod method,
                                            string[] accountFields)
        {
            var account = new SerializedAccount();

            if (Number.Length <= 8)
            {
                account.Number = Number.PadLeft(8, '0');
            }
            if (Number.Length == 9)
            {
                account.Number = Number.Substring(1, 8);
            }
            if (Number.Length == 10 && Bank == DirectDebitAlbany.Bank.Natwest)
            {
                account.Number = Number.Substring(2, 8);
            }
            if (Number.Length == 10 && Bank == DirectDebitAlbany.Bank.Coop)
            {
                account.Number = Number.Substring(0, 8);
            }

            account.SortCode = SortCode;
            account.Name     = Name.Format(method, 18);

            account.Line = Sugar.ComposeLine <SerializedAccount>(
                method, accountFields, account);

            return(account);
        }
Beispiel #2
0
        public ISerializedRecord Serialize(SerializeMethod method, string[] accountFields,
                                           string[] recordFields)
        {
            var record = new SerializedRecord();

            record.TransCode = BankValidation.TransCode[this.TransCode];
            record.Amount    = Amount.Format(method, 11, 2);

            record.Reference = Reference.Format(method, 18);

            record.Originator  = Originator.Serialize(method, accountFields);
            record.Destination = Destination.Serialize(method, accountFields);

            record.Line = Sugar.ComposeLine <SerializedRecord>(method, recordFields, record);

            return(record);
        }