Skip to content

Commit

Permalink
PAGOPA-2348 fix integration test with new step
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoRuzzier committed Nov 8, 2024
1 parent b465dd5 commit 75e867c
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
51 changes: 45 additions & 6 deletions integration-test/src/features/getFeesByPspMulti.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
| "int-test-cart-1" |
Expand Down Expand Up @@ -56,6 +57,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
| "int-test-cart-2" |
Expand Down Expand Up @@ -96,6 +98,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
And the sum of the fees is correct and the EC codes are:
Expand Down Expand Up @@ -134,6 +137,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
And the sum of the fees is correct and the EC codes are:
Expand Down Expand Up @@ -162,6 +166,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
| "int-test-cart-6" |
Expand Down Expand Up @@ -202,6 +207,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle1 | idCiBundle2 |
| "int-test-cart-5" | "int-test-cart-6" |
Expand Down Expand Up @@ -242,15 +248,48 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle1 | idCiBundle2 |
| "int-test-cart-7" | "int-test-cart-8" |
| "int-test-cart-7" | "int-test-cart-8" |
| "int-test-cart-7" | "int-test-cart-8" |
| "int-test-cart-7" | "int-test-cart-8" |
And the sum of the fees is correct and the EC codes are:
| feeCode1 | feeCode2 |
| "77777777777" | "88888888888" |
| "77777777777" | "88888888888" |
| "77777777777" | "88888888888" |
| "77777777777" | "88888888888" |

Scenario: Multiple bundles are available, but only one is returned
Given initial json
"""
{
"bin": "309500",
"paymentMethod": "CP",
"touchpoint": "CHECKOUT",
"idPspList": null,
"paymentNotice": [
{
"primaryCreditorInstitution": "77777777777",
"paymentAmount": 899999999999987,
"transferList": [
{
"creditorInstitution": "77777777777",
"transferCategory": "TAX1"
}
]
}
]
}
"""
When the client send a V2 POST to /psps/PPAYITR1XXX/fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
| false |
And the body response for the bundleOptions.idsCiBundle field is:
| idCiBundle |
| "int-test-cart-10" |
| "int-test-cart-9" |
And the sum of the fees is correct and the EC codes are:
| feeCode |
| "77777777777" |
| "77777777777" |
9 changes: 9 additions & 0 deletions integration-test/src/features/getFeesMulti.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -64,6 +65,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -111,6 +113,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -154,6 +157,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -187,6 +191,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -232,6 +237,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -277,6 +283,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -322,6 +329,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down Expand Up @@ -357,6 +365,7 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send a V2 POST to /fees
Then check statusCode is 200
And the body response has one bundle for each psp
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
Expand Down
9 changes: 9 additions & 0 deletions integration-test/src/step_definitions/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ Then('the body response ordering for the bundleOptions.onUs field is:', function
}
});

Then('the body response has one bundle for each psp', function () {
const idPsps = [];
for (let i=0; i<responseToCheck.data.bundleOptions.length; i++){
assert(!idPsps.includes(responseToCheck.data.bundleOptions[i].idPsp));
idPsps.push(responseToCheck.data.bundleOptions[i].idPsp);
}
console.log(idPsps);
});

Then('the body response does not contain the Poste idPsp', function () {
for (let i=0; i<responseToCheck.data.bundleOptions.length; i++){
let bodyPsp = responseToCheck.data.bundleOptions[i].idPsp;
Expand Down

0 comments on commit 75e867c

Please sign in to comment.