Skip to content

Commit

Permalink
feat: added attachment mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
gianmarcoplutino committed Nov 27, 2024
1 parent 7a58ceb commit 15d2682
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,35 @@ public static Map<String, Object> setUpCommonData(
}

public static Map<String, Object> setUpAttachmentData(Onboarding onboarding) {
return new HashMap<>();
Map<String, Object> map = new HashMap<>();
if (Objects.nonNull(onboarding.getInstitution().getPaymentServiceProvider())) {
map.put(
"businessRegisterNumber",
onboarding.getInstitution().getPaymentServiceProvider().getBusinessRegisterNumber());
map.put(
"legalRegisterNumber",
onboarding.getInstitution().getPaymentServiceProvider().getLegalRegisterNumber());
map.put(
"legalRegisterName",
onboarding.getInstitution().getPaymentServiceProvider().getLegalRegisterName());
}

if (Objects.nonNull(onboarding.getInstitution().getGpuData())) {
map.put("manager", onboarding.getInstitution().getGpuData().isManager() ? "Si" : "No");
map.put(
"managerAuthorized",
onboarding.getInstitution().getGpuData().isManagerAuthorized() ? "Si" : "No");
map.put(
"managerEligible",
onboarding.getInstitution().getGpuData().isManagerEligible() ? "Si" : "No");
map.put(
"managerProsecution",
onboarding.getInstitution().getGpuData().isManagerProsecution() ? "Si" : "No");
map.put(
"institutionCourtMeasures",
onboarding.getInstitution().getGpuData().isInstitutionCourtMeasures() ? "Si" : "No");
}
return map;
}

private static String getMailManager(UserResource manager, String userMailUuid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,48 @@ private Onboarding createOnboarding() {
onboarding.setProductId("productId");
onboarding.setUsers(List.of());

createInstitution(onboarding);

User user = new User();
user.setId(UUID.randomUUID().toString());
user.setUserMailUuid("setUserMailUuid");
onboarding.setUsers(List.of(user));
return onboarding;
}

private static void createInstitution(Onboarding onboarding) {
Institution institution = new Institution();
institution.setInstitutionType(InstitutionType.PSP);
institution.setDescription("42");

PaymentServiceProvider paymentServiceProvider = createPaymentServiceProvider();
institution.setPaymentServiceProvider(paymentServiceProvider);

GPUData gpuData = createGpuData();
institution.setGpuData(gpuData);

institution.setRea("rea");
institution.setBusinessRegisterPlace("place");
institution.setShareCapital("10000");
onboarding.setInstitution(institution);
}

User user = new User();
user.setId(UUID.randomUUID().toString());
user.setUserMailUuid("setUserMailUuid");
onboarding.setUsers(List.of(user));
return onboarding;
private static GPUData createGpuData() {
GPUData gpuData = new GPUData();
gpuData.setManager(true);
gpuData.setManagerAuthorized(true);
gpuData.setManagerEligible(true);
gpuData.setManagerProsecution(true);
gpuData.setInstitutionCourtMeasures(true);
return gpuData;
}

private static PaymentServiceProvider createPaymentServiceProvider() {
PaymentServiceProvider paymentServiceProvider = new PaymentServiceProvider();
paymentServiceProvider.setBusinessRegisterNumber("businessRegisterNumber");
paymentServiceProvider.setLegalRegisterName("legalRegisterName");
paymentServiceProvider.setLegalRegisterNumber("legalRegisterNumber");
return paymentServiceProvider;
}

AggregateInstitution createAggregateInstitutionIO(int number) {
Expand Down
6 changes: 3 additions & 3 deletions apps/onboarding-ms/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2564,9 +2564,6 @@
"PaymentServiceProviderRequest" : {
"type" : "object",
"properties" : {
"abiCode" : {
"type" : "string"
},
"businessRegisterNumber" : {
"type" : "string"
},
Expand All @@ -2576,6 +2573,9 @@
"legalRegisterName" : {
"type" : "string"
},
"abiCode" : {
"type" : "string"
},
"vatNumberGroup" : {
"type" : "boolean"
},
Expand Down
4 changes: 2 additions & 2 deletions apps/onboarding-ms/src/main/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1893,14 +1893,14 @@ components:
PaymentServiceProviderRequest:
type: object
properties:
abiCode:
type: string
businessRegisterNumber:
type: string
legalRegisterNumber:
type: string
legalRegisterName:
type: string
abiCode:
type: string
vatNumberGroup:
type: boolean
providerNames:
Expand Down

0 comments on commit 15d2682

Please sign in to comment.