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 @@ -19,8 +19,8 @@ static async Task Main(string[] args)
endDate = DateTime.ParseExact(args[2], "yyyy-MM-dd", null);
}

startDate = new DateTime(2021,12,01);
endDate = new DateTime(2022,1,4);
startDate = new DateTime(2022,7,1);
endDate = new DateTime(2022,7,31);

SettlementProcessor processor = new SettlementProcessor();
processor.LoadConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"profiles": {
"TransactionProcessing.SettlementProcessor": {
"commandName": "Project",
//"commandLineArgs": "4FC2692F-067A-443E-8006-335BF2732248 2021-10-27 2021-10-27"
"commandLineArgs": "4FC2692F-067A-443E-8006-335BF2732248"
"commandLineArgs": "435613ac-a468-47a3-ac4f-649d89764c22"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

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

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SecurityService.Client" Version="1.0.8" />
<PackageReference Include="Shared" Version="1.0.14" />
<PackageReference Include="TransactionProcessor.Client" Version="1.0.16.2" />
<PackageReference Include="Shared" Version="1.3.3" />
<PackageReference Include="TransactionProcessor.Client" Version="1.1.5" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions TransactionProcessor.DataGenerator/DataGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static async Task Main(string[] args)
Program.TransactionProcessorClient = new TransactionProcessorClient(baseAddressFunc, httpClient);

// Set an estate
Guid estateId = Guid.Parse("0f7040a6-e3c1-48ad-9d1b-39c1536fa688");
Guid estateId = Guid.Parse("435613ac-a468-47a3-ac4f-649d89764c22");

// Get a token
await Program.GetToken(CancellationToken.None);
Expand All @@ -108,8 +108,8 @@ static async Task Main(string[] args)
List<MerchantResponse> merchants = await Program.EstateClient.GetMerchants(Program.TokenResponse.AccessToken, estateId, CancellationToken.None);

// Set the date range
DateTime startDate = new DateTime(2022,1,5); //27/7
DateTime endDate = new DateTime(2022,1,5); // This is the date of te last generated transaction
DateTime startDate = new DateTime(2022,8,1); //27/7
DateTime endDate = new DateTime(2022,8,1); // This is the date of te last generated transaction
List<DateTime> dateRange = Program.GenerateDateRange(startDate, endDate);

// Only use merchants that have a device
Expand Down Expand Up @@ -189,10 +189,13 @@ private static async Task GenerateFileUploads(List<MerchantResponse> merchants,

await UploadFile(file, merchant.EstateId, merchant.MerchantId, fileProfileId, estateUser.SecurityUserId, fileDateTime, cancellationToken);
// Remove file onece uploaded
Console.WriteLine($"File Uploaded for Merchant {merchant.MerchantName}");
File.Delete(file);
}
}
}

await Task.Delay(10000);
}

private static Guid GetFileProfileIdFromOperator(String operatorName, CancellationToken cancellationToken)
Expand Down
12 changes: 9 additions & 3 deletions TransactionProcessor.SystemSetupTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ private static async Task SetupSubscriptions()

foreach (var estate in estateConfiguration.Estates)
{
PersistentSubscriptionSettings s = new PersistentSubscriptionSettings(resolveLinkTos: true, maxRetryCount: 5);
PersistentSubscriptionSettings s = new PersistentSubscriptionSettings(resolveLinkTos:true, maxRetryCount:5);
// Setup the subscrtipions
await PersistentSubscriptionsClient.CreateAsync(estate.Name.Replace(" ", ""), "Reporting", s);
await PersistentSubscriptionsClient.CreateAsync($"FileProcessorSubscriptionStream_{estate.Name.Replace(" ", "")}", "FileProcessor", s);
await PersistentSubscriptionsClient.CreateAsync($"FileProcessorSubscriptionStream_{estate.Name.Replace(" ", "")}", "File sProcessor", s);
await PersistentSubscriptionsClient.CreateAsync($"TransactionProcessorSubscriptionStream_{estate.Name.Replace(" ", "")}", "Transaction Processor", s);
await Program.PersistentSubscriptionsClient.CreateAsync($"EstateManagementSubscriptionStream_{estate.Name.Replace(" ", "")}", "Estate Management", s);
}
Expand All @@ -105,6 +105,12 @@ private static async Task DeployProjections()
FileInfo f = new FileInfo(projection);
String name = f.Name.Substring(0, f.Name.Length - (f.Name.Length - f.Name.LastIndexOf(".")));
var body = File.ReadAllText(f.FullName);

var x = body.IndexOf("//endtestsetup");
x = x + "//endtestsetup".Length;

body = body.Substring(x);

// Is this already deployed (in the master list)
if ( currentProjections.Any(p => p.Name == name) == false)
{
Expand Down Expand Up @@ -212,7 +218,7 @@ private static async Task SetupEstatesFromConfig()

foreach (var estate in estateConfiguration.Estates)
{
await Program.CreateEstate(estate, CancellationToken.None);
await Program.CreateEstate(estate, CancellationToken.None);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

<ItemGroup>
Expand All @@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SecurityService.Client" Version="1.0.8" />
<PackageReference Include="Shared" Version="1.1.8" />
<PackageReference Include="Shared" Version="1.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion TransactionProcessor.SystemSetupTool/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// 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=true&tlsVerifyCert=false"
"EventStoreAddress": "esdb://admin:changeit@192.168.0.133:2113?tls=false&tlsVerifyCert=false"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromStreams = fromStreams || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.fromStreams;
var emit = emit || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.emit;
//endtestsetup

fromStreams("$ce-EstateAggregate", "$et-CallbackReceivedEvent")
.when({
$init: function (s, e)
Expand Down Expand Up @@ -77,4 +82,4 @@ function getStreamName(estate, e) {

return streamName;

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromAll = fromAll || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.fromAll;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

isEstateEvent = (e) => { return (e.data && e.data.estateId); }
isAnEstateCreatedEvent = (e) => { return compareEventTypeSafely(e.eventType, 'EstateCreatedEvent') };

Expand All @@ -20,6 +25,8 @@ isTruncated = function (metadata) {
return false;
};

getStringWithNoSpaces = function(inputString) { return inputString.replace(/-/gi, "").replace(/ /g, ""); }

fromAll()
.when({
$init: function (s, e) {
Expand All @@ -33,13 +40,12 @@ fromAll()

if (isAnEstateCreatedEvent(e)) {
s.estates[e.data.estateId] = {
filteredName: e.data.estateName.replace(/-/gi, ""),
name: e.data.estateName.replace(/-/gi, "").replace(" ", "")
name: getStringWithNoSpaces(e.data.estateName)
};
}

linkTo(s.estates[e.data.estateId].name, e);
}
}
}
);
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromAll = fromAll || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.fromAll;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

isEstateEvent = (e) => { return (e.data && e.data.estateId); }
isAnEstateCreatedEvent = (e) => { return compareEventTypeSafely(e.eventType, 'EstateCreatedEvent') };
compareEventTypeSafely = (sourceEventType, targetEventType) => { return (sourceEventType.toUpperCase() === targetEventType.toUpperCase()); }
Expand Down Expand Up @@ -35,6 +40,8 @@ getStreamName = function (estateName) {
return 'EstateManagementSubscriptionStream_' + estateName;
}

getStringWithNoSpaces = function (inputString) { return inputString.replace(/-/gi, "").replace(/ /g, ""); }

fromAll()
.when({
$init: function (s, e) {
Expand All @@ -48,7 +55,7 @@ fromAll()
if (isAnEstateCreatedEvent(e)) {
s.estates[e.data.estateId] = {
filteredName: e.data.estateName.replace(/-/gi, ""),
name: e.data.estateName.replace(/-/gi, "").replace(" ", "")
name: getStringWithNoSpaces(e.data.estateName)
};
}

Expand All @@ -58,4 +65,4 @@ fromAll()
}
}
}
);
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromAll = fromAll || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.fromAll;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

isEstateEvent = (e) => { return (e.data && e.data.estateId); }
isAnEstateCreatedEvent = (e) => { return compareEventTypeSafely(e.eventType, 'EstateCreatedEvent') };
compareEventTypeSafely = (sourceEventType, targetEventType) => { return (sourceEventType.toUpperCase() === targetEventType.toUpperCase()); }
Expand Down Expand Up @@ -39,6 +44,8 @@ getStreamName = function (estateName) {
return 'FileProcessorSubscriptionStream_' + estateName;
}

getStringWithNoSpaces = function (inputString) { return inputString.replace(/-/gi, "").replace(/ /g, ""); }

fromAll()
.when({
$init: function (s, e) {
Expand All @@ -52,7 +59,7 @@ fromAll()
if (isAnEstateCreatedEvent(e)) {
s.estates[e.data.estateId] = {
filteredName: e.data.estateName.replace(/-/gi, ""),
name: e.data.estateName.replace(/-/gi, "").replace(" ", "")
name: getStringWithNoSpaces(e.data.estateName)
};
}

Expand All @@ -62,4 +69,4 @@ fromAll()
}
}
}
);
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromAll = fromAll || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.fromAll;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

isValidEvent = function (e) {

if (e) {
Expand Down Expand Up @@ -31,4 +36,4 @@ fromAll()
}
}
}
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//starttestsetup
var fromCategory = fromCategory || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.fromCategory;
var partitionBy = partitionBy !== null ? partitionBy : require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.partitionBy;
var emit = emit || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.emit;
//endtestsetup

fromCategory('MerchantArchive')
.foreachStream()
.when({
Expand Down Expand Up @@ -39,6 +45,11 @@ var eventbus = {
return;
}

if (e.eventType === 'AutomaticDepositMadeEvent') {
depositMadeEventHandler(s, e);
return;
}

if (e.eventType === 'TransactionHasStartedEvent') {
transactionHasStartedEventHandler(s, e);
return;
Expand Down Expand Up @@ -126,7 +137,7 @@ var merchantCreatedEventHandler = function (s, e) {
var emitBalanceChangedEvent = function (aggregateId, eventId, s, changeAmount, dateTime, reference) {

if (s.initialised === true) {

// Emit an opening balance event
var openingBalanceEvent = {
$type: getEventTypeName(),
Expand Down Expand Up @@ -175,8 +186,7 @@ var depositMadeEventHandler = function (s, e) {
incrementBalanceFromDeposit(s, e.data.amount, e.data.depositDateTime);

// emit an balance changed event here
console.log(e);
s = emitBalanceChangedEvent(e.data.merchantId, e.eventId, s, e.data.amount, e.data.depositDateTime, "Merchant Deposit");
emitBalanceChangedEvent(e.data.merchantId, e.eventId, s, e.data.amount, e.data.depositDateTime, "Merchant Deposit");
};

var transactionHasStartedEventHandler = function (s, e) {
Expand Down Expand Up @@ -239,7 +249,7 @@ var merchantFeeAddedToTransactionEventHandler = function (s, e) {

// increment the balance now
incrementBalanceFromMerchantFee(s, e.data.calculatedValue, e.data.feeCalculatedDateTime);

// emit an balance changed event here
s = emitBalanceChangedEvent(e.data.transactionId, e.eventId, s, e.data.calculatedValue, e.data.feeCalculatedDateTime, "Transaction Fee Processed");
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//starttestsetup
var fromCategory = fromCategory || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.fromCategory;
var emit = emit || require('../../node_modules/@transactionprocessing/esprojection-testing-framework').scope.emit;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

fromCategory('TransactionAggregate')
.foreachStream()
.when({
Expand Down Expand Up @@ -61,4 +67,4 @@ function serviceProviderFeeAddedToTransactionEventHandler(s, e) {

function getStreamName(s) {
return "TransactionEnricherResult";
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//starttestsetup
var fromAll = fromAll || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.fromAll;
var linkTo = linkTo || require("../../node_modules/@transactionprocessing/esprojection-testing-framework").scope.linkTo;
//endtestsetup

isEstateEvent = (e) => { return (e.data && e.data.estateId); }
isAnEstateCreatedEvent = (e) => { return compareEventTypeSafely(e.eventType, 'EstateCreatedEvent') };
compareEventTypeSafely = (sourceEventType, targetEventType) => { return (sourceEventType.toUpperCase() === targetEventType.toUpperCase()); }
Expand All @@ -8,6 +13,7 @@ getSupportedEventTypes = function () {

eventTypes.push('CustomerEmailReceiptRequestedEvent');
eventTypes.push('TransactionHasBeenCompletedEvent');
eventTypes.push('MerchantFeeAddedToTransactionEvent');

return eventTypes;
}
Expand All @@ -33,6 +39,8 @@ getStreamName = function (estateName) {
return 'TransactionProcessorSubscriptionStream_' + estateName;
}

getStringWithNoSpaces = function (inputString) { return inputString.replace(/-/gi, "").replace(/ /g, ""); }

fromAll()
.when({
$init: function (s, e) {
Expand All @@ -46,7 +54,7 @@ fromAll()
if (isAnEstateCreatedEvent(e)) {
s.estates[e.data.estateId] = {
filteredName: e.data.estateName.replace(/-/gi, ""),
name: e.data.estateName.replace(/-/gi, "").replace(" ", "")
name: getStringWithNoSpaces(e.data.estateName)
};
}

Expand All @@ -56,4 +64,4 @@ fromAll()
}
}
}
);
);
Loading