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);
- `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,
@ -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,
@ -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,11 +1222,10 @@ 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: |-
allOf:
- $ref: "#/components/schemas/voucherStatusInstance"
- type: object
- description: |-
The current status of the voucher. Can be any of the following:
- 1 = new
- 2 = issued
@ -1237,17 +1233,6 @@ components:
- 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"
product:
type: object
description: The "product" referencing the voucher definition that this voucher instance is based on
@ -1365,6 +1350,7 @@ 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"
metadata1:
@ -1388,28 +1374,18 @@ components:
description: Field for storing custom metadata.
example: "Some metadata"
voucherStatusInstance:
type: object
required:
- voucherStatusInstanceId
- voucherStatus
- createdOn
properties:
voucherStatusInstanceId:
type: string
format: uuid
example: 42efebf7-132e-4ee0-9cbb-4037a9a54ad8
voucherStatus:
type: object
required:
- voucherStatusId
- name
- createdOn
properties:
voucherStatusId:
type: integer
example: 4
name:
type: string
example: "Revoked"
example: "revoked"
createdOn:
type: string
format: date-time-offset