Skip to content

Commit

Permalink
Merge branch 'feature/SELC-5779' into releases/0.4.0_user_fd_notifica…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
andrea-putzu committed Oct 15, 2024
2 parents 4e776d0 + c8c2135 commit ed58da4
Show file tree
Hide file tree
Showing 73 changed files with 2,489 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- reopened
- ready_for_review
paths:
- './libs/**'
- 'libs/**'
- '.github/workflows/pr_libs.yml'
- '.github/workflows/call_code_review.yml'

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,19 @@ and usage of a couple of lesser known command line switches.
| Change version of `onboarding-sdk` | `.` | `mvn versions:set -DnewVersion=0.2.2 --projects :onboarding-sdk-pom ` |
| Persist version of `onboarding-sdk` | `.` | `mvn versions:commit ` |

-----

## Java formatter installation (Intellij)

1. Open plugins window (CTRL+Shift+A or CMD+Shift+A) and type "plugins"
2. Click on browse repositories.
3. Search for google-java-format and install it
4. Restart the IDE.

To enable the plugin executing the action (CTRL+Shift+A or CMD+Shift+A) ant type: Reformat with google-java-format

Enable auto-format on save:

1. File -> Settings -> Tools or CTRL+Alt+S/CMD+Alt+S -> Tools
2. Click on "Action on Save"
3. Enable: "Reformat Code"
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@
"USERS_IMPORT",
"CONTRACT_REGISTRATION_AGGREGATOR",
"CONFIRMATION_AGGREGATE",
"INCREMENT_REGISTRATION_AGGREGATOR"
"INCREMENT_REGISTRATION_AGGREGATOR",
"USERS_PG"
],
"type": "string"
},
Expand Down
6 changes: 3 additions & 3 deletions apps/onboarding-functions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@
<dependency>
<groupId>it.pagopa.selfcare</groupId>
<artifactId>onboarding-sdk-crypto</artifactId>
<version>0.3.0</version>
<version>0.3.3</version>
</dependency>
<dependency>
<groupId>it.pagopa.selfcare</groupId>
<artifactId>onboarding-sdk-azure-storage</artifactId>
<version>0.3.0</version>
<version>0.3.3</version>
</dependency>
<dependency>
<groupId>it.pagopa.selfcare</groupId>
<artifactId>onboarding-sdk-product</artifactId>
<version>0.3.0</version>
<version>0.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
package it.pagopa.selfcare.onboarding.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import it.pagopa.selfcare.onboarding.utils.CustomOffsetDateTimeSerializer;

import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class NotificationUserToSend {

private String id;
private String institutionId;
private String product;
private String state;
private String filePath;
private String fileName;
private String contentType;
private String onboardingTokenId;
private String pricingPlan;
private BillingToSend billing;
@JsonSerialize(using = CustomOffsetDateTimeSerializer.class)
private OffsetDateTime createdAt;
@JsonSerialize(using = CustomOffsetDateTimeSerializer.class)
private OffsetDateTime closedAt;
@JsonSerialize(using = CustomOffsetDateTimeSerializer.class)
private OffsetDateTime updatedAt;
private QueueUserEvent notificationType;
private NotificationUserType type;
private UserToNotify user;


public String getInstitutionId() {
return institutionId;
}

public void setInstitutionId(String institutionId) {
this.institutionId = institutionId;
}


public NotificationUserType getType() {
return type;
}

public void setType(NotificationUserType type) {
this.type = type;
}


public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getFilePath() {
return filePath;
}

public void setFilePath(String filePath) {
this.filePath = filePath;
}

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
}

public String getContentType() {
return this.contentType;
}

public void setContentType(String contractSigned) {
String contractFileName = Objects.isNull(contractSigned) ? "" : Paths.get(contractSigned).getFileName().toString();
if (contractFileName.isEmpty()) {
this.contentType = "";
} else if (contractFileName.endsWith(".p7m")) {
this.contentType = "application/pkcs7-mime";
} else if (contractFileName.endsWith(".pdf")) {
this.contentType = "application/pdf";
} else {
this.contentType = "application/octet-stream";
}
}

