Skip to content

Commit 2217620

Browse files
Merge pull request #325 from TransactionProcessing/task/#322_missing_integration_tests
Update packages and refactor response handling
2 parents c7c4418 + 95576bc commit 2217620

19 files changed

Lines changed: 1299 additions & 440 deletions

TransactionProcessorACL.BusinessLogic.Tests/TransactionProcessorACL.BusinessLogic.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
1414
<PackageReference Include="Moq" Version="4.20.72" />
1515
<PackageReference Include="Shouldly" Version="4.3.0" />
16-
<PackageReference Include="TransactionProcessor.Client" Version="2025.2.10" />
17-
<PackageReference Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2025.2.10" />
16+
<PackageReference Include="TransactionProcessor.Client" Version="2025.5.1" />
17+
<PackageReference Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2025.5.1" />
1818
<PackageReference Include="xunit" Version="2.9.3" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
2020
<PrivateAssets>all</PrivateAssets>

TransactionProcessorACL.BusinessLogic.Tests/TransactionProcessorACLApplicationServiceTests.cs

Lines changed: 41 additions & 21 deletions
Large diffs are not rendered by default.

TransactionProcessorACL.BusinessLogic/Services/TransactionProcessorACLApplicationService.cs

Lines changed: 126 additions & 70 deletions
Large diffs are not rendered by default.

