Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:[PagoPa-1147] AMEX filter #99

Merged
merged 9 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-afm-calculator
description: Microservice that handles calculation for pagoPA Advanced Fees Management
type: application
version: 2.23.0
appVersion: 2.6.5
version: 2.24.0
appVersion: 2.6.6
dependencies:
- name: microservice-chart
version: 1.21.0
Expand Down
7 changes: 4 additions & 3 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -69,7 +69,8 @@ microservice-chart:
COSMOS_URI: https://pagopa-d-weu-afm-marketplace-cosmos-account.documents.azure.com:443/
ISSUER_RANGE_TABLE: 'pagopadweuafmsaissuerrangetable'
AMOUNT_THRESHOLD: '0'
ID_PSP_POSTE: 'POSTE1'
ID_PSP_POSTE: 'BPPIITRRZZZ'
AMEX_ABI: '36019'
ELASTIC_APM_SERVICE_NAME: pagopa-afm-calculator
ELASTIC_APM_APPLICATION_PACKAGES: it.gov.pagopa.afm.calculator
ELASTIC_APM_SERVER_URL: http://quickstart-apm-http.elastic-system.svc:8200
Expand Down Expand Up @@ -109,7 +110,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
envConfig:
envSecret:
5 changes: 3 additions & 2 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -70,6 +70,7 @@ microservice-chart:
ISSUER_RANGE_TABLE: 'pagopapweuafmsaissuerrangetable'
AMOUNT_THRESHOLD: '0'
ID_PSP_POSTE: 'BPPIITRRXXX'
AMEX_ABI: '36019'
ELASTIC_APM_SERVICE_NAME: pagopa-afm-calculator
ELASTIC_APM_APPLICATION_PACKAGES: it.gov.pagopa.afm.calculator
ELASTIC_APM_SERVER_URL: http://quickstart-apm-http.elastic-system.svc:8200
Expand Down Expand Up @@ -108,7 +109,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
envConfig:
envSecret:
5 changes: 3 additions & 2 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -70,6 +70,7 @@ microservice-chart:
ISSUER_RANGE_TABLE: 'pagopauweuafmsaissuerrangetable'
AMOUNT_THRESHOLD: '0'
ID_PSP_POSTE: 'BPPIITRRXXX'
AMEX_ABI: '36019'
ELASTIC_APM_SERVICE_NAME: pagopa-afm-calculator
ELASTIC_APM_APPLICATION_PACKAGES: it.gov.pagopa.afm.calculator
ELASTIC_APM_SERVER_URL: http://quickstart-apm-http.elastic-system.svc:8200
Expand Down Expand Up @@ -108,7 +109,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
tag: "2.6.5"
tag: "2.6.6"
pullPolicy: Always
envConfig:
envSecret:
3 changes: 2 additions & 1 deletion integration-test/src/config/.env.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
AFM_HOST=https://api.dev.platform.pagopa.it/afm/calculator-service/v1
ID_PSP_POSTE=BPPIITRRZZZ
ID_PSP_POSTE=BPPIITRRZZZ
AMEX_ABI=36019
2 changes: 2 additions & 0 deletions integration-test/src/config/.env.local
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
AFM_HOST=http://localhost:8080
ID_PSP_POSTE=BPPIITRRZZZ
AMEX_ABI=36019
3 changes: 2 additions & 1 deletion integration-test/src/config/.env.uat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
AFM_HOST=https://api.uat.platform.pagopa.it/afm/calculator-service/v1
ID_PSP_POSTE=BPPIITRRXXX
ID_PSP_POSTE=BPPIITRRXXX
AMEX_ABI=36019
19 changes: 19 additions & 0 deletions integration-test/src/config/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@
"validityDateTo": null,
"paymentType": null,
"abi": 14156
},
{
"id": "int-test-10",
"idPsp": "AMEX",
"idBrokerPsp": "88888888899",
"idChannel": "AMEX_ONUS",
"digitalStamp": false,
"digitalStampRestriction": false,
"name": "pacchetto 10",
"description": "pacchetto 10",
"paymentAmount": 999999999999990,
"minPaymentAmount": 0,
"maxPaymentAmount": 999999999999999,
"type": "GLOBAL",
"validityDateFrom": null,
"validityDateTo": null,
"touchpoint": "ANY",
"paymentType": "CP",
"abi": 36019
}
],
"ciBundles": [
Expand Down
100 changes: 72 additions & 28 deletions integration-test/src/features/getFeeByPsp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ Feature: GetFeeByPsp
When the client send POST to /psps/88888888888/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| false |
| false |
| onUs |
| false |
| false |

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

| onUs |
| true |
| false |
| false |
| false |
| false |

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

| onUs |
| true |
| false |
| false |
| false |
| false |

Scenario: Get List of fees by CI, amount, touchpoint and single PSP 2
Given initial json
Expand Down Expand Up @@ -211,9 +209,9 @@ Feature: GetFeeByPsp
When the client send POST to /psps/88888888889/fees
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| false |
| false |
| onUs |
| false |
| false |

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

| onUs |
| true |
| false |
| false |
| false |
| false |

Scenario: Get fee by psp with non-existing bin
Given initial json
Expand Down Expand Up @@ -275,3 +272,50 @@ Feature: GetFeeByPsp
"bundleOptions":[]
}
"""

Scenario: Get List of fees by CI, amount, method, touchpoint and single PSP for AMEX payment
Given initial json
"""
{
"paymentAmount": 999999999999990,
"primaryCreditorInstitution": "77777777777",
"bin": "340000",
"paymentMethod": "CP",
"idPspList": null,
"transferList": [
{
"creditorInstitution": "77777777777",
"transferCategory": "TAX1"
},
{
"creditorInstitution": "77777777778",
"transferCategory": "TAX2"
}
]
}
"""
When the client send POST to /psps/AMEX/fees
Then check statusCode is 200
And check response body is
"""
{
"belowThreshold": false,
"bundleOptions": [
{
"taxPayerFee": 999999999999990,
"primaryCiIncurredFee": 0,
"paymentMethod": "CP",
"touchpoint": "ANY",
"idBundle": "int-test-10",
"bundleName": "pacchetto 10",
"bundleDescription": "pacchetto 10",
"idCiBundle": null,
"idPsp": "AMEX",
"idBrokerPsp": "88888888899",
"idChannel": "AMEX_ONUS",
"onUs": true,
"abi": "36019"
}
]
}
"""
30 changes: 29 additions & 1 deletion integration-test/src/features/getFees.feature
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,32 @@ Feature: GetFees - Get List of fees by CI, amount, method, touchpoint
"""
When the client send POST to /fees?maxOccurrences=10&allCcp=false
Then check statusCode is 200
And the body response does not contain the Poste idPsp
And the body response does not contain the Poste idPsp