public String getOnboardingTokenId() {
return onboardingTokenId;
}

public void setOnboardingTokenId(String onboardingTokenId) {
this.onboardingTokenId = onboardingTokenId;
}

public OffsetDateTime getClosedAt() {
return closedAt;
}

public void setClosedAt(OffsetDateTime closedAt) {
this.closedAt = closedAt;
}

public QueueUserEvent getNotificationType() {
return notificationType;
}

public void setNotificationType(QueueUserEvent notificationType) {
this.notificationType = notificationType;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getProduct() {
return product;
}

public void setProduct(String product) {
this.product = product;
}

public String getPricingPlan() {
return pricingPlan;
}

public void setPricingPlan(String pricingPlan) {
this.pricingPlan = pricingPlan;
}

public BillingToSend getBilling() {
return billing;
}

public void setBilling(BillingToSend billing) {
this.billing = billing;
}

public OffsetDateTime getCreatedAt() {
return createdAt;
}

public void setCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
}

public OffsetDateTime getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}

public UserToNotify getUser() {
return user;
}

public void setUser(UserToNotify user) {
this.user = user;
}

@Override
public String toString() {
return "NotificationToSend{" +
"id='" + id + '\'' +
", institutionId='" + institutionId + '\'' +
", product='" + product + '\'' +
", state='" + state + '\'' +
", filePath='" + filePath + '\'' +
", fileName='" + fileName + '\'' +
", contentType='" + contentType + '\'' +
", onboardingTokenId='" + onboardingTokenId + '\'' +
", pricingPlan='" + pricingPlan + '\'' +
", billing=" + billing +
", createdAt=" + createdAt +
", closedAt=" + closedAt +
", updatedAt=" + updatedAt +
", notificationType=" + notificationType +
", userId=" + user.getUserId() +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package it.pagopa.selfcare.onboarding.dto;

public enum NotificationUserType {
ADD_INSTITUTE(QueueUserEvent.ADD_INSTITUTE),
UPDATE_INSTITUTION(QueueUserEvent.UPDATE_INSTITUTION),
ACTIVE_USER(QueueUserEvent.ACTIVE_USER),
SUSPEND_USER(QueueUserEvent.SUSPEND_USER),
DELETE_USER(QueueUserEvent.DELETE_USER);


private final QueueUserEvent queueUserEvent;

NotificationUserType(QueueUserEvent queueUserEvent) {
this.queueUserEvent = queueUserEvent;
}

public static NotificationUserType getNotificationTypeFromQueueEvent(QueueUserEvent queueEvent) {
for (NotificationUserType notificationType : NotificationUserType.values()) {
if (notificationType.queueUserEvent == queueEvent) {
return notificationType;
}
}
return null; // Return null if no matching NotificationType is found
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package it.pagopa.selfcare.onboarding.dto;

public enum QueueUserEvent {
ADD_INSTITUTE,
UPDATE_INSTITUTION,
ACTIVE_USER,
SUSPEND_USER,
DELETE_USER
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package it.pagopa.selfcare.onboarding.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import it.pagopa.selfcare.onboarding.common.PartyRole;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserToNotify {

private String userId;
private String role;
private String productRole;
private String relationshipStatus;

public String getUserId() {
return userId;
}

public void setUserId(String userId) {
this.userId = userId;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

public String getProductRole() {
return productRole;
}

public void setProductRole(String productRole) {
this.productRole = productRole;
}

public String getRelationshipStatus() {
return relationshipStatus;
}

public void setRelationshipStatus(String relationshipStatus) {
this.relationshipStatus = relationshipStatus;
}
}
Loading

0 comments on commit ed58da4

Please sign in to comment.