From c692cd45ea7e2cd069c31b61597d6e9e1ba873fa Mon Sep 17 00:00:00 2001 From: Max Martens Date: Mon, 31 Aug 2026 12:57:13 +0200 Subject: [PATCH] Make voucherStatus response model consistent across array + object; add time offset everywhere --- .../products/SE-vouchers-supplier.yaml | 132 +++++++----------- 1 file changed, 54 insertions(+), 78 deletions(-) diff --git a/src/openapi/products/SE-vouchers-supplier.yaml b/src/openapi/products/SE-vouchers-supplier.yaml index e85f7e5..805d851 100644 --- a/src/openapi/products/SE-vouchers-supplier.yaml +++ b/src/openapi/products/SE-vouchers-supplier.yaml @@ -209,7 +209,6 @@ paths: - `statusChangedAfter` (only return voucher instances whose status changed after this date-time); - `includeStatusHistory` (include the status history for each voucher instance). - When a voucher code has been issued multiple times, all issuedvouchers with the same voucher code will be returned, together with their status (or optionally also the status history). parameters: - name: issuedVoucherId @@ -291,9 +290,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" }, "product": { "productId": 263, @@ -356,9 +355,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" }, "product": { "productId": 263, @@ -404,18 +403,16 @@ paths: "voucherStatusInstances": [ { - "voucherStatusInstanceId": "ac8c54d1-79f7-4167-8817-c66b9575d679", - "voucherStatus": - { "voucherStatusId": 1, "name": "New" }, - "createdOn": "2024-10-04T12:34:56.000", - "reason": null, + "voucherStatusId": 1, + "name": "new", + "createdOn": "2024-10-04T12:34:56.000Z", + "reason": null }, { - "voucherStatusInstanceId": "b01412e6-70fb-4c05-9bef-e65bf2747ca1", - "voucherStatus": - { "voucherStatusId": 2, "name": "Issued" }, - "createdOn": "2024-10-04T12:37:14.000", - "reason": "test reason", + "voucherStatusId": 2, + "name": "issued", + "createdOn": "2024-10-04T12:37:14.000Z", + "reason": "Test reason" }, ], "metadata1": null, @@ -440,9 +437,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" }, "product": { "productId": 264, @@ -473,7 +470,7 @@ paths: } } }, - "voucherClaims":[], + "voucherClaims": [], "metadata1": null, "metadata2": null, "metadata3": null, @@ -495,9 +492,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" }, "product": { "productId": 265, @@ -514,7 +511,7 @@ paths: } } }, - "voucherClaims":[], + "voucherClaims": [], "metadata1": null, "metadata2": null, "metadata3": null, @@ -673,9 +670,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 1, "name": "new", "reason": null }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 1, "name": "new", "createdOn": "2024-10-04T00:00:00.000Z", "reason": null }, "product": { "productId": 263, @@ -821,9 +818,9 @@ paths: { "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "voucherCode": "HTM-A7J-128-PYT", - "fromInclusive": "2024-10-04T00:00:00.000", - "untilInclusive": "2024-11-04T00:00:00.000", - "voucherStatus": { "voucherStatusId": 4, "name": "revoked", "reason": "Voucher was redeemed by an unauthorized person" }, + "fromInclusive": "2024-10-04T00:00:00.000Z", + "untilInclusive": "2024-11-04T00:00:00.000Z", + "voucherStatus": { "voucherStatusId": 4, "name": "revoked", "createdOn": "2024-10-04T12:34:56.000Z", "reason": "Voucher was redeemed by an unauthorized person" }, "product": { "productId": 263, @@ -933,11 +930,11 @@ components: fromInclusive: type: string format: date-time-offset - example: "2024-09-03T10:01:34.000+00:00" + example: "2024-09-03T10:01:34.000+00:00Z" toInclusive: type: string format: date-time-offset - example: "2024-09-03T23:59:59.999+00:00" + example: "2024-09-03T23:59:59.999+00:00Z" productCategory: type: object required: @@ -1007,11 +1004,11 @@ components: fromInclusive: type: string format: date-time-offset - example: "2022-03-01T00:00:00.000+00:00" + example: "2022-03-01T00:00:00.000+00:00Z" toInclusive: type: string format: date-time-offset - example: "2022-06-01T00:00:00.000+00:00" + example: "2022-06-01T00:00:00.000+00:00Z" salesTouchpoint: type: object required: @@ -1098,11 +1095,11 @@ components: fromInclusive: type: string format: date-time-offset - example: "2022-03-01T00:00:00.000+00:00" + example: "2022-03-01T00:00:00.000+00:00Z" toInclusive: type: string format: date-time-offset - example: "2022-06-01T00:00:00.000+00:00" + example: "2022-06-01T00:00:00.000+00:00Z" internalPrice: type: number example: 908.1234 @@ -1225,29 +1222,17 @@ components: the maximum allowed start date of a requiredProduct (for this, the existing order flow logic is applied). example: "2024-11-04T00:00:00.000+01:00" voucherStatus: - type: object - required: - - voucherStatusId - - name - description: |- - The current status of the voucher. Can be any of the following: - - 1 = new - - 2 = issued - - 3 = redeemed - - 4 = revoked - - 5 = expired - - 6 = pendingRedemption - properties: - voucherStatusId: - type: integer - example: 4 - name: - type: string - example: "revoked" - reason: - type: string - description: The reason for the change of the voucher status. - example: "Voucher was redeemed by an unauthorized person" + allOf: + - $ref: "#/components/schemas/voucherStatusInstance" + - type: object + - description: |- + The current status of the voucher. Can be any of the following: + - 1 = new + - 2 = issued + - 3 = redeemed + - 4 = revoked + - 5 = expired + - 6 = pendingRedemption product: type: object description: The "product" referencing the voucher definition that this voucher instance is based on @@ -1365,8 +1350,9 @@ components: example: 1970-01-01 voucherStatusInstances: type: array + description: List of voucherStatusInstances, providing information about the status history of the voucher items: - $ref: "#/components/schemas/voucherStatusInstance" + $ref: "#/components/schemas/voucherStatusInstance" metadata1: type: string description: Field for storing custom metadata. @@ -1390,26 +1376,16 @@ components: voucherStatusInstance: type: object required: - - voucherStatusInstanceId - - voucherStatus + - voucherStatusId + - name - createdOn properties: - voucherStatusInstanceId: + voucherStatusId: + type: integer + example: 4 + name: type: string - format: uuid - example: 42efebf7-132e-4ee0-9cbb-4037a9a54ad8 - voucherStatus: - type: object - required: - - voucherStatusId - - name - properties: - voucherStatusId: - type: integer - example: 4 - name: - type: string - example: "Revoked" + example: "revoked" createdOn: type: string format: date-time-offset