diff --git a/docs/openapi.json b/docs/openapi.json index 7f267b2..9a4876d 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -976,24 +976,14 @@ } }, "Cancellation" : { - "required" : [ "contractId", "effectiveDate", "reasonCode" ], + "required" : [ "action", "identifier" ], "type" : "object", "properties" : { - "contractId" : { - "maxLength" : 20, - "minLength" : 0, - "type" : "string", - "description" : "Id given by SaaS provider. Identifies the contract which should be cancelled" - }, - "effectiveDate" : { - "type" : "string", - "description" : "effecitve date of cancellation", - "format" : "date" + "identifier" : { + "$ref" : "#/components/schemas/Identifier" }, - "reasonCode" : { - "type" : "integer", - "description" : "A code uniquely identifying the cancellation reason", - "format" : "int32" + "action" : { + "$ref" : "#/components/schemas/Action" } } } diff --git a/docs/swagger.json b/docs/swagger.json index 51a84c8..3d0aed1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -464,27 +464,16 @@ }, "Cancellation": { "properties": { - "contractId": { - "description": "Id given by SaaS provider. Identifies the contract which should be cancelled", - "maxLength": 20, - "minLength": 0, - "type": "string" - }, - "effectiveDate": { - "description": "effecitve date of cancellation", - "format": "date", - "type": "string" + "action": { + "$ref": "#/definitions/Action" }, - "reasonCode": { - "description": "A code uniquely identifying the cancellation reason", - "format": "int32", - "type": "integer" + "identifier": { + "$ref": "#/definitions/Identifier" } }, "required": [ - "contractId", - "effectiveDate", - "reasonCode" + "action", + "identifier" ], "type": "object" }, diff --git a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java index 120c410..5988b48 100644 --- a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java +++ b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java @@ -1,52 +1,35 @@ package ch.baloise.corellia.api.entities; -import static ch.baloise.corellia.api.constraints.SizeConstraint.CONTRACT_ID_MAX_SIZE; - -import com.fasterxml.jackson.annotation.JsonPropertyDescription; import java.io.Serializable; -import java.time.LocalDate; +import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; public class Cancellation implements Serializable { - private static final long serialVersionUID = 10; - - @NotNull - @Size(max = CONTRACT_ID_MAX_SIZE) - @JsonPropertyDescription( - "Id given by SaaS provider. Identifies the contract which should be cancelled") - private String contractId; - - @NotNull - @JsonPropertyDescription("effecitve date of cancellation") - private LocalDate effectiveDate; + private static final long serialVersionUID = 10; - @NotNull - @JsonPropertyDescription("A code uniquely identifying the cancellation reason") - private Integer reasonCode; + @NotNull + @Valid + private Identifier identifier; - public String getContractId() { - return contractId; - } + @NotNull + @Valid + private Action action; - public void setContractId(String contractId) { - this.contractId = contractId; - } + public Identifier getIdentifier() { + return identifier; + } - public LocalDate getEffectiveDate() { - return effectiveDate; - } + public void setIdentifier(Identifier identifier) { + this.identifier = identifier; + } - public void setEffectiveDate(LocalDate effectiveDate) { - this.effectiveDate = effectiveDate; - } + public Action getAction() { + return action; + } - public Integer getReasonCode() { - return reasonCode; - } + public void setAction(Action action) { + this.action = action; + } - public void setReasonCode(Integer reasonCode) { - this.reasonCode = reasonCode; - } }