Make voucherStatus response model consistent across array + object; add time offset everywhere

This commit is contained in:
Max Martens 2026-08-31 12:57:13 +02:00
parent 0f2eaed9dd
commit c692cd45ea

View File

@ -209,7 +209,6 @@ paths:
- `statusChangedAfter` (only return voucher instances whose status changed after this date-time); - `statusChangedAfter` (only return voucher instances whose status changed after this date-time);
- `includeStatusHistory` (include the status history for each voucher instance). - `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). 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: parameters:
- name: issuedVoucherId - name: issuedVoucherId
@ -291,9 +290,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" },
"product": "product":
{ {
"productId": 263, "productId": 263,
@ -356,9 +355,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" },
"product": "product":
{ {
"productId": 263, "productId": 263,
@ -404,18 +403,16 @@ paths:
"voucherStatusInstances": "voucherStatusInstances":
[ [
{ {
"voucherStatusInstanceId": "ac8c54d1-79f7-4167-8817-c66b9575d679", "voucherStatusId": 1,
"voucherStatus": "name": "new",
{ "voucherStatusId": 1, "name": "New" }, "createdOn": "2024-10-04T12:34:56.000Z",
"createdOn": "2024-10-04T12:34:56.000", "reason": null
"reason": null,
}, },
{ {
"voucherStatusInstanceId": "b01412e6-70fb-4c05-9bef-e65bf2747ca1", "voucherStatusId": 2,
"voucherStatus": "name": "issued",
{ "voucherStatusId": 2, "name": "Issued" }, "createdOn": "2024-10-04T12:37:14.000Z",
"createdOn": "2024-10-04T12:37:14.000", "reason": "Test reason"
"reason": "test reason",
}, },
], ],
"metadata1": null, "metadata1": null,
@ -440,9 +437,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" },
"product": "product":
{ {
"productId": 264, "productId": 264,
@ -473,7 +470,7 @@ paths:
} }
} }
}, },
"voucherClaims":[], "voucherClaims": [],
"metadata1": null, "metadata1": null,
"metadata2": null, "metadata2": null,
"metadata3": null, "metadata3": null,
@ -495,9 +492,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 2, "name": "issued", "reason": "Test reason" }, "voucherStatus": { "voucherStatusId": 2, "name": "issued", "createdOn": "2024-10-04T00:00:00.000Z", "reason": "Test reason" },
"product": "product":
{ {
"productId": 265, "productId": 265,
@ -514,7 +511,7 @@ paths:
} }
} }
}, },
"voucherClaims":[], "voucherClaims": [],
"metadata1": null, "metadata1": null,
"metadata2": null, "metadata2": null,
"metadata3": null, "metadata3": null,
@ -673,9 +670,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 1, "name": "new", "reason": null }, "voucherStatus": { "voucherStatusId": 1, "name": "new", "createdOn": "2024-10-04T00:00:00.000Z", "reason": null },
"product": "product":
{ {
"productId": 263, "productId": 263,
@ -821,9 +818,9 @@ paths:
{ {
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90", "issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
"voucherCode": "HTM-A7J-128-PYT", "voucherCode": "HTM-A7J-128-PYT",
"fromInclusive": "2024-10-04T00:00:00.000", "fromInclusive": "2024-10-04T00:00:00.000Z",
"untilInclusive": "2024-11-04T00:00:00.000", "untilInclusive": "2024-11-04T00:00:00.000Z",
"voucherStatus": { "voucherStatusId": 4, "name": "revoked", "reason": "Voucher was redeemed by an unauthorized person" }, "voucherStatus": { "voucherStatusId": 4, "name": "revoked", "createdOn": "2024-10-04T12:34:56.000Z", "reason": "Voucher was redeemed by an unauthorized person" },
"product": "product":
{ {
"productId": 263, "productId": 263,
@ -933,11 +930,11 @@ components:
fromInclusive: fromInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2024-09-03T10:01:34.000+00:00" example: "2024-09-03T10:01:34.000+00:00Z"
toInclusive: toInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2024-09-03T23:59:59.999+00:00" example: "2024-09-03T23:59:59.999+00:00Z"
productCategory: productCategory:
type: object type: object
required: required:
@ -1007,11 +1004,11 @@ components:
fromInclusive: fromInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2022-03-01T00:00:00.000+00:00" example: "2022-03-01T00:00:00.000+00:00Z"
toInclusive: toInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2022-06-01T00:00:00.000+00:00" example: "2022-06-01T00:00:00.000+00:00Z"
salesTouchpoint: salesTouchpoint:
type: object type: object
required: required:
@ -1098,11 +1095,11 @@ components:
fromInclusive: fromInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2022-03-01T00:00:00.000+00:00" example: "2022-03-01T00:00:00.000+00:00Z"
toInclusive: toInclusive:
type: string type: string
format: date-time-offset format: date-time-offset
example: "2022-06-01T00:00:00.000+00:00" example: "2022-06-01T00:00:00.000+00:00Z"
internalPrice: internalPrice:
type: number type: number
example: 908.1234 example: 908.1234
@ -1225,11 +1222,10 @@ components:
the maximum allowed start date of a requiredProduct (for this, the existing order flow logic is applied). 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" example: "2024-11-04T00:00:00.000+01:00"
voucherStatus: voucherStatus:
type: object allOf:
required: - $ref: "#/components/schemas/voucherStatusInstance"
- voucherStatusId - type: object
- name - description: |-
description: |-
The current status of the voucher. Can be any of the following: The current status of the voucher. Can be any of the following:
- 1 = new - 1 = new
- 2 = issued - 2 = issued
@ -1237,17 +1233,6 @@ components:
- 4 = revoked - 4 = revoked
- 5 = expired - 5 = expired
- 6 = pendingRedemption - 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"
product: product:
type: object type: object
description: The "product" referencing the voucher definition that this voucher instance is based on description: The "product" referencing the voucher definition that this voucher instance is based on
@ -1365,6 +1350,7 @@ components:
example: 1970-01-01 example: 1970-01-01
voucherStatusInstances: voucherStatusInstances:
type: array type: array
description: List of voucherStatusInstances, providing information about the status history of the voucher
items: items:
$ref: "#/components/schemas/voucherStatusInstance" $ref: "#/components/schemas/voucherStatusInstance"
metadata1: metadata1:
@ -1388,28 +1374,18 @@ components:
description: Field for storing custom metadata. description: Field for storing custom metadata.
example: "Some metadata" example: "Some metadata"
voucherStatusInstance: voucherStatusInstance:
type: object
required:
- voucherStatusInstanceId
- voucherStatus
- createdOn
properties:
voucherStatusInstanceId:
type: string
format: uuid
example: 42efebf7-132e-4ee0-9cbb-4037a9a54ad8
voucherStatus:
type: object type: object
required: required:
- voucherStatusId - voucherStatusId
- name - name
- createdOn
properties: properties:
voucherStatusId: voucherStatusId:
type: integer type: integer
example: 4 example: 4
name: name:
type: string type: string
example: "Revoked" example: "revoked"
createdOn: createdOn:
type: string type: string
format: date-time-offset format: date-time-offset