Skip to content

Commit 51dff37

Browse files
Merge pull request #37 from TransactionProcessing/task/supportskippingcontracts
Add to file job as well
2 parents 8ee6e20 + 0374006 commit 51dff37

File tree

1 file changed

+9
-1
lines changed
  • TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.Jobs/GenerateFileUploads

1 file changed

+9
-1
lines changed

TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.Jobs/GenerateFileUploads/GenerateFileUploadsJob.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ public async Task Execute(IJobExecutionContext context)
8080

8181
Guid estateId = context.MergedJobDataMap.GetGuidValueFromString("EstateId");
8282
Guid merchantId = context.MergedJobDataMap.GetGuidValueFromString("MerchantId");
83+
String contractsToSkip = context.MergedJobDataMap.GetString("contractsToSkip");
8384

8485
this.SecurityServiceClient = this.Bootstrapper.GetService<ISecurityServiceClient>();
8586
this.EstateClient = this.Bootstrapper.GetService<IEstateClient>();
8687
this.baseAddressFunc = this.Bootstrapper.GetService<Func<String, String>>();
8788

88-
await this.GenerateFileUploads(estateId, merchantId, context.CancellationToken);
89+
await this.GenerateFileUploads(estateId, merchantId,contractsToSkip, context.CancellationToken);
8990
}
9091

9192
/// <summary>
@@ -96,6 +97,7 @@ public async Task Execute(IJobExecutionContext context)
9697
/// <param name="cancellationToken">The cancellation token.</param>
9798
private async Task GenerateFileUploads(Guid estateId,
9899
Guid merchantId,
100+
String contractsToSkip,
99101
CancellationToken cancellationToken)
100102
{
101103
DateTime fileDate = DateTime.Now;
@@ -112,6 +114,12 @@ private async Task GenerateFileUploads(Guid estateId,
112114

113115
List<ContractResponse> contracts = await this.EstateClient.GetMerchantContracts(accessToken, merchant.EstateId, merchant.MerchantId, cancellationToken);
114116

117+
if (String.IsNullOrEmpty(contractsToSkip) == false)
118+
{
119+
String[] skipContracts = contractsToSkip.Split('|');
120+
contracts = contracts.Where(c => skipContracts.Contains(c.Description) == false).ToList();
121+
}
122+
115123
EstateResponse estate = await this.EstateClient.GetEstate(accessToken, merchant.EstateId, cancellationToken);
116124

117125
SecurityUserResponse estateUser = estate.SecurityUsers.FirstOrDefault();

0 commit comments

Comments
 (0)