Skip to content

Commit

Permalink
[PAGOPA-1327] psp whitelist: fix the integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
aacitelli authored and alessio-acitelli committed Feb 7, 2024
1 parent 95897e6 commit 19f54e5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
22 changes: 11 additions & 11 deletions integration-test/src/config/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"bundles": [
{
"id": "int-test-1",
"idPsp": "88888888888",
"idPsp": "PPAYITR1XXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -22,7 +22,7 @@
},
{
"id": "int-test-2",
"idPsp": "88888888888",
"idPsp": "PPAYITR1XXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -42,7 +42,7 @@
},
{
"id": "int-test-3",
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -63,7 +63,7 @@
},
{
"id": "int-test-4",
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -86,7 +86,7 @@
},
{
"id": "int-test-5",
"idPsp": "88888888888",
"idPsp": "PPAYITR1XXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -111,7 +111,7 @@
},
{
"id": "int-test-6",
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": false,
Expand All @@ -131,7 +131,7 @@
},
{
"id": "int-test-7",
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": true,
Expand All @@ -151,7 +151,7 @@
},
{
"id": "int-test-8",
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": true,
Expand All @@ -171,7 +171,7 @@
},
{
"id": "int-test-9",
"idPsp": "BPPIITRRZZZ",
"idPsp": "CIPBITMM",
"idBrokerPsp": "14847241008",
"idChannel": "88888888899_01_ONUS",
"digitalStamp": true,
Expand All @@ -191,9 +191,9 @@
},
{
"id": "int-test-10",
"idPsp": "AMEX",
"idPsp": "UNCRITMM",
"idBrokerPsp": "88888888899",
"idChannel": "AMEX_ONUS",
"idChannel": "UNCRITMM_ONUS",
"digitalStamp": false,
"digitalStampRestriction": false,
"name": "pacchetto 10",
Expand Down
32 changes: 16 additions & 16 deletions integration-test/src/features/getFeeByPsp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888888/fees
When the client send POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And check response body is
"""
Expand All @@ -40,7 +40,7 @@ Feature: GetFeeByPsp
"bundleName": "pacchetto 1",
"bundleDescription": "pacchetto 1",
"idCiBundle": "int-test-1",
"idPsp": "88888888888",
"idPsp": "PPAYITR1XXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"onUs": false,
Expand Down Expand Up @@ -71,7 +71,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888888/fees
When the client send POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
Expand All @@ -97,15 +97,15 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
| false |
| false |
| false |
| true |

Scenario: Get List of fees by CI, amount, touchpoint and single PSP
Given initial json
Expand All @@ -127,15 +127,15 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
| false |
| false |
| false |
| true |

Scenario: Get List of fees by CI, amount, touchpoint and single PSP 2
Given initial json
Expand All @@ -159,7 +159,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And check response body is
"""
Expand All @@ -175,7 +175,7 @@ Feature: GetFeeByPsp
"bundleName": "pacchetto 7",
"bundleDescription": "pacchetto 7",
"idCiBundle": null,
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idBrokerPsp": "88888888899",
"idChannel": "88888888899_01_ONUS",
"onUs": false,
Expand Down Expand Up @@ -208,7 +208,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
Expand All @@ -235,15 +235,15 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
| false |
| false |
| false |
| true |

Scenario: Get fee by psp with non-existing bin
Given initial json
Expand All @@ -265,7 +265,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/88888888889/fees
When the client send POST to /psps/BPPIITRRXXX/fees
Then check statusCode is 200
And check response body is
"""
Expand Down Expand Up @@ -296,7 +296,7 @@ Feature: GetFeeByPsp
]
}
"""
When the client send POST to /psps/AMEX/fees
When the client send POST to /psps/UNCRITMM/fees
Then check statusCode is 200
And check response body is
"""
Expand All @@ -312,9 +312,9 @@ Feature: GetFeeByPsp
"bundleName": "pacchetto 10",
"bundleDescription": "pacchetto 10",
"idCiBundle": null,
"idPsp": "AMEX",
"idPsp": "UNCRITMM",
"idBrokerPsp": "88888888899",
"idChannel": "AMEX_ONUS",
"idChannel": "UNCRITMM_ONUS",
"onUs": true,
"abi": "AMREX",
"pspBusinessName": "psp business name int-test-10"
Expand Down
8 changes: 4 additions & 4 deletions integration-test/src/features/getFees.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
| true |
| false |
| false |
| false |
| false |
| false |
| false |

Scenario: Get List of fees by CI, amount, method and single PSP
Given initial json
Expand Down Expand Up @@ -144,7 +144,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"bin": "309500",
"paymentMethod": null,
"touchpoint": "IO",
"idPspList": [{"idPsp":"88888888889"}],
"idPspList": [{"idPsp":"BPPIITRRXXX"}],
"transferList": [
{
"creditorInstitution": "77777777777",
Expand Down Expand Up @@ -175,7 +175,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"bundleName": "pacchetto 7",
"bundleDescription": "pacchetto 7",
"idCiBundle": null,
"idPsp": "88888888889",
"idPsp": "BPPIITRRXXX",
"idChannel": "88888888899_01_ONUS",
"idBrokerPsp": "88888888899",
"onUs": false,
Expand Down Expand Up @@ -245,13 +245,13 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
| true |
| false |
| false |
| false |
| false |
| false |
| false |


Scenario: Execute a GetFees request with non-existing bin
Expand Down
5 changes: 5 additions & 0 deletions integration-test/src/step_definitions/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ Then(/^check response body is$/, function(payload) {
});

Then('the body response ordering for the bundleOptions.onUs field is:', function (dataTable) {
// force the obtained list to be sorted by onUs field value
responseToCheck.data.bundleOptions.sort(function (a, b) {
// true values first
return (a.onUs === b.onUs)? 0 : a.onUs? -1 : 1;
});
for (let i=0; i<responseToCheck.data.bundleOptions.length; i++){
let bodyOnUs = responseToCheck.data.bundleOptions[i].onUs;
let checkOnUs = JSON.parse(dataTable.rows()[i][0]);
Expand Down

0 comments on commit 19f54e5

Please sign in to comment.