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 @@ -87,12 +87,13 @@ public async Task Execute(IJobExecutionContext context)
Guid estateId = context.MergedJobDataMap.GetGuidValueFromString("EstateId");
Guid merchantId = context.MergedJobDataMap.GetGuidValueFromString("MerchantId");
Boolean requireLogon = context.MergedJobDataMap.GetBooleanValueFromString("requireLogon");
String contractsToSkip = context.MergedJobDataMap.GetString("contractsToSkip");

this.SecurityServiceClient = this.Bootstrapper.GetService<ISecurityServiceClient>();
this.TransactionProcessorClient = this.Bootstrapper.GetService<ITransactionProcessorClient>();
this.EstateClient = this.Bootstrapper.GetService<IEstateClient>();

await this.GenerateTransactions(estateId, merchantId, requireLogon, context.CancellationToken);
await this.GenerateTransactions(estateId, merchantId, requireLogon, contractsToSkip, context.CancellationToken);
}
catch(Exception e)
{
Expand All @@ -111,10 +112,16 @@ public async Task Execute(IJobExecutionContext context)
private async Task<List<SaleTransactionRequest>> CreateSaleRequests(String accessToken,
MerchantResponse merchant,
DateTime dateTime,
String contractsToSkip,
CancellationToken cancellationToken)
{
List<ContractResponse> contracts = await this.EstateClient.GetMerchantContracts(accessToken, merchant.EstateId, merchant.MerchantId, cancellationToken);

if (String.IsNullOrEmpty(contractsToSkip) == false) {
String[] skipContracts = contractsToSkip.Split('|');
contracts = contracts.Where(c => skipContracts.Contains(c.Description) == false).ToList();
}

List<SaleTransactionRequest> saleRequests = new List<SaleTransactionRequest>();

Random r = new Random();
Expand Down Expand Up @@ -264,6 +271,7 @@ private async Task DoSaleTransaction(String accessToken,
private async Task GenerateTransactions(Guid estateId,
Guid merchantId,
Boolean requiresLogon,
String contractsToSkip,
CancellationToken cancellationToken)
{
DateTime transactionDate = DateTime.Now;
Expand All @@ -285,7 +293,7 @@ private async Task GenerateTransactions(Guid estateId,
}

// Now generate some sales
List<SaleTransactionRequest> saleRequests = await this.CreateSaleRequests(accessToken, merchant, transactionDate, cancellationToken);
List<SaleTransactionRequest> saleRequests = await this.CreateSaleRequests(accessToken, merchant, transactionDate, contractsToSkip, cancellationToken);

// Work out how much of a deposit the merchant needs (minus 1 sale)
IEnumerable<Dictionary<String, String>> metadata = saleRequests.Select(s => s.AdditionalTransactionMetadata);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EstateManagement.Client" Version="1.0.18" />
<PackageReference Include="EstateManagement.Client" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Quartz" Version="3.3.3" />
<PackageReference Include="SecurityService.Client" Version="1.0.9" />
<PackageReference Include="TransactionProcessor.Client" Version="1.0.17" />
<PackageReference Include="SecurityService.Client" Version="1.1.1" />
<PackageReference Include="TransactionProcessor.Client" Version="1.1.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace TransactionProcessing.SchedulerService
using Quartz;
using Quartz.Impl;
using SilkierQuartz;
using ConfigurationManager = System.Configuration.ConfigurationManager;

/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,7 +10,7 @@
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.3.3" />
<PackageReference Include="Quartz.Plugins.TimeZoneConverter" Version="3.3.3" />
<PackageReference Include="Quartz.Serialization.Json" Version="3.3.3" />
<PackageReference Include="Shared" Version="1.1.0" />
<PackageReference Include="Shared" Version="1.3.8" />
<PackageReference Include="SilkierQuartz" Version="5.0.309" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion TransactionProcessor.SystemSetupTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static async Task Main(string[] args)
Program.ProjectionClient = new EventStoreProjectionManagementClient(settings);
Program.PersistentSubscriptionsClient = new EventStorePersistentSubscriptionsClient(settings);

//await Program.SetupIdentityServerFromConfig();
await Program.SetupIdentityServerFromConfig();

// Setup latest projections
await DeployProjections();
Expand Down
12 changes: 6 additions & 6 deletions TransactionProcessor.SystemSetupTool/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"AppSettings": {
// Local (Docker)
//"EstateManagementUri": "http://127.0.0.1:5000",
//"SecurityServiceUri": "https://127.0.0.1:5001",
//"EventStoreAddress": "esdb://admin:changeit@127.0.0.1:4113?tls=false&tlsVerifyCert=false"
"EstateManagementUri": "http://127.0.0.1:5000",
"SecurityServiceUri": "https://127.0.0.1:5001",
"EventStoreAddress": "esdb://admin:changeit@127.0.0.1:4113?tls=false&tlsVerifyCert=false"

// Staging
"EstateManagementUri": "http://192.168.0.133:5000",
"SecurityServiceUri": "https://192.168.0.133:5001",
"EventStoreAddress": "esdb://admin:changeit@192.168.0.133:2113?tls=false&tlsVerifyCert=false"
//"EstateManagementUri": "http://192.168.0.133:5000",
//"SecurityServiceUri": "https://192.168.0.133:5001",
//"EventStoreAddress": "esdb://admin:changeit@192.168.0.133:2113?tls=false&tlsVerifyCert=false"
}
}
39 changes: 34 additions & 5 deletions TransactionProcessor.SystemSetupTool/setupconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
},
"operators": [
"Safaricom",
"Voucher"
"Voucher",
"PataPawa PostPay"
],
"user": {
"email_address": "merchantuser@testmerchant2.co.uk",
Expand Down Expand Up @@ -79,7 +80,8 @@
},
"operators": [
"Safaricom",
"Voucher"
"Voucher",
"PataPawa PostPay"
],
"user": {
"email_address": "merchantuser@testmerchant3.co.uk",
Expand Down Expand Up @@ -107,7 +109,8 @@
},
"operators": [
"Safaricom",
"Voucher"
"Voucher",
"PataPawa PostPay"
],
"user": {
"email_address": "merchantuser@v28emulatormerchant.co.uk",
Expand Down Expand Up @@ -135,7 +138,8 @@
},
"operators": [
"Safaricom",
"Voucher"
"Voucher",
"PataPawa PostPay"
],
"user": {
"email_address": "merchantuser@s7merchant.co.uk",
Expand Down Expand Up @@ -163,7 +167,8 @@
},
"operators": [
"Safaricom",
"Voucher"
"Voucher",
"PataPawa PostPay"
],
"user": {
"email_address": "merchantuser@xperiamerchant.co.uk",
Expand All @@ -187,6 +192,11 @@
"name": "Voucher",
"require_custom_merchant_number": false,
"require_custom_terminal_number": false
},
{
"name": "PataPawa PostPay",
"require_custom_merchant_number": false,
"require_custom_terminal_number": false
}
],
"contracts": [
Expand Down Expand Up @@ -266,6 +276,25 @@
]
}
]
},
{
"operator_name": "PataPawa PostPay",
"description": "PataPawa PostPay Contract",
"products": [
{
"display_text": "Bill Pay (Post)",
"product_name": "Post Pay Bill Pay",
"value": null,
"transaction_fees": [
{
"calculation_type": 0,
"description": "Merchant Commission",
"value": 0.95,
"fee_type": 0
}
]
}
]
}
]
},
Expand Down