Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static async Task GenerateMerchantStatements(ITransactionDataGenerator t,
List<String> results = new List<String>();
foreach (MerchantResponse merchantResponse in merchants)
{
Boolean success = await t.GenerateMerchantStatement(merchantResponse.EstateId, merchantResponse.MerchantId, DateTime.Now.Date, cancellationToken);
Boolean success = await t.GenerateMerchantStatement(merchantResponse.EstateId, merchantResponse.MerchantId, DateTime.Now, cancellationToken);
if (success == false){
results.Add(merchantResponse.MerchantName);
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public static async Task GenerateTransactions(ITransactionDataGenerator t, Guid
throw new JobExecutionException($"Error getting Merchant Id [{merchantId}] for Estate Id [{estateId}]");
}

DateTime transactionDate = DateTime.Now.Date;
DateTime transactionDate = DateTime.Now;

// Get the merchants contracts
List<ContractResponse> contracts = await t.GetMerchantContracts(merchant, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private static async Task GenerateTransactions(ITransactionDataGenerator g, Guid
foreach (ContractResponse contract in contracts)
{
// Generate and send some sales
await g.SendSales(dateTime, merchant, contract, cancellationToken);
await g.SendSales(dateTime, merchant, contract, 0, cancellationToken);

await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface ITransactionDataGenerator{
Task<List<MerchantResponse>> GetMerchants(Guid estateId, CancellationToken cancellationToken);
Task<Boolean> PerformMerchantLogon(DateTime dateTime, MerchantResponse merchant, CancellationToken cancellationToken);
Task<Boolean> PerformSettlement(DateTime dateTime, Guid estateId, CancellationToken cancellationToken);
Task<Boolean> SendSales(DateTime dateTime, MerchantResponse merchant, ContractResponse contract, CancellationToken cancellationToken);
Task<Boolean> SendSales(DateTime dateTime, MerchantResponse merchant, ContractResponse contract, Int32 numberOfSales, CancellationToken cancellationToken);
Task<Boolean> SendUploadFile(DateTime dateTime, ContractResponse contract, MerchantResponse merchant, CancellationToken cancellationToken);
Task<MerchantResponse> GetMerchant(Guid estateId, Guid merchantId, CancellationToken cancellationToken);
Task<Boolean> GenerateMerchantStatement(Guid estateId, Guid merchantId, DateTime statementDateTime, CancellationToken cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public async Task<Boolean> PerformSettlement(DateTime dateTime, Guid estateId, C
}
}

public async Task<Boolean> SendSales(DateTime dateTime, MerchantResponse merchant, ContractResponse contract, CancellationToken cancellationToken){
public async Task<Boolean> SendSales(DateTime dateTime, MerchantResponse merchant, ContractResponse contract, Int32 numberOfSales, CancellationToken cancellationToken){
List<SaleTransactionRequest> salesToSend = new List<SaleTransactionRequest>();

Decimal depositAmount = 0;
Expand All @@ -254,7 +254,9 @@ public async Task<Boolean> SendSales(DateTime dateTime, MerchantResponse merchan

List<(SaleTransactionRequest request, Decimal amount)> saleRequests = null;
// Get a number of sales to be sent
Int32 numberOfSales = this.r.Next(5, 15);
if (numberOfSales == 0){
numberOfSales = this.r.Next(5, 15);
}
for (Int32 i = 1; i <= numberOfSales; i++){
ProductType productType = this.GetProductType(contract.OperatorName);

Expand Down