Skip to content

Commit

Permalink
[PAGOPA-1163] add psp business name: first impl
Browse files Browse the repository at this point in the history
  • Loading branch information
pagopa-github-bot authored and aacitelli committed Aug 23, 2023
1 parent 0488dc9 commit f4f2779
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 11 deletions.
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-marketplace
description: Microservice that handles marketplace for pagoPA Advanced Fees Management
type: application
version: 0.17.0
appVersion: 0.13.2
version: 0.18.0
appVersion: 0.13.3
dependencies:
- name: microservice-chart
version: 1.21.0
Expand Down
4 changes: 2 additions & 2 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-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -98,7 +98,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
envConfig: {}
envSecret: {}
4 changes: 2 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-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -98,7 +98,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
envConfig: {}
envSecret: {}
4 changes: 2 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-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -98,7 +98,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-afm-marketplace-be
tag: "0.13.2"
tag: "0.13.3"
pullPolicy: Always
envConfig: {}
envSecret: {}
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": "Marketplace API for PagoPA AFM",
"description": "marketplace-be",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.13.2"
"version": "0.13.3"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>it.pagopa.afm</groupId>
<artifactId>marketplace-be</artifactId>
<version>0.13.2</version>
<version>0.13.3</version>
<name>marketplace-be</name>
<description>Marketplace API for PagoPA AFM</description>

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/it/pagopa/afm/marketplacebe/entity/Bundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class Bundle {

@NotNull
private String abi;

@NotNull
private String pspBusinessName;

private Boolean digitalStamp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class BundleRequest {
@NotNull
private String abi;
private String name;
@NotNull
private String pspBusinessName;
private String description;
private Long paymentAmount;
private Long minPaymentAmount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private Bundle generateBundle(String idPsp, BundleRequest bundleRequest) {
.idCdi(bundleRequest.getIdCdi())
.abi(bundleRequest.getAbi())
.name(bundleRequest.getName())
.pspBusinessName(bundleRequest.getPspBusinessName())
.description(bundleRequest.getDescription())
.paymentAmount(bundleRequest.getPaymentAmount())
.minPaymentAmount(bundleRequest.getMinPaymentAmount())
Expand Down Expand Up @@ -235,6 +236,7 @@ public Bundle updateBundle(String idPsp, String idBundle, BundleRequest bundleRe
bundle.setIdCdi(bundleRequest.getIdCdi());
bundle.setAbi(bundleRequest.getAbi());
bundle.setName(bundleRequest.getName());
bundle.setPspBusinessName(bundleRequest.getPspBusinessName());
bundle.setDescription(bundleRequest.getDescription());
bundle.setPaymentAmount(bundleRequest.getPaymentAmount());
bundle.setMinPaymentAmount(bundleRequest.getMinPaymentAmount());
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/it/pagopa/afm/marketplacebe/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static BundleRequest getMockBundleRequest() {
.idCdi(null)
.abi("abi")
.name("name")
.pspBusinessName("business name")
.description("description")
.paymentAmount(100L)
.minPaymentAmount(0L)
Expand Down Expand Up @@ -152,6 +153,7 @@ public static List<BundleRequest> getMockBundleRequestList() {
.idCdi("idCdi")
.abi("abi")
.name("name")
.pspBusinessName("business name 0")
.description("description")
.paymentAmount(100L)
.minPaymentAmount(0L)
Expand All @@ -171,6 +173,7 @@ public static List<BundleRequest> getMockBundleRequestList() {
.idCdi("idCdi")
.abi("abi")
.name("name")
.pspBusinessName("business name 1")
.description("description")
.paymentAmount(200L)
.minPaymentAmount(0L)
Expand All @@ -190,6 +193,7 @@ public static List<BundleRequest> getMockBundleRequestList() {
.idCdi("idCdi")
.abi("abi")
.name("name")
.pspBusinessName("business name 2")
.description("description")
.paymentAmount(300L)
.minPaymentAmount(0L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -190,6 +191,7 @@ void shouldCreateBundle() {

Mockito.verify(bundleRepository, times(1)).save(Mockito.any());
assertEquals(bundleRequest.getName(), bundleArgumentCaptor.getValue().getName());
assertEquals(bundleRequest.getPspBusinessName(), bundleArgumentCaptor.getValue().getPspBusinessName());
}

@Test
Expand Down Expand Up @@ -1161,6 +1163,7 @@ void updateBundle_ok_1() {

Bundle result = bundleService.updateBundle(TestUtil.getMockIdPsp(), bundle.getId(), TestUtil.getMockBundleRequest());
assertNotNull(result);
assertEquals(result.getPspBusinessName(), TestUtil.getMockBundleRequest().getPspBusinessName());
}

@Test
Expand Down Expand Up @@ -1286,10 +1289,19 @@ void createBundleByList_ok() {
when(touchpointRepository.findByName(anyString())).thenReturn(Optional.of(TestUtil.getMockTouchpoint()));
when(paymentTypeRepository.findByName(anyString()))
.thenReturn(Optional.of(TestUtil.getMockPaymentType()));

List<BundleResponse> result = bundleService.createBundleByList(TestUtil.getMockIdPsp(), TestUtil.getMockBundleRequestList());
assertNotNull(result);
assertEquals(3,result.size());

@SuppressWarnings("unchecked")
ArgumentCaptor<Iterable<Bundle>> captor = ArgumentCaptor.forClass(Iterable.class);
verify(bundleRepository, times(1)).saveAll(captor.capture());

Iterator<Bundle> iter = captor.getAllValues().get(0).iterator();
assertEquals(iter.next().getPspBusinessName(), TestUtil.getMockBundleRequestList().get(0).getPspBusinessName());
assertEquals(iter.next().getPspBusinessName(), TestUtil.getMockBundleRequestList().get(1).getPspBusinessName());
assertEquals(iter.next().getPspBusinessName(), TestUtil.getMockBundleRequestList().get(2).getPspBusinessName());
}

@Test
Expand Down

0 comments on commit f4f2779

Please sign in to comment.