diff --git a/.gitignore b/.gitignore
index a85a0ec..cf3e997 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,5 @@ target/
.idea/
*.iml
-node_modules/
\ No newline at end of file
+node_modules/
+.idea
\ No newline at end of file
diff --git a/docs/openapi.json b/docs/openapi.json
index 2e00226..c2c677c 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -255,178 +255,6 @@
}
}
}
- },
- "/contracts/v1" : {
- "post" : {
- "tags" : [ "contracts" ],
- "summary" : "Upload a contract V1 to the insurer.",
- "description" : "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown",
- "operationId" : "uploadContractV1",
- "parameters" : [ {
- "name" : "X-Caller-Name",
- "in" : "header",
- "description" : "Identifying the sender of this event (request) ",
- "required" : true,
- "schema" : {
- "type" : "string",
- "description" : "Defined by the callee"
- }
- }, {
- "name" : "X-Event-ID",
- "in" : "header",
- "description" : "Unique identifier per event (request)",
- "required" : true,
- "schema" : {
- "type" : "string",
- "description" : "Generated UUID",
- "format" : "uuid"
- }
- } ],
- "requestBody" : {
- "description" : "Contract that needs to be uploaded to the insurer",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ContractV1"
- }
- }
- },
- "required" : true
- },
- "responses" : {
- "default" : {
- "description" : "A handle to the contract for conversation with the insurer is provided",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ContractReference"
- }
- }
- }
- },
- "400" : {
- "description" : "Invalid contract is provided. See ErrorResponse for more information about validation issues",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ErrorResponse"
- }
- }
- }
- },
- "503" : {
- "description" : "Technical issue on server side, please retry later",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ErrorResponse"
- }
- }
- }
- }
- }
- }
- },
- "/contracts/v1/documents" : {
- "post" : {
- "tags" : [ "documents" ],
- "summary" : "Upload a document for a contract.",
- "description" : "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract",
- "operationId" : "uploadDocumentV1",
- "parameters" : [ {
- "name" : "X-Caller-Name",
- "in" : "header",
- "description" : "Identifying the sender of this event (request) ",
- "required" : true,
- "schema" : {
- "type" : "string",
- "description" : "Defined by the callee"
- }
- }, {
- "name" : "X-Event-ID",
- "in" : "header",
- "description" : "Unique identifier per event (request)",
- "required" : true,
- "schema" : {
- "type" : "string",
- "description" : "Generated UUID",
- "format" : "uuid"
- }
- } ],
- "requestBody" : {
- "description" : "a documnent that is part of a contract",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/Document"
- }
- }
- },
- "required" : true
- },
- "responses" : {
- "default" : {
- "description" : "A handle for the uploaded document which can be used in providing a new contract via POST contracts",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/FileHandle"
- }
- }
- }
- },
- "400" : {
- "description" : "Invalid document is provided. See ErrorResponse for more information about validation issues",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ErrorResponse"
- }
- }
- }
- },
- "503" : {
- "description" : "Technical issue on server side, please retry later",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ErrorResponse"
- }
- }
- }
- }
- }
- }
- },
- "/contracts/v1/version" : {
- "get" : {
- "tags" : [ "version" ],
- "summary" : "Callable way of retrieving current API version (following semver)",
- "description" : "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.",
- "operationId" : "versionV1",
- "responses" : {
- "default" : {
- "description" : "Version identifier",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/Version"
- }
- }
- }
- },
- "503" : {
- "description" : "Technical issue on server side, please retry later",
- "content" : {
- "application/json; charset=UTF-8" : {
- "schema" : {
- "$ref" : "#/components/schemas/ErrorResponse"
- }
- }
- }
- }
- }
- }
}
},
"components" : {
@@ -942,71 +770,6 @@
"format" : "int32"
}
}
- },
- "ContractV1" : {
- "required" : [ "conditionMonthYear", "contractId", "creationDate", "endDate", "fileHandles", "paymentCode", "product", "roles", "startDate", "totalNetPrice" ],
- "type" : "object",
- "properties" : {
- "creationDate" : {
- "type" : "string",
- "description" : "The day the contract was issued",
- "format" : "date"
- },
- "startDate" : {
- "type" : "string",
- "description" : "Start of contract which means start of insurance coverage",
- "format" : "date"
- },
- "endDate" : {
- "type" : "string",
- "description" : "End of contract which means end of insurance coverage",
- "format" : "date"
- },
- "contractId" : {
- "maxLength" : 20,
- "minLength" : 0,
- "type" : "string",
- "description" : "Id given by SaaS provider"
- },
- "totalNetPrice" : {
- "$ref" : "#/components/schemas/MonetaryAmount"
- },
- "roles" : {
- "maxItems" : 99,
- "minItems" : 1,
- "type" : "array",
- "description" : "All roles in the contract, e.g. insuranceHolder",
- "items" : {
- "$ref" : "#/components/schemas/Role"
- }
- },
- "product" : {
- "$ref" : "#/components/schemas/Product"
- },
- "agent" : {
- "$ref" : "#/components/schemas/Agent"
- },
- "paymentCode" : {
- "type" : "integer",
- "description" : "A code uniquely identifying the type of payment e.g. invoice or creditcard, Paypal etc.",
- "format" : "int32"
- },
- "fileHandles" : {
- "maxItems" : 2,
- "minItems" : 0,
- "type" : "array",
- "description" : "A contract is only complete with its corresponding documents. This is the contract issued by the SaaS provider and maybe some further documents like e.g. customer provided documents like e.g. receipts. At least one contract document is required",
- "items" : {
- "$ref" : "#/components/schemas/FileHandle"
- }
- },
- "conditionMonthYear" : {
- "maxLength" : 4,
- "minLength" : 4,
- "type" : "string",
- "description" : "When was the condition issued? Format MMYY"
- }
- }
}
}
}
diff --git a/docs/swagger.json b/docs/swagger.json
index a8bfc29..74ba63c 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -13,158 +13,6 @@
"version": "0.1.0"
},
"paths": {
- "/contracts/v1": {
- "post": {
- "consumes": [
- "application/json; charset=UTF-8"
- ],
- "produces": [
- "application/json; charset=UTF-8"
- ],
- "parameters": [
- {
- "description": "Identifying the sender of this event (request) ",
- "in": "header",
- "name": "X-Caller-Name",
- "required": true,
- "type": "string"
- },
- {
- "description": "Unique identifier per event (request)",
- "format": "uuid",
- "in": "header",
- "name": "X-Event-ID",
- "required": true,
- "type": "string"
- },
- {
- "description": "Contract that needs to be uploaded to the insurer",
- "in": "body",
- "name": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/ContractV1"
- }
- }
- ],
- "responses": {
- "400": {
- "description": "Invalid contract is provided. See ErrorResponse for more information about validation issues",
- "schema": {
- "$ref": "#/definitions/ErrorResponse"
- }
- },
- "503": {
- "description": "Technical issue on server side, please retry later",
- "schema": {
- "$ref": "#/definitions/ErrorResponse"
- }
- },
- "default": {
- "description": "A handle to the contract for conversation with the insurer is provided",
- "schema": {
- "$ref": "#/definitions/ContractReference"
- }
- }
- },
- "tags": [
- "contracts"
- ],
- "description": "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown",
- "operationId": "uploadContractV1",
- "summary": "Upload a contract V1 to the insurer."
- }
- },
- "/contracts/v1/documents": {
- "post": {
- "consumes": [
- "application/json; charset=UTF-8"
- ],
- "produces": [
- "application/json; charset=UTF-8"
- ],
- "parameters": [
- {
- "description": "Identifying the sender of this event (request) ",
- "in": "header",
- "name": "X-Caller-Name",
- "required": true,
- "type": "string"
- },
- {
- "description": "Unique identifier per event (request)",
- "format": "uuid",
- "in": "header",
- "name": "X-Event-ID",
- "required": true,
- "type": "string"
- },
- {
- "description": "a documnent that is part of a contract",
- "in": "body",
- "name": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/Document"
- }
- }
- ],
- "responses": {
- "400": {
- "description": "Invalid document is provided. See ErrorResponse for more information about validation issues",
- "schema": {
- "$ref": "#/definitions/ErrorResponse"
- }
- },
- "503": {
- "description": "Technical issue on server side, please retry later",
- "schema": {
- "$ref": "#/definitions/ErrorResponse"
- }
- },
- "default": {
- "description": "A handle for the uploaded document which can be used in providing a new contract via POST contracts",
- "schema": {
- "$ref": "#/definitions/FileHandle"
- }
- }
- },
- "tags": [
- "documents"
- ],
- "description": "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract",
- "operationId": "uploadDocumentV1",
- "summary": "Upload a document for a contract."
- }
- },
- "/contracts/v1/version": {
- "get": {
- "produces": [
- "application/json; charset=UTF-8"
- ],
- "parameters": [],
- "responses": {
- "503": {
- "description": "Technical issue on server side, please retry later",
- "schema": {
- "$ref": "#/definitions/ErrorResponse"
- }
- },
- "default": {
- "description": "Version identifier",
- "schema": {
- "$ref": "#/definitions/Version"
- }
- }
- },
- "tags": [
- "version"
- ],
- "description": "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.",
- "operationId": "versionV1",
- "summary": "Callable way of retrieving current API version (following semver)"
- }
- },
"/contracts/v2": {
"post": {
"consumes": [
@@ -636,82 +484,6 @@
},
"type": "object"
},
- "ContractV1": {
- "properties": {
- "agent": {
- "$ref": "#/definitions/Agent"
- },
- "conditionMonthYear": {
- "description": "When was the condition issued? Format MMYY",
- "maxLength": 4,
- "minLength": 4,
- "type": "string"
- },
- "contractId": {
- "description": "Id given by SaaS provider",
- "maxLength": 20,
- "minLength": 0,
- "type": "string"
- },
- "creationDate": {
- "description": "The day the contract was issued",
- "format": "date",
- "type": "string"
- },
- "endDate": {
- "description": "End of contract which means end of insurance coverage",
- "format": "date",
- "type": "string"
- },
- "fileHandles": {
- "description": "A contract is only complete with its corresponding documents. This is the contract issued by the SaaS provider and maybe some further documents like e.g. customer provided documents like e.g. receipts. At least one contract document is required",
- "items": {
- "$ref": "#/definitions/FileHandle"
- },
- "maxItems": 2,
- "minItems": 0,
- "type": "array"
- },
- "paymentCode": {
- "description": "A code uniquely identifying the type of payment e.g. invoice or creditcard, Paypal etc.",
- "format": "int32",
- "type": "integer"
- },
- "product": {
- "$ref": "#/definitions/Product"
- },
- "roles": {
- "description": "All roles in the contract, e.g. insuranceHolder",
- "items": {
- "$ref": "#/definitions/Role"
- },
- "maxItems": 99,
- "minItems": 1,
- "type": "array"
- },
- "startDate": {
- "description": "Start of contract which means start of insurance coverage",
- "format": "date",
- "type": "string"
- },
- "totalNetPrice": {
- "$ref": "#/definitions/MonetaryAmount"
- }
- },
- "required": [
- "conditionMonthYear",
- "contractId",
- "creationDate",
- "endDate",
- "fileHandles",
- "paymentCode",
- "product",
- "roles",
- "startDate",
- "totalNetPrice"
- ],
- "type": "object"
- },
"Coverable": {
"properties": {
"code": {
diff --git a/pom.xml b/pom.xml
index 8a532bb..ad44eff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
ch.baloise.corellia
api
- 2.0.5-SNAPSHOT
+ 3.0.0-SNAPSHOT
jar
@@ -39,7 +39,7 @@
https://github.com/baloise/corellia.git
scm:git:https://github.com/baloise/corellia.git
scm:git:https://github.com/baloise/corellia.git
- v2.0.1
+ v3.0.0
diff --git a/src/main/java/ch/baloise/corellia/api/ContractRestController.java b/src/main/java/ch/baloise/corellia/api/ContractRestController.java
index 455aac4..cebe357 100644
--- a/src/main/java/ch/baloise/corellia/api/ContractRestController.java
+++ b/src/main/java/ch/baloise/corellia/api/ContractRestController.java
@@ -42,26 +42,6 @@ public interface ContractRestController {
String X_EVENT_ID = "X-Event-ID";
String X_CALLER_NAME = "X-Caller-Name";
- @Path("/v1")
- @POST
- @Operation(summary = "Upload a contract V1 to the insurer.",
- tags = {"contracts"},
- description = "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown",
- responses = {
- @ApiResponse(description = "A handle to the contract for conversation with the insurer is provided", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ContractReference.class))),
- @ApiResponse(responseCode = "400", description = "Invalid contract is provided. See ErrorResponse for more information about validation issues", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))),
- @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class)))
- })
-
- public ch.baloise.corellia.api.entities.ContractReference uploadContractV1(
- @Parameter(in = ParameterIn.HEADER, name= X_CALLER_NAME, required = true, description = "Identifying the sender of this event (request) ", //
- schema = @Schema(type = "string", description = "Defined by the callee"))
- @HeaderParam(X_CALLER_NAME) String callerName,
- @Parameter(in = ParameterIn.HEADER, name= X_EVENT_ID, required = true, description = "Unique identifier per event (request)", //
- schema = @Schema(type = "string", format = "uuid", description = "Generated UUID"))
- @HeaderParam(X_EVENT_ID) String eventId,
- @Parameter(description = "Contract that needs to be uploaded to the insurer", required = true) ContractV1 contractV1);
-
@Path("/v2")
@POST
@Operation(summary = "Upload a contract to the insurer.",
@@ -82,25 +62,6 @@ public ch.baloise.corellia.api.entities.ContractReference uploadContract(
@HeaderParam(X_EVENT_ID) String eventId,
@Parameter(description = "Contract that needs to be uploaded to the insurer", required = true) Contract contract);
- @POST
- @Path("/v1/documents")
- @Operation(summary = "Upload a document for a contract.",
- tags = {"documents"},
- description = "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract",
- responses = {
- @ApiResponse(description = "A handle for the uploaded document which can be used in providing a new contract via POST contracts", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.FileHandle.class))),
- @ApiResponse(responseCode = "400", description = "Invalid document is provided. See ErrorResponse for more information about validation issues", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))),
- @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))),
- })
- public ch.baloise.corellia.api.entities.FileHandle uploadDocumentV1(
- @Parameter(in = ParameterIn.HEADER, name= X_CALLER_NAME, required = true, description = "Identifying the sender of this event (request) ", //
- schema = @Schema(type = "string", description = "Defined by the callee"))
- @HeaderParam(X_CALLER_NAME) String callerName,
- @Parameter(in = ParameterIn.HEADER, name= X_EVENT_ID, required = true, description = "Unique identifier per event (request)", //
- schema = @Schema(type = "string", format = "uuid", description = "Generated UUID"))
- @HeaderParam(X_EVENT_ID) String eventId,
- @Parameter(description = "a documnent that is part of a contract", required = true) Document document);
-
@POST
@Path("/v2/documents")
@Operation(summary = "Upload a document for a contract.",
@@ -120,17 +81,6 @@ public ch.baloise.corellia.api.entities.FileHandle uploadDocument(
@HeaderParam(X_EVENT_ID) String eventId,
@Parameter(description = "a documnent that is part of a contract", required = true) Document document);
- @GET
- @Path("/v1/version")
- @Operation(summary = "Callable way of retrieving current API version (following semver)",
- tags = {"version"},
- description = "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.",
- responses = {
- @ApiResponse(description = "Version identifier", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.Version.class))),
- @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))),
- })
- public Version versionV1();
-
@GET
@Path("/v2/version")
@Operation(summary = "Callable way of retrieving current API version (following semver)",
diff --git a/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java b/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java
index 81cfae7..6cac37a 100644
--- a/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java
+++ b/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java
@@ -21,13 +21,13 @@ void setUp() {
@Test
void fromLowerCase() throws IOException {
- Document.DocumentType documentType = objectMapper.readValue("\"application_pdf\"", Document.DocumentType.class);
+ Document.DocumentType documentType = objectMapper.readValue("\"contract\"", Document.DocumentType.class);
assertEquals(Document.DocumentType.CONTRACT, documentType);
}
@Test
void fromUpperCase() throws IOException {
- Document.DocumentType documentType = objectMapper.readValue("\"APPLICATION_PDF\"", Document.DocumentType.class);
+ Document.DocumentType documentType = objectMapper.readValue("\"CONTRACT\"", Document.DocumentType.class);
assertEquals(Document.DocumentType.CONTRACT, documentType);
}