Skip to content

Commit

Permalink
PAGOPA-1733 change whitelist to blacklist for psp
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoRuzzier committed May 29, 2024
1 parent e663197 commit 4ad78a1
Show file tree
Hide file tree
Showing 10 changed files with 2,138 additions and 2,330 deletions.
729 changes: 350 additions & 379 deletions openapi/openapi-node-v1.json

Large diffs are not rendered by default.

813 changes: 389 additions & 424 deletions openapi/openapi-node-v2.json

Large diffs are not rendered by default.

1,341 changes: 636 additions & 705 deletions openapi/openapi-v1-dev-uat.json

Large diffs are not rendered by default.

729 changes: 350 additions & 379 deletions openapi/openapi-v1.json

Large diffs are not rendered by default.

813 changes: 389 additions & 424 deletions openapi/openapi-v2.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class CosmosRepository {

@Value("${pspPoste.id}")
private String pspPosteId;
@Value("#{'${psp.whitelist}'.split(',')}")
private List<String> pspWhitelist;

@Value("#{'${psp.blacklist}'.split(',')}")
private List<String> pspBlacklist;

private static final String ID_PSP_PARAM = "idPsp";

Expand Down Expand Up @@ -155,10 +155,10 @@ private Iterable<ValidBundle> findValidBundlesMulti(PaymentOptionMulti paymentOp
queryResult = and(queryResult, allCcpFilter);
}

// add filter for PSP whitelist
if (!CollectionUtils.isEmpty(pspWhitelist)) {
var pspIn = in(ID_PSP_PARAM, pspWhitelist);
queryResult = and(queryResult, pspIn);
// add filter for PSP blacklist
if (!CollectionUtils.isEmpty(pspBlacklist)) {
var pspNotIn = notIn(ID_PSP_PARAM, pspBlacklist);
queryResult = and(queryResult, pspNotIn);
}

// execute the query
Expand Down Expand Up @@ -248,11 +248,11 @@ private Iterable<ValidBundle> findValidBundles(PaymentOption paymentOption, bool
var allCcpFilter = isNotEqual(ID_PSP_PARAM, pspPosteId);
queryResult = and(queryResult, allCcpFilter);
}
// add filter for PSP whitelist
if (!CollectionUtils.isEmpty(pspWhitelist)) {
var pspIn = in(ID_PSP_PARAM, pspWhitelist);
queryResult = and(queryResult, pspIn);

// add filter for PSP blacklist
if (!CollectionUtils.isEmpty(pspBlacklist)) {
var pspNotIn = notIn(ID_PSP_PARAM, pspBlacklist);
queryResult = and(queryResult, pspNotIn);
}

// execute the query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public static <T> Criteria in(String param, List<T> values) {
CriteriaType.IN, param, Collections.singletonList(values), Part.IgnoreCaseType.ALWAYS);
}

public static <T> Criteria notIn(String param, List<T> values) {
return Criteria.getInstance(
CriteriaType.NOT_IN, param, Collections.singletonList(values), Part.IgnoreCaseType.ALWAYS);
}

public static <T> Criteria arrayContains(String param, T value) {
return Criteria.getInstance(
CriteriaType.ARRAY_CONTAINS,
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ table.issuer-range=issuerrangetable
cache.enabled=false

# Business config
payment.amount.threshold=0
payment.amount.threshold=0

# PSP Poste
pspPoste.id=BPPIITRRZZZ

# AMEX (American Express) payment ABI
pspAmex.abi=AMREX

# PSP whitelist to manage which bundles must be filtered
psp.whitelist=PPAYITR1XXX,BPPIITRRXXX,CIPBITMM,UNCRITMM,BNLIITRR,BCITITMM,BIC36019
# PSP blacklist to manage which bundles must be filtered
psp.blacklist=
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ pspPoste.id=${ID_PSP_POSTE}
# AMEX (American Express) payment ABI
pspAmex.abi=${AMEX_ABI}

# PSP whitelist to manage which bundles must be filtered
psp.whitelist=${PSP_WHITELIST}
# PSP blacklist to manage which bundles must be filtered
psp.blacklist=${PSP_BLACKLIST}
4 changes: 2 additions & 2 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ payment.amount.threshold=0
# PSP Poste
pspPoste.id=testIdPspPoste

# PSP whitelist to manage which bundles must be filtered
psp.whitelist=PPAYITR1XXX,BPPIITRRXXX,CIPBITMM,UNCRITMM,BNLIITRR,BCITITMM,BIC36019,SIGPITM1XXX
# PSP blacklist to manage which bundles must be filtered
psp.blacklist=

# Openapi
springdoc.writer-with-order-by-keys=false
Expand Down

0 comments on commit 4ad78a1

Please sign in to comment.