TransactionProcessorACL.BusinessLogic/TransactionProcessorACL.BusinessLogic.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
<ItemGroup>
88
<PackageReference Include="MediatR" Version="12.4.1" />
9-
<PackageReference Include="SecurityService.Client" Version="2025.1.1" />
10-
<PackageReference Include="Shared" Version="2025.3.1" />
11-
<PackageReference Include="TransactionProcessor.Client" Version="2025.2.10" />
9+
<PackageReference Include="SecurityService.Client" Version="2025.5.1" />
10+
<PackageReference Include="Shared" Version="2025.5.4" />
11+
<PackageReference Include="TransactionProcessor.Client" Version="2025.5.1" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
@base @shared
2+
Feature: Merchants
3+
4+
Background:
5+
6+
Given the following security roles exist
7+
| Role Name |
8+
| Merchant |
9+
10+
Given I create the following api scopes
11+
| Name | DisplayName | Description |
12+
| estateManagement | Estate Managememt REST Scope | A scope for Estate Managememt REST |
13+
| transactionProcessor | Transaction Processor REST Scope | A scope for Transaction Processor REST |
14+
| transactionProcessorACL | Transaction Processor ACL REST Scope | A scope for Transaction Processor ACL REST |
15+
16+
Given the following api resources exist
17+
| Name | DisplayName | Secret | Scopes | UserClaims |
18+
| estateManagement | Estate Managememt REST | Secret1 | estateManagement | merchantId, estateId, role |
19+
| transactionProcessor | Transaction Processor REST | Secret1 | transactionProcessor | |
20+
| transactionProcessorACL | Transaction Processor ACL REST | Secret1 | transactionProcessorACL | merchantId, estateId, role |
21+
22+
Given the following clients exist
23+
| ClientId | ClientName | Secret | Scopes | GrantTypes |
24+
| serviceClient | Service Client | Secret1 | estateManagement,transactionProcessor,transactionProcessorACL | client_credentials |
25+
| merchantClient | Merchant Client | Secret1 | transactionProcessorACL | password |
26+
27+
Given I have a token to access the estate management and transaction processor acl resources
28+
| ClientId |
29+
| serviceClient |
30+
31+
Given I have created the following estates
32+
| EstateName |
33+
| Test Estate 1 |
34+
| Test Estate 2 |
35+
36+
Given I have created the following operators
37+
| EstateName | OperatorName | RequireCustomMerchantNumber | RequireCustomTerminalNumber |
38+
| Test Estate 1 | Safaricom | True | True |
39+
| Test Estate 1 | Voucher | True | True |
40+
| Test Estate 2 | Safaricom | True | True |
41+
| Test Estate 2 | Voucher | True | True |
42+
43+
And I have assigned the following operators to the estates
44+
| EstateName | OperatorName |
45+
| Test Estate 1 | Safaricom |
46+
| Test Estate 1 | Voucher |
47+
| Test Estate 2 | Safaricom |
48+
| Test Estate 2 | Voucher |
49+
50+
Given I create the following merchants
51+
| MerchantName | AddressLine1 | Town | Region | Country | ContactName | EmailAddress | EstateName |
52+
| Test Merchant 1 | Address Line 1 | TestTown | Test Region | United Kingdom | Test Contact 1 | testcontact1@merchant1.co.uk | Test Estate 1 |
53+
| Test Merchant 2 | Address Line 1 | TestTown | Test Region | United Kingdom | Test Contact 2 | testcontact2@merchant2.co.uk | Test Estate 1 |
54+
| Test Merchant 3 | Address Line 1 | TestTown | Test Region | United Kingdom | Test Contact 3 | testcontact3@merchant2.co.uk | Test Estate 2 |
55+
56+
Given I have assigned the following operator to the merchants
57+
| OperatorName | MerchantName | MerchantNumber | TerminalNumber | EstateName |
58+
| Safaricom | Test Merchant 1 | 00000001 | 10000001 | Test Estate 1 |
59+
| Voucher | Test Merchant 1 | 00000001 | 10000001 | Test Estate 1 |
60+
| Safaricom | Test Merchant 2 | 00000002 | 10000002 | Test Estate 1 |
61+
| Voucher | Test Merchant 2 | 00000002 | 10000002 | Test Estate 1 |
62+
| Safaricom | Test Merchant 3 | 00000003 | 10000003 | Test Estate 2 |
63+
| Voucher | Test Merchant 3 | 00000003 | 10000003 | Test Estate 2 |
64+
65+
Given I have created the following security users
66+
| EmailAddress | Password | GivenName | FamilyName | EstateName | MerchantName |
67+
| merchantuser@testmerchant1.co.uk | 123456 | TestMerchant | User1 | Test Estate 1 | Test Merchant 1 |
68+
| merchantuser@testmerchant2.co.uk | 123456 | TestMerchant | User2 | Test Estate 1 | Test Merchant 2 |
69+
| merchantuser@testmerchant3.co.uk | 123456 | TestMerchant | User3 | Test Estate 2 | Test Merchant 3 |
70+
71+
Given I create a contract with the following values
72+
| EstateName | OperatorName | ContractDescription |
73+
| Test Estate 1 | Safaricom | Safaricom Contract |
74+
| Test Estate 1 | Voucher | Hospital 1 Contract |
75+
| Test Estate 2 | Safaricom | Safaricom Contract |
76+
| Test Estate 2 | Voucher | Hospital 1 Contract |
77+
78+
When I create the following Products
79+
| EstateName | OperatorName | ContractDescription | ProductName | DisplayText | Value | ProductType |
80+
| Test Estate 1 | Safaricom | Safaricom Contract | Variable Topup | Custom | | MobileTopup |
81+
| Test Estate 1 | Voucher | Hospital 1 Contract | 10 KES | 10 KES | | Voucher |
82+
| Test Estate 2 | Safaricom | Safaricom Contract | Variable Topup | Custom | | MobileTopup |
83+
| Test Estate 2 | Voucher | Hospital 1 Contract | 10 KES | 10 KES | | Voucher |
84+
85+
When I add the following Transaction Fees
86+
| EstateName | OperatorName | ContractDescription | ProductName | CalculationType | FeeDescription | Value |
87+
| Test Estate 1 | Safaricom | Safaricom Contract | Variable Topup | Fixed | Merchant Commission | 2.50 |
88+
| Test Estate 2 | Safaricom | Safaricom Contract | Variable Topup | Percentage | Merchant Commission | 0.85 |
89+
90+
When I add the following contracts to the following merchants
91+
| EstateName | MerchantName | ContractDescription |
92+
| Test Estate 1 | Test Merchant 1 | Safaricom Contract |
93+
| Test Estate 1 | Test Merchant 1 | Hospital 1 Contract |
94+
| Test Estate 1 | Test Merchant 2 | Safaricom Contract |
95+
| Test Estate 1 | Test Merchant 2 | Hospital 1 Contract |
96+
| Test Estate 2 | Test Merchant 3 | Safaricom Contract |
97+
| Test Estate 2 | Test Merchant 3 | Hospital 1 Contract |
98+
99+
100+
Scenario: Get Merchant
101+
Given I am logged in as "[email protected]" with password "123456" for Merchant "Test Merchant 1" for Estate "Test Estate 1" with client "merchantClient"
102+
When I get the merchant information for Merchant "Test Merchant 1" for Estate "Test Estate 1" the response should contain the following information
103+
| MerchantName | AddressLine1 | Town | Region | Country | ContactName | EmailAddress |
104+
| Test Merchant 1 | Address Line 1 | TestTown | Test Region | United Kingdom | Test Contact 1 | testcontact1@merchant1.co.uk |
105+
106+
Scenario: Get Merchant Contracts
107+
Given I am logged in as "[email protected]" with password "123456" for Merchant "Test Merchant 1" for Estate "Test Estate 1" with client "merchantClient"
108+
When I get the merchant contract information for Merchant "Test Merchant 1" for Estate "Test Estate 1" the response should contain the following information
109+
| MerchantName | ContractDescription |
110+
| Test Merchant 1 | Safaricom Contract |
111+
| Test Merchant 1 | Hospital 1 Contract |

0 commit comments

Comments
 (0)