public VoucherInformation[] ReadScannedBatch(GenerateBatchBulkCreditRequest request, string jobIdentifier, DateTime processingDate) { Guard.IsNotNull(jobIdentifier, "jobIdentifier"); List <VoucherInformation> vouchers = new List <VoucherInformation>(); Log.Debug("Reading from scanned batch jobId: {@jobIdentifier}, processingDate: {@processingDate}", jobIdentifier, processingDate); try { var jobImageDirectory = GetJobDirectory(jobIdentifier); foreach (VoucherGroupCriteria vg in request.vouchers) { string fileSearch = string.Format("VOUCHER_{0}_{1}_*.json", vg.processingDate.ToString("ddMMyyyy"), vg.documentReferenceNumber); Log.Information("Searching for JSON files {@fileSearch} in job directory {@jobImageDirectory}", fileSearch, jobImageDirectory); var metadataFiles = fileSystem.Directory.EnumerateFiles(jobImageDirectory, fileSearch); foreach (var metadataFile in metadataFiles) { vouchers.Add(ReadFromJsonFile <VoucherInformation>(metadataFile)); } } Log.Information("Read {0} files for job '{@jobIdentifier}'", vouchers.Count, jobIdentifier); return(vouchers.ToArray()); } catch (Exception ex) { Log.Error(ex, "Could not read data from JSON files for job '{@jobIdentifier}'", jobIdentifier); throw; } }
public static void Publish(GenerateBatchBulkCreditRequest request, string jobIdentifier, string routingKey) { Requests.Add(request); Task.WaitAll(RequestExchange.PublishAsync(request, jobIdentifier, routingKey)); }
private void InitializeTestData() { sampleGenerateBatchBulkCreditRequest = new GenerateBatchBulkCreditRequest { jobIdentifier = "NECL-47887b18-e731-4839-b77a-d48c00003328/NGBC-04d91de6-5051-4a17-ab70-b296bb1c4cc4", maxDebitVouchers = 10, vouchers = new VoucherGroupCriteria[] { new VoucherGroupCriteria { captureBsb = "085384", documentReferenceNumber = "895214001", processingDate = Convert.ToDateTime("2015/10/20") }, new VoucherGroupCriteria { captureBsb = "085385", documentReferenceNumber = "895214003", processingDate = Convert.ToDateTime("2015/10/20") } } }; sampleDipsQueue = new DipsQueue { ResponseCompleted = false, S_LOCATION = "CodelineCorrection", S_LOCK = "0", S_SDATE = "01/01/15", S_STIME = "12:12:12", S_BATCH = "58300013" }; sampleDipsNabChqs = new List <DipsNabChq> { new DipsNabChq { amount = "45.67", acc_num = "256902729", bsb_num = "013812", batch = "58300013", doc_ref_num = "583000026", ser_num = "001193", trancode = "50", tpcRequired = "Y", tpcResult = "F", fxa_unencoded_ECD_return = "1", tpcMixedDepRet = "1", fxa_tpc_suspense_pool_flag = "1", highValueFlag = "1" }, new DipsNabChq { amount = "2341.45", acc_num = "814649", bsb_num = "092002", batch = "58300013", doc_ref_num = "583000027", ser_num = "001193", trancode = "50", tpcRequired = "Y", tpcResult = "F", fxa_unencoded_ECD_return = "1", tpcMixedDepRet = "1", fxa_tpc_suspense_pool_flag = "1", highValueFlag = "1" } }; sampleDipsDbIndexes = new List <DipsDbIndex> { new DipsDbIndex { BATCH = "58300013", TRACE = "583000026" }, new DipsDbIndex { BATCH = "58300013", TRACE = "583000027" } }; sampleVoucherInformation = new VoucherInformation[] { new VoucherInformation() { voucherBatch = new VoucherBatch() { scannedBatchNumber = string.Empty } }, new VoucherInformation() { voucherBatch = new VoucherBatch() { scannedBatchNumber = string.Empty } } }; }