Scenario: Execute a GetFees request for AMEX payment
Given initial json
"""
{
"paymentAmount": 999999999999998,
"primaryCreditorInstitution": "77777777777",
"bin": "340000",
"paymentMethod": "CP",
"touchpoint": "CHECKOUT",
"idPspList": null,
"transferList": [
{
"creditorInstitution": "77777777777",
"transferCategory": "TAX1"
},
{
"creditorInstitution": "77777777778",
"transferCategory": "TAX2"
}
]
}
"""
When the client send POST to /fees?maxOccurrences=10
Then check statusCode is 200
And the body response ordering for the bundleOptions.onUs field is:
| onUs |
| true |
13 changes: 13 additions & 0 deletions integration-test/src/step_definitions/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,24 @@ let isseuerEntity2 = {
ISSUER_ID: "100",
ABI: "14156"
};
let isseuerEntity3 = {
partitionKey: "340000",
rowKey: "321087",
LOW_RANGE: "3400000000000000000",
HIGH_RANGE: "3499999999999999999",
CIRCUIT: "AMEX",
PRODUCT_CODE: "99",
PRODUCT_TYPE: "3",
PRODUCT_CATEGORY: "C",
ISSUER_ID: "999999",
ABI: "36019"
};

// Synchronous
BeforeAll(function() {
tableStorageClient.setup(isseuerEntity1);
tableStorageClient.setup(isseuerEntity2);
tableStorageClient.setup(isseuerEntity3);
});

Given('the configuration {string}', async function(filePath) {
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi-node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic for Node",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "2.6.5"
"version": "2.6.6"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "2.6.5"
"version": "2.6.6"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>calculator</artifactId>
<version>2.6.5</version>
<version>2.6.6</version>
<name>afm-calculator</name>
<description>Calculator Logic microservice for pagoPA AFM</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public BundleOption getFeesByPsp(
@RequestBody @Valid PaymentOptionByPsp paymentOptionByPsp,
@RequestParam(required = false, defaultValue = "10") Integer maxOccurrences,
@RequestParam(required = false, defaultValue = "true")
@Parameter(
description =
"Flag for the exclusion of Poste bundles: false -> excluded, true or null ->"
+ " included")
String allCcp) {
@Parameter(
description =
"Flag for the exclusion of Poste bundles: false -> excluded, true or null ->"
+ " included")
String allCcp) {
PaymentOption paymentOption =
PaymentOption.builder()
.paymentAmount(paymentOptionByPsp.getPaymentAmount())
Expand All @@ -111,7 +111,8 @@ public BundleOption getFeesByPsp(
.transferList(paymentOptionByPsp.getTransferList())
.bin(paymentOptionByPsp.getBin())
.build();
return calculatorService.calculate(paymentOption, maxOccurrences, StringUtils.isBlank(allCcp) || Boolean.parseBoolean(allCcp));
return calculatorService.calculate(
paymentOption, maxOccurrences, StringUtils.isBlank(allCcp) || Boolean.parseBoolean(allCcp));
}

@Operation(
Expand Down Expand Up @@ -176,6 +177,7 @@ public BundleOption getFees(
"Flag for the exclusion of Poste bundles: false -> excluded, true or null ->"
+ " included")
String allCcp) {
return calculatorService.calculate(paymentOption, maxOccurrences, StringUtils.isBlank(allCcp) || Boolean.parseBoolean(allCcp));
return calculatorService.calculate(
paymentOption, maxOccurrences, StringUtils.isBlank(allCcp) || Boolean.parseBoolean(allCcp));
}
}
Loading