Skip to content

Commit

Permalink
Merge pull request #291 from pagopa/PAGOPA-1558-add-cf-all-get-psps
Browse files Browse the repository at this point in the history
[PAGOPA-1558] feat: Add PSP tax code to get channel psp API
  • Loading branch information
FedericoRuzzier committed Feb 27, 2024
2 parents f07dbcb + 5077e20 commit 2fe624a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 29 deletions.
12 changes: 8 additions & 4 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -18147,7 +18147,7 @@
},
"config_description": {
"type": "string",
"example": " default millisecondi validità token"
"example": " default millisecondi validità token"
}
}
},
Expand Down Expand Up @@ -18648,7 +18648,7 @@
},
"config_description": {
"type": "string",
"example": " default millisecondi validità token"
"example": " default millisecondi validità token"
},
"config_category": {
"type": "string",
Expand Down Expand Up @@ -19574,7 +19574,8 @@
"business_name",
"enabled",
"payment_types",
"psp_code"
"psp_code",
"tax_code"
],
"type": "object",
"properties": {
Expand All @@ -19592,6 +19593,9 @@
"items": {
"type": "string"
}
},
"tax_code": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -19793,4 +19797,4 @@
}
}
}
}
}
10 changes: 7 additions & 3 deletions openapi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14395,13 +14395,17 @@
},
"psp_code": {
"type": "string"
},
"tax_code": {
"type": "string"
}
},
"required": [
"business_name",
"enabled",
"payment_types",
"psp_code"
"psp_code",
"tax_code"
],
"type": "object"
},
Expand Down Expand Up @@ -14472,7 +14476,7 @@
"type": "string"
},
"config_description": {
"example": " default millisecondi validità token",
"example": " default millisecondi validità token",
"type": "string"
},
"config_key": {
Expand All @@ -14494,7 +14498,7 @@
"ConfigurationKeyBase": {
"properties": {
"config_description": {
"example": " default millisecondi validità token",
"example": " default millisecondi validità token",
"type": "string"
},
"config_value": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ public class ChannelPsp {
// should be @NotEmpty for requests, but it is not compatible for responses
// check on empty request is managed in the service method
private List<String> paymentTypeList;

@JsonProperty("tax_code")
@Schema(required = true)
@NotNull
private String taxCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -388,26 +388,27 @@ private List<String> getPaymentTypeList(List<CanaleTipoVersamento> type) {
.collect(Collectors.toList());
}

/**
* Maps PSP objects stored in the DB in a List of PaymentServiceProvider
*
* @param page page of PSP returned from the database
* @param channelCode id of the channel
* @return a list of {@link PaymentServiceProvider}.
*/
private List<ChannelPsp> getPspList(Page<Psp> page, String channelCode) {
return page.stream()
.map(
elem -> {
var psp = modelMapper.map(elem, PaymentServiceProvider.class);
return ChannelPsp.builder()
.pspCode(psp.getPspCode())
.enabled(psp.getEnabled())
.businessName(psp.getBusinessName())
.paymentTypeList(
mapPaymentType(elem.getPspCanaleTipoVersamentoList(), channelCode))
.build();
})
.collect(Collectors.toList());
}
/**
* Maps PSP objects stored in the DB in a List of PaymentServiceProvider
*
* @param page page of PSP returned from the database
* @param channelCode id of the channel
* @return a list of {@link PaymentServiceProvider}.
*/
private List<ChannelPsp> getPspList(Page<Psp> page, String channelCode) {
return page.stream()
.map(
elem -> {
var psp = modelMapper.map(elem, PaymentServiceProvider.class);
return ChannelPsp.builder()
.pspCode(psp.getPspCode())
.enabled(psp.getEnabled())
.businessName(psp.getBusinessName())
.taxCode(psp.getTaxCode())
.paymentTypeList(
mapPaymentType(elem.getPspCanaleTipoVersamentoList(), channelCode))
.build();
})
.collect(Collectors.toList());
}
}

0 comments on commit 2fe624a

Please sign in to comment.