diff --git a/TransactionProcessor.IntegrationTests/SaleTransaction/SaleTransactionFeature.feature.cs b/TransactionProcessor.IntegrationTests/SaleTransaction/SaleTransactionFeature.feature.cs
index 5aa74e27..fef900df 100644
--- a/TransactionProcessor.IntegrationTests/SaleTransaction/SaleTransactionFeature.feature.cs
+++ b/TransactionProcessor.IntegrationTests/SaleTransaction/SaleTransactionFeature.feature.cs
@@ -1,3 +1,822 @@
-#error Could not find a reference to SpecFlow in project 'TransactionProcessor.IntegrationTests'.
-#error Please add the 'TechTalk.SpecFlow' package to the project and use MSBuild generation instead of using SpecFlowSingleFileGenerator.
-#error For more information see https://specflow.org/documentation/Generate-Tests-from-MsBuild/
\ No newline at end of file
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (https://www.specflow.org/).
+// SpecFlow Version:3.3.0.0
+// SpecFlow Generator Version:3.1.0.0
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+#region Designer generated code
+#pragma warning disable
+namespace TransactionProcessor.IntegrationTests.SaleTransaction
+{
+ using TechTalk.SpecFlow;
+ using System;
+ using System.Linq;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.3.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [Xunit.TraitAttribute("Category", "base")]
+ [Xunit.TraitAttribute("Category", "shared")]
+ public partial class SaleTransactionFeature : object, Xunit.IClassFixture, System.IDisposable
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+ private string[] _featureTags = new string[] {
+ "base",
+ "shared"};
+
+ private Xunit.Abstractions.ITestOutputHelper _testOutputHelper;
+
+#line 1 "SaleTransactionFeature.feature"
+#line hidden
+
+ public SaleTransactionFeature(SaleTransactionFeature.FixtureData fixtureData, TransactionProcessor_IntegrationTests_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper)
+ {
+ this._testOutputHelper = testOutputHelper;
+ this.TestInitialize();
+ }
+
+ public static void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "SaleTransaction", null, ProgrammingLanguage.CSharp, new string[] {
+ "base",
+ "shared"});
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ public static void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void TestInitialize()
+ {
+ }
+
+ public virtual void TestTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioInitialize(scenarioInfo);
+ testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper);
+ }
+
+ public virtual void ScenarioStart()
+ {
+ testRunner.OnScenarioStart();
+ }
+
+ public virtual void ScenarioCleanup()
+ {
+ testRunner.CollectScenarioErrors();
+ }
+
+ public virtual void FeatureBackground()
+ {
+#line 4
+#line hidden
+ TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
+ "ResourceName",
+ "DisplayName",
+ "Secret",
+ "Scopes",
+ "UserClaims"});
+ table22.AddRow(new string[] {
+ "estateManagement",
+ "Estate Managememt REST",
+ "Secret1",
+ "estateManagement",
+ "MerchantId, EstateId, role"});
+ table22.AddRow(new string[] {
+ "transactionProcessor",
+ "Transaction Processor REST",
+ "Secret1",
+ "transactionProcessor",
+ ""});
+#line 6
+ testRunner.Given("the following api resources exist", ((string)(null)), table22, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table23 = new TechTalk.SpecFlow.Table(new string[] {
+ "ClientId",
+ "ClientName",
+ "Secret",
+ "AllowedScopes",
+ "AllowedGrantTypes"});
+ table23.AddRow(new string[] {
+ "serviceClient",
+ "Service Client",
+ "Secret1",
+ "estateManagement,transactionProcessor",
+ "client_credentials"});
+#line 11
+ testRunner.Given("the following clients exist", ((string)(null)), table23, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table24 = new TechTalk.SpecFlow.Table(new string[] {
+ "ClientId"});
+ table24.AddRow(new string[] {
+ "serviceClient"});
+#line 15
+ testRunner.Given("I have a token to access the estate management and transaction processor resource" +
+ "s", ((string)(null)), table24, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table25 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName"});
+ table25.AddRow(new string[] {
+ "Test Estate 1"});
+ table25.AddRow(new string[] {
+ "Test Estate 2"});
+#line 19
+ testRunner.Given("I have created the following estates", ((string)(null)), table25, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table26 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "OperatorName",
+ "RequireCustomMerchantNumber",
+ "RequireCustomTerminalNumber"});
+ table26.AddRow(new string[] {
+ "Test Estate 1",
+ "Safaricom",
+ "True",
+ "True"});
+ table26.AddRow(new string[] {
+ "Test Estate 2",
+ "Safaricom",
+ "True",
+ "True"});
+#line 24
+ testRunner.Given("I have created the following operators", ((string)(null)), table26, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table27 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "OperatorName",
+ "ContractDescription"});
+ table27.AddRow(new string[] {
+ "Test Estate 1",
+ "Safaricom",
+ "Safaricom Contract"});
+ table27.AddRow(new string[] {
+ "Test Estate 2",
+ "Safaricom",
+ "Safaricom Contract"});
+#line 29
+ testRunner.Given("I create a contract with the following values", ((string)(null)), table27, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table28 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "OperatorName",
+ "ContractDescription",
+ "ProductName",
+ "DisplayText",
+ "Value"});
+ table28.AddRow(new string[] {
+ "Test Estate 1",
+ "Safaricom",
+ "Safaricom Contract",
+ "Variable Topup",
+ "Custom",
+ ""});
+ table28.AddRow(new string[] {
+ "Test Estate 2",
+ "Safaricom",
+ "Safaricom Contract",
+ "Variable Topup",
+ "Custom",
+ ""});
+#line 34
+ testRunner.When("I create the following Products", ((string)(null)), table28, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table29 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "OperatorName",
+ "ContractDescription",
+ "ProductName",
+ "CalculationType",
+ "FeeDescription",
+ "Value"});
+ table29.AddRow(new string[] {
+ "Test Estate 1",
+ "Safaricom",
+ "Safaricom Contract",
+ "Variable Topup",
+ "Fixed",
+ "Merchant Commission",
+ "2.50"});
+ table29.AddRow(new string[] {
+ "Test Estate 2",
+ "Safaricom",
+ "Safaricom Contract",
+ "Variable Topup",
+ "Percentage",
+ "Merchant Commission",
+ "0.85"});
+#line 39
+ testRunner.When("I add the following Transaction Fees", ((string)(null)), table29, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table30 = new TechTalk.SpecFlow.Table(new string[] {
+ "MerchantName",
+ "AddressLine1",
+ "Town",
+ "Region",
+ "Country",
+ "ContactName",
+ "EmailAddress",
+ "EstateName"});
+ table30.AddRow(new string[] {
+ "Test Merchant 1",
+ "Address Line 1",
+ "TestTown",
+ "Test Region",
+ "United Kingdom",
+ "Test Contact 1",
+ "testcontact1@merchant1.co.uk",
+ "Test Estate 1"});
+ table30.AddRow(new string[] {
+ "Test Merchant 2",
+ "Address Line 1",
+ "TestTown",
+ "Test Region",
+ "United Kingdom",
+ "Test Contact 2",
+ "testcontact2@merchant2.co.uk",
+ "Test Estate 1"});
+ table30.AddRow(new string[] {
+ "Test Merchant 3",
+ "Address Line 1",
+ "TestTown",
+ "Test Region",
+ "United Kingdom",
+ "Test Contact 3",
+ "testcontact3@merchant2.co.uk",
+ "Test Estate 2"});
+#line 44
+ testRunner.Given("I create the following merchants", ((string)(null)), table30, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table31 = new TechTalk.SpecFlow.Table(new string[] {
+ "OperatorName",
+ "MerchantName",
+ "MerchantNumber",
+ "TerminalNumber",
+ "EstateName"});
+ table31.AddRow(new string[] {
+ "Safaricom",
+ "Test Merchant 1",
+ "00000001",
+ "10000001",
+ "Test Estate 1"});
+ table31.AddRow(new string[] {
+ "Safaricom",
+ "Test Merchant 2",
+ "00000002",
+ "10000002",
+ "Test Estate 1"});
+ table31.AddRow(new string[] {
+ "Safaricom",
+ "Test Merchant 3",
+ "00000003",
+ "10000003",
+ "Test Estate 2"});
+#line 50
+ testRunner.Given("I have assigned the following operator to the merchants", ((string)(null)), table31, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table32 = new TechTalk.SpecFlow.Table(new string[] {
+ "DeviceIdentifier",
+ "MerchantName",
+ "EstateName"});
+ table32.AddRow(new string[] {
+ "123456780",
+ "Test Merchant 1",
+ "Test Estate 1"});
+ table32.AddRow(new string[] {
+ "123456781",
+ "Test Merchant 2",
+ "Test Estate 1"});
+ table32.AddRow(new string[] {
+ "123456782",
+ "Test Merchant 3",
+ "Test Estate 2"});
+#line 56
+ testRunner.Given("I have assigned the following devices to the merchants", ((string)(null)), table32, "Given ");
+#line hidden
+ TechTalk.SpecFlow.Table table33 = new TechTalk.SpecFlow.Table(new string[] {
+ "Reference",
+ "Amount",
+ "DateTime",
+ "MerchantName",
+ "EstateName"});
+ table33.AddRow(new string[] {
+ "Deposit1",
+ "200.00",
+ "Today",
+ "Test Merchant 1",
+ "Test Estate 1"});
+ table33.AddRow(new string[] {
+ "Deposit1",
+ "100.00",
+ "Today",
+ "Test Merchant 2",
+ "Test Estate 1"});
+ table33.AddRow(new string[] {
+ "Deposit1",
+ "100.00",
+ "Today",
+ "Test Merchant 3",
+ "Test Estate 2"});
+#line 62
+ testRunner.Given("I make the following manual merchant deposits", ((string)(null)), table33, "Given ");
+#line hidden
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ this.TestTearDown();
+ }
+
+ [Xunit.SkippableFactAttribute(DisplayName="Sale Transactions")]
+ [Xunit.TraitAttribute("FeatureTitle", "SaleTransaction")]
+ [Xunit.TraitAttribute("Description", "Sale Transactions")]
+ [Xunit.TraitAttribute("Category", "PRTest")]
+ public virtual void SaleTransactions()
+ {
+ string[] tagsOfScenario = new string[] {
+ "PRTest"};
+ System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Sale Transactions", null, tagsOfScenario, argumentsOfScenario);
+#line 69
+this.ScenarioInitialize(scenarioInfo);
+#line hidden
+ bool isScenarioIgnored = default(bool);
+ bool isFeatureIgnored = default(bool);
+ if ((tagsOfScenario != null))
+ {
+ isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((this._featureTags != null))
+ {
+ isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((isScenarioIgnored || isFeatureIgnored))
+ {
+ testRunner.SkipScenario();
+ }
+ else
+ {
+ this.ScenarioStart();
+#line 4
+this.FeatureBackground();
+#line hidden
+ TechTalk.SpecFlow.Table table34 = new TechTalk.SpecFlow.Table(new string[] {
+ "DateTime",
+ "TransactionNumber",
+ "TransactionType",
+ "MerchantName",
+ "DeviceIdentifier",
+ "EstateName",
+ "OperatorName",
+ "TransactionAmount",
+ "CustomerAccountNumber",
+ "CustomerEmailAddress",
+ "ContractDescription",
+ "ProductName"});
+ table34.AddRow(new string[] {
+ "Today",
+ "1",
+ "Sale",
+ "Test Merchant 1",
+ "123456780",
+ "Test Estate 1",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "",
+ "Safaricom Contract",
+ "Variable Topup"});
+ table34.AddRow(new string[] {
+ "Today",
+ "2",
+ "Sale",
+ "Test Merchant 2",
+ "123456781",
+ "Test Estate 1",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "",
+ "Safaricom Contract",
+ "Variable Topup"});
+ table34.AddRow(new string[] {
+ "Today",
+ "3",
+ "Sale",
+ "Test Merchant 3",
+ "123456782",
+ "Test Estate 2",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "",
+ "Safaricom Contract",
+ "Variable Topup"});
+ table34.AddRow(new string[] {
+ "Today",
+ "4",
+ "Sale",
+ "Test Merchant 1",
+ "123456780",
+ "Test Estate 1",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "testcustomer@customer.co.uk",
+ "Safaricom Contract",
+ "Variable Topup"});
+#line 71
+ testRunner.When("I perform the following transactions", ((string)(null)), table34, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table35 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "MerchantName",
+ "TransactionNumber",
+ "ResponseCode",
+ "ResponseMessage"});
+ table35.AddRow(new string[] {
+ "Test Estate 1",
+ "Test Merchant 1",
+ "1",
+ "0000",
+ "SUCCESS"});
+ table35.AddRow(new string[] {
+ "Test Estate 1",
+ "Test Merchant 2",
+ "2",
+ "0000",
+ "SUCCESS"});
+ table35.AddRow(new string[] {
+ "Test Estate 2",
+ "Test Merchant 3",
+ "3",
+ "0000",
+ "SUCCESS"});
+ table35.AddRow(new string[] {
+ "Test Estate 1",
+ "Test Merchant 1",
+ "4",
+ "0000",
+ "SUCCESS"});
+#line 78
+ testRunner.Then("transaction response should contain the following information", ((string)(null)), table35, "Then ");
+#line hidden
+ }
+ this.ScenarioCleanup();
+ }
+
+ [Xunit.SkippableFactAttribute(DisplayName="Sale Transaction with Invalid Device")]
+ [Xunit.TraitAttribute("FeatureTitle", "SaleTransaction")]
+ [Xunit.TraitAttribute("Description", "Sale Transaction with Invalid Device")]
+ [Xunit.TraitAttribute("Category", "PRTest")]
+ public virtual void SaleTransactionWithInvalidDevice()
+ {
+ string[] tagsOfScenario = new string[] {
+ "PRTest"};
+ System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Sale Transaction with Invalid Device", null, tagsOfScenario, argumentsOfScenario);
+#line 86
+this.ScenarioInitialize(scenarioInfo);
+#line hidden
+ bool isScenarioIgnored = default(bool);
+ bool isFeatureIgnored = default(bool);
+ if ((tagsOfScenario != null))
+ {
+ isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((this._featureTags != null))
+ {
+ isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((isScenarioIgnored || isFeatureIgnored))
+ {
+ testRunner.SkipScenario();
+ }
+ else
+ {
+ this.ScenarioStart();
+#line 4
+this.FeatureBackground();
+#line hidden
+ TechTalk.SpecFlow.Table table36 = new TechTalk.SpecFlow.Table(new string[] {
+ "DateTime",
+ "TransactionNumber",
+ "TransactionType",
+ "MerchantName",
+ "DeviceIdentifier",
+ "EstateName",
+ "OperatorName",
+ "TransactionAmount",
+ "CustomerAccountNumber",
+ "CustomerEmailAddress",
+ "ContractDescription",
+ "ProductName"});
+ table36.AddRow(new string[] {
+ "Today",
+ "1",
+ "Sale",
+ "Test Merchant 1",
+ "123456781",
+ "Test Estate 1",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "testcustomer@customer.co.uk",
+ "Safaricom Contract",
+ "Variable Topup"});
+#line 88
+ testRunner.When("I perform the following transactions", ((string)(null)), table36, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table37 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "MerchantName",
+ "TransactionNumber",
+ "ResponseCode",
+ "ResponseMessage"});
+ table37.AddRow(new string[] {
+ "Test Estate 1",
+ "Test Merchant 1",
+ "1",
+ "1000",
+ "Device Identifier 123456781 not valid for Merchant Test Merchant 1"});
+#line 92
+ testRunner.Then("transaction response should contain the following information", ((string)(null)), table37, "Then ");
+#line hidden
+ }
+ this.ScenarioCleanup();
+ }
+
+ [Xunit.SkippableFactAttribute(DisplayName="Sale Transaction with Invalid Estate")]
+ [Xunit.TraitAttribute("FeatureTitle", "SaleTransaction")]
+ [Xunit.TraitAttribute("Description", "Sale Transaction with Invalid Estate")]
+ public virtual void SaleTransactionWithInvalidEstate()
+ {
+ string[] tagsOfScenario = ((string[])(null));
+ System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Sale Transaction with Invalid Estate", null, tagsOfScenario, argumentsOfScenario);
+#line 96
+this.ScenarioInitialize(scenarioInfo);
+#line hidden
+ bool isScenarioIgnored = default(bool);
+ bool isFeatureIgnored = default(bool);
+ if ((tagsOfScenario != null))
+ {
+ isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((this._featureTags != null))
+ {
+ isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((isScenarioIgnored || isFeatureIgnored))
+ {
+ testRunner.SkipScenario();
+ }
+ else
+ {
+ this.ScenarioStart();
+#line 4
+this.FeatureBackground();
+#line hidden
+ TechTalk.SpecFlow.Table table38 = new TechTalk.SpecFlow.Table(new string[] {
+ "DateTime",
+ "TransactionNumber",
+ "TransactionType",
+ "MerchantName",
+ "DeviceIdentifier",
+ "EstateName",
+ "OperatorName",
+ "TransactionAmount",
+ "CustomerAccountNumber",
+ "CustomerEmailAddress",
+ "ContractDescription",
+ "ProductName"});
+ table38.AddRow(new string[] {
+ "Today",
+ "1",
+ "Sale",
+ "Test Merchant 1",
+ "123456780",
+ "InvalidEstate",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "testcustomer@customer.co.uk",
+ "Safaricom Contract",
+ "Variable Topup"});
+#line 98
+ testRunner.When("I perform the following transactions", ((string)(null)), table38, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table39 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "MerchantName",
+ "TransactionNumber",
+ "ResponseCode",
+ "ResponseMessage"});
+ table39.AddRow(new string[] {
+ "InvalidEstate",
+ "Test Merchant 1",
+ "1",
+ "1001",
+ "Estate Id [79902550-64df-4491-b0c1-4e78943928a3] is not a valid estate"});
+#line 102
+ testRunner.Then("transaction response should contain the following information", ((string)(null)), table39, "Then ");
+#line hidden
+ }
+ this.ScenarioCleanup();
+ }
+
+ [Xunit.SkippableFactAttribute(DisplayName="Sale Transaction with Invalid Merchant")]
+ [Xunit.TraitAttribute("FeatureTitle", "SaleTransaction")]
+ [Xunit.TraitAttribute("Description", "Sale Transaction with Invalid Merchant")]
+ public virtual void SaleTransactionWithInvalidMerchant()
+ {
+ string[] tagsOfScenario = ((string[])(null));
+ System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Sale Transaction with Invalid Merchant", null, tagsOfScenario, argumentsOfScenario);
+#line 106
+this.ScenarioInitialize(scenarioInfo);
+#line hidden
+ bool isScenarioIgnored = default(bool);
+ bool isFeatureIgnored = default(bool);
+ if ((tagsOfScenario != null))
+ {
+ isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((this._featureTags != null))
+ {
+ isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((isScenarioIgnored || isFeatureIgnored))
+ {
+ testRunner.SkipScenario();
+ }
+ else
+ {
+ this.ScenarioStart();
+#line 4
+this.FeatureBackground();
+#line hidden
+ TechTalk.SpecFlow.Table table40 = new TechTalk.SpecFlow.Table(new string[] {
+ "DateTime",
+ "TransactionNumber",
+ "TransactionType",
+ "MerchantName",
+ "DeviceIdentifier",
+ "EstateName",
+ "OperatorName",
+ "TransactionAmount",
+ "CustomerAccountNumber",
+ "CustomerEmailAddress",
+ "ContractDescription",
+ "ProductName"});
+ table40.AddRow(new string[] {
+ "Today",
+ "1",
+ "Sale",
+ "InvalidMerchant",
+ "123456780",
+ "Test Estate 1",
+ "Safaricom",
+ "100.00",
+ "123456789",
+ "testcustomer@customer.co.uk",
+ "Safaricom Contract",
+ "Variable Topup"});
+#line 108
+ testRunner.When("I perform the following transactions", ((string)(null)), table40, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table41 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "MerchantName",
+ "TransactionNumber",
+ "ResponseCode",
+ "ResponseMessage"});
+ table41.AddRow(new string[] {
+ "Test Estate 1",
+ "InvalidMerchant",
+ "1",
+ "1002",
+ "Merchant Id [d59320fa-4c3e-4900-a999-483f6a10c69a] is not a valid merchant for es" +
+ "tate [Test Estate 1]"});
+#line 112
+ testRunner.Then("transaction response should contain the following information", ((string)(null)), table41, "Then ");
+#line hidden
+ }
+ this.ScenarioCleanup();
+ }
+
+ [Xunit.SkippableFactAttribute(DisplayName="Sale Transaction with Not Enough Credit Available")]
+ [Xunit.TraitAttribute("FeatureTitle", "SaleTransaction")]
+ [Xunit.TraitAttribute("Description", "Sale Transaction with Not Enough Credit Available")]
+ [Xunit.TraitAttribute("Category", "PRTest")]
+ public virtual void SaleTransactionWithNotEnoughCreditAvailable()
+ {
+ string[] tagsOfScenario = new string[] {
+ "PRTest"};
+ System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Sale Transaction with Not Enough Credit Available", null, tagsOfScenario, argumentsOfScenario);
+#line 117
+this.ScenarioInitialize(scenarioInfo);
+#line hidden
+ bool isScenarioIgnored = default(bool);
+ bool isFeatureIgnored = default(bool);
+ if ((tagsOfScenario != null))
+ {
+ isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((this._featureTags != null))
+ {
+ isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any();
+ }
+ if ((isScenarioIgnored || isFeatureIgnored))
+ {
+ testRunner.SkipScenario();
+ }
+ else
+ {
+ this.ScenarioStart();
+#line 4
+this.FeatureBackground();
+#line hidden
+ TechTalk.SpecFlow.Table table42 = new TechTalk.SpecFlow.Table(new string[] {
+ "DateTime",
+ "TransactionNumber",
+ "TransactionType",
+ "MerchantName",
+ "DeviceIdentifier",
+ "EstateName",
+ "OperatorName",
+ "TransactionAmount",
+ "CustomerAccountNumber",
+ "CustomerEmailAddress",
+ "ContractDescription",
+ "ProductName"});
+ table42.AddRow(new string[] {
+ "Today",
+ "1",
+ "Sale",
+ "Test Merchant 1",
+ "123456780",
+ "Test Estate 1",
+ "Safaricom",
+ "300.00",
+ "123456789",
+ "testcustomer@customer.co.uk",
+ "Safaricom Contract",
+ "Variable Topup"});
+#line 119
+ testRunner.When("I perform the following transactions", ((string)(null)), table42, "When ");
+#line hidden
+ TechTalk.SpecFlow.Table table43 = new TechTalk.SpecFlow.Table(new string[] {
+ "EstateName",
+ "MerchantName",
+ "TransactionNumber",
+ "ResponseCode",
+ "ResponseMessage"});
+ table43.AddRow(new string[] {
+ "Test Estate 1",
+ "Test Merchant 1",
+ "1",
+ "1009",
+ "Merchant [Test Merchant 1] does not have enough credit available [200.0] to perfo" +
+ "rm transaction amount [300.00]"});
+#line 124
+ testRunner.Then("transaction response should contain the following information", ((string)(null)), table43, "Then ");
+#line hidden
+ }
+ this.ScenarioCleanup();
+ }
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.3.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class FixtureData : System.IDisposable
+ {
+
+ public FixtureData()
+ {
+ SaleTransactionFeature.FeatureSetup();
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ SaleTransactionFeature.FeatureTearDown();
+ }
+ }
+ }
+}
+#pragma warning restore
+#endregion
diff --git a/TransactionProcessor.Testing/TestData.cs b/TransactionProcessor.Testing/TestData.cs
index bee1835b..624e88f3 100644
--- a/TransactionProcessor.Testing/TestData.cs
+++ b/TransactionProcessor.Testing/TestData.cs
@@ -669,7 +669,8 @@ public static TokenResponse TokenResponse()
TestData.MerchantId,
TestData.ResponseCode,
TestData.ResponseMessage,
- TestData.IsAuthorised);
+ TestData.IsAuthorised,
+ TestData.TransactionAmount);
public static Guid TransactionFeeId = Guid.Parse("B83FCCCE-0D45-4FC2-8952-ED277A124BDB");
diff --git a/TransactionProcessor.Transaction.DomainEvents/TransactionHasBeenCompletedEvent.cs b/TransactionProcessor.Transaction.DomainEvents/TransactionHasBeenCompletedEvent.cs
index ecd2915a..f0e2c9bd 100644
--- a/TransactionProcessor.Transaction.DomainEvents/TransactionHasBeenCompletedEvent.cs
+++ b/TransactionProcessor.Transaction.DomainEvents/TransactionHasBeenCompletedEvent.cs
@@ -23,7 +23,7 @@ public TransactionHasBeenCompletedEvent()
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The aggregate identifier.
/// The event identifier.
@@ -32,13 +32,15 @@ public TransactionHasBeenCompletedEvent()
/// The response code.
/// The response message.
/// if set to true [is authorised].
+ /// The transaction amount.
private TransactionHasBeenCompletedEvent(Guid aggregateId,
Guid eventId,
Guid estateId,
Guid merchantId,
String responseCode,
String responseMessage,
- Boolean isAuthorised) : base(aggregateId, eventId)
+ Boolean isAuthorised,
+ Decimal? transactionAmount) : base(aggregateId, eventId)
{
this.TransactionId = aggregateId;
this.EstateId = estateId;
@@ -46,6 +48,7 @@ private TransactionHasBeenCompletedEvent(Guid aggregateId,
this.ResponseCode = responseCode;
this.ResponseMessage = responseMessage;
this.IsAuthorised = isAuthorised;
+ this.TransactionAmount = transactionAmount;
}
#endregion
@@ -70,6 +73,15 @@ private TransactionHasBeenCompletedEvent(Guid aggregateId,
[JsonProperty]
public Boolean IsAuthorised { get; private set; }
+ ///
+ /// Gets the transaction amount.
+ ///
+ ///
+ /// The transaction amount.
+ ///
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
+ public Decimal? TransactionAmount { get; private set; }
+
///
/// Gets the merchant identifier.
///
@@ -119,15 +131,17 @@ private TransactionHasBeenCompletedEvent(Guid aggregateId,
/// The response code.
/// The response message.
/// if set to true [is authorised].
+ /// The transaction amount.
///
public static TransactionHasBeenCompletedEvent Create(Guid aggregateId,
Guid estateId,
Guid merchantId,
String responseCode,
String responseMessage,
- Boolean isAuthorised)
+ Boolean isAuthorised,
+ Decimal? transactionAmount)
{
- return new TransactionHasBeenCompletedEvent(aggregateId, Guid.NewGuid(), estateId, merchantId, responseCode, responseMessage, isAuthorised);
+ return new TransactionHasBeenCompletedEvent(aggregateId, Guid.NewGuid(), estateId, merchantId, responseCode, responseMessage, isAuthorised, transactionAmount);
}
#endregion
diff --git a/TransactionProcessor.TransactionAggregate.Tests/DomainEventTests.cs b/TransactionProcessor.TransactionAggregate.Tests/DomainEventTests.cs
index 6ef3564c..f464d77e 100644
--- a/TransactionProcessor.TransactionAggregate.Tests/DomainEventTests.cs
+++ b/TransactionProcessor.TransactionAggregate.Tests/DomainEventTests.cs
@@ -74,7 +74,7 @@ public void TransactionHasBeenCompletedEvent_CanBeCreated_IsCreated()
TestData.MerchantId,
TestData.ResponseCode,
TestData.ResponseMessage,
- TestData.IsAuthorised);
+ TestData.IsAuthorised, TestData.TransactionAmount);
transactionHasBeenCompletedEvent.ShouldNotBeNull();
transactionHasBeenCompletedEvent.AggregateId.ShouldBe(TestData.TransactionId);
@@ -86,6 +86,7 @@ public void TransactionHasBeenCompletedEvent_CanBeCreated_IsCreated()
transactionHasBeenCompletedEvent.ResponseCode.ShouldBe(TestData.ResponseCode);
transactionHasBeenCompletedEvent.ResponseMessage.ShouldBe(TestData.ResponseMessage);
transactionHasBeenCompletedEvent.IsAuthorised.ShouldBe(TestData.IsAuthorised);
+ transactionHasBeenCompletedEvent.TransactionAmount.ShouldBe(TestData.TransactionAmount);
}
[Fact]
diff --git a/TransactionProcessor.TransactionAgrgegate/TransactionAggregate.cs b/TransactionProcessor.TransactionAgrgegate/TransactionAggregate.cs
index 90dd84fb..07063683 100644
--- a/TransactionProcessor.TransactionAgrgegate/TransactionAggregate.cs
+++ b/TransactionProcessor.TransactionAgrgegate/TransactionAggregate.cs
@@ -409,7 +409,8 @@ public void CompleteTransaction()
this.MerchantId,
this.ResponseCode,
this.ResponseMessage,
- this.IsAuthorised || this.IsLocallyAuthorised);
+ this.IsAuthorised || this.IsLocallyAuthorised,
+ this.TransactionType != TransactionType.Logon ? this.TransactionAmount : null);
this.ApplyAndPend(transactionHasBeenCompletedEvent);
}