예제 #1
0
        public ChoNACHABatchWriter CreateBatch(int serviceClassCode, string standardEntryClassCode = "PPD", string companyEntryDescription = null,
                                               DateTime?companyDescriptiveDate = null, DateTime?effectiveEntryDate = null, string julianSettlementDate = null,
                                               string companyDiscretionaryData = null, char originatorStatusCode   = '1', string companyName           = null, string companyID = null, string originatingDFIID = null)
        {
            CheckDisposed();

            if (_activeBatch != null && !_activeBatch.IsClosed())
            {
                throw new ChoNACHAException("There is already open batch associated with this writer which must be closed first.");
            }

            //Increment batch count
            _activeBatch = new ChoNACHABatchWriter(_writer, _runningStatObject, Configuration);
            _activeBatch.ServiceClassCode         = serviceClassCode;
            _activeBatch.StandardEntryClassCode   = standardEntryClassCode;
            _activeBatch.CompanyEntryDescription  = companyEntryDescription;
            _activeBatch.CompanyDescriptiveDate   = companyDescriptiveDate;
            _activeBatch.EffectiveEntryDate       = effectiveEntryDate;
            _activeBatch.JulianSettlementDate     = julianSettlementDate;
            _activeBatch.CompanyDiscretionaryData = companyDiscretionaryData;
            _activeBatch.OriginatorStatusCode     = originatorStatusCode;

            _activeBatch.CompanyName      = companyName.IsNullOrEmpty() ? Configuration.OriginatingCompanyName : companyName;
            _activeBatch.CompanyID        = companyID.IsNullOrEmpty() ? Configuration.OriginatingCompanyId : companyID;
            _activeBatch.OriginatingDFIID = originatingDFIID.IsNullOrEmpty() ? Configuration.DestinationBankRoutingNumber.NTrim().First(8) : originatingDFIID.NTrim().First(8);

            return(_activeBatch);
        }
예제 #2
0
        public ChoNACHABatchWriter CreateBatch(int serviceClassCode, string standardEntryClassCode = "PPD", string companyEntryDescription = null,
                                               DateTime?companyDescriptiveDate   = null, DateTime?effectiveEntryDate        = null, string julianSettlementDate = null,
                                               string companyDiscretionaryData   = null, char originatorStatusCode          = '1', string companyName           = null, string companyID = null, string originatingDFIID = null,
                                               string isoOriginatingCurrencyCode = "USD", string isoDestinationCurrencyCode = "USD")
        {
            CheckDisposed();

            var x = _headerInitializer.Value;

            if (_activeBatch != null && !_activeBatch.IsClosed())
            {
                throw new ChoNACHAException("There is already open batch associated with this writer which must be closed first.");
            }

            //Increment batch count
            var batch = new ChoNACHABatchWriter(_writer, _runningStatObject, Configuration);

            batch.ServiceClassCode        = serviceClassCode;
            batch.StandardEntryClassCode  = standardEntryClassCode;
            batch.CompanyEntryDescription = companyEntryDescription;
            if (standardEntryClassCode != null && standardEntryClassCode.ToUpper().Trim() == "IAT")
            {
                batch.CompanyDescriptiveDate = String.Format("{0}{1}", isoOriginatingCurrencyCode, isoDestinationCurrencyCode);
            }
            else
            {
                batch.CompanyDescriptiveDate = companyDescriptiveDate == null?DateTime.Now.Date.ToString("yyMMdd") : companyDescriptiveDate.Value.Date.ToString("yyMMdd");
            }

            batch.EffectiveEntryDate       = effectiveEntryDate;
            batch.JulianSettlementDate     = julianSettlementDate;
            batch.CompanyDiscretionaryData = companyDiscretionaryData;
            batch.OriginatorStatusCode     = originatorStatusCode;

            batch.CompanyName      = companyName.IsNullOrEmpty() ? Configuration.OriginatingCompanyName : companyName;
            batch.CompanyID        = companyID.IsNullOrEmpty() ? Configuration.OriginatingCompanyId : companyID;
            batch.OriginatingDFIID = originatingDFIID.IsNullOrEmpty() ? Configuration.DestinationBankRoutingNumber.NTrim().First(8) : originatingDFIID.NTrim().First(8);

            _activeBatch = batch;

            return(_activeBatch);
        }