openapi: "3.0.3"
info:
  title: ABT Purchased Products CRUD APIs
  version: "1.0"
  description: CRUD APIs for ABT Purchased Products database. These are NOT the functional APIs from Service Engine.
servers:
  - url: https://api.integratielaag.nl/v1
paths:
  /purchasedproducts:
    get:
      tags:
        - Purchased Product
      summary: Find purchased products.
      description: Find purchased products.
      parameters:
        - in: query
          name: productId
          schema:
            type: integer
            example: 1
          required: false
          description: The technical id of the product.
        - in: query
          name: createdOnBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          required: false
          description: The purchased product should be created before this timestamp.
        - in: query
          name: createdOnAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          required: false
          description: The purchased product should be created after this timestamp.
        - in: query
          name: lastUpdatedOnBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          required: false
          description: The purchased product should be last updated before this timestamp.
        - in: query
          name: lastUpdatedOnAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          required: false
          description: The purchased product should be last updated after this timestamp.
        - in: query
          name: resourceNameId
          schema:
            type: integer
            example: 2
          required: false
          description: The id of the resource.
        - in: query
          name: resourceName
          schema:
            type: string
            example: orders
          required: false
          description: The name of the resource.
        - in: query
          name: resourceIdentifier
          schema:
            type: string
            example: f461004f-d98e-4323-aa26-f09bf8ea2f2d
          required: false
          description: The identifier of the resource.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedProducts":
                    [
                      {
                        "purchasedProductId": "45573af8-a9aa-4f7c-95f4-b1971bf2c3c6",
                        "productId": 12,
                        "createdOn": "2024-10-04T12:34:56.000",
                        "lastUpdatedOn": "2024-10-04T12:34:56.000",
                        "purchasedProductResources":
                          [
                            {
                              "purchasedProductResourceId": "c7900130-0637-41d7-83fe-6fe283a0a1f1",
                              "resourceName":
                                { "resourceNameId": 1, "name": "contracts" },
                              "resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
                            },
                            {
                              "purchasedProductResourceId": "06dae996-cdfe-45f1-833a-720201c35114",
                              "resourceName":
                                { "resourceNameId": 2, "name": "orders" },
                              "resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
                            },
                          ],
                        "purchasedGboProducts":
                          [
                            {
                              "purchasedGboProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd",
                              "salesTimestamp": "2024-10-04T12:34:56.000",
                              "refundTimestamp": "2024-10-04T12:34:56.000",
                              "fromInclusive": "2024-10-04T12:34:56.000",
                              "untilInclusive": "2024-10-04T12:34:56.000",
                              "packageTemplateId": "30003",
                              "xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
                              "xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
                              "xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
                              "customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
                              "ovPayTokenId": 13,
                              "createdOn": "2024-10-04T12:34:56.000",
                              "lastUpdatedOn": "2024-10-04T12:34:56.000",
                              "createdBy": "someuser",
                              "lastUpdatedBy": null,
                            },
                          ],
                      },
                    ],
                  "href": null,
                }
    post:
      tags:
        - Purchased Product
      summary: Create a new purchased product.
      description: Create a new purchased product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/unavailable"
            example:
              {
                "productId": 11,
                "createdOn": "2024-10-04T12:34:56.000",
                "lastUpdatedOn": "2024-10-04T12:34:56.000",
                "purchasedProductResources":
                  [
                    {
                      "resourceNameId": 1,
                      "resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
                    },
                    {
                      "resourceNameId": 2,
                      "resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
                    },
                  ],
                "purchasedGboProducts":
                  [
                    {
                      "salesTimestamp": "2024-10-04T12:34:56.000",
                      "refundTimestamp": "2024-10-04T12:34:56.000",
                      "fromInclusive": "2024-10-04T12:34:56.000",
                      "untilInclusive": "2024-10-04T12:34:56.000",
                      "packageTemplateId": "30003",
                      "xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
                      "xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
                      "xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
                      "customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
                      "ovPayTokenId": 13,
                      "createdOn": "2024-10-04T12:34:56.000",
                      "lastUpdatedOn": "2024-10-04T12:34:56.000",
                      "createdBy": "someuser",
                      "lastUpdatedBy": null,
                    },
                  ],
              }
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                { "purchasedProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd" }
  /purchasedproducts/{purchasedProductId}:
    parameters:
      - in: path
        name: purchasedProductId
        schema:
          type: string
          format: uuid
          example: 058a1af7-897f-45d5-b691-9cc9161e387f
        required: true
        description: The id of the purchased product to process.
    get:
      tags:
        - Purchased Product
      summary: Get a single purchased product.
      description: Get a single purchased product.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd",
                  "productId": 14,
                  "createdOn": "2024-10-04T12:34:56.000",
                  "lastUpdatedOn": "2024-10-04T12:34:56.000",
                  "purchasedProductResources":
                    [
                      {
                        "resourceName":
                          { "resourceNameId": 1, "name": "contracts" },
                        "resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
                      },
                      {
                        "resourceName":
                          { "resourceNameId": 2, "name": "orders" },
                        "resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
                      },
                    ],
                  "purchasedGboProducts":
                    [
                      {
                        "salesTimestamp": "2024-10-04T12:34:56.000",
                        "refundTimestamp": "2024-10-04T12:34:56.000",
                        "fromInclusive": "2024-10-04T12:34:56.000",
                        "untilInclusive": "2024-10-04T12:34:56.000",
                        "packageTemplateId": "30003",
                        "xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
                        "xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
                        "xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
                        "customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
                        "ovPayTokenId": 13,
                        "createdOn": "2024-10-04T12:34:56.000",
                        "lastUpdatedOn": "2024-10-04T12:34:56.000",
                        "createdBy": "someuser",
                        "lastUpdatedBy": null,
                      },
                    ],
                }
    patch:
      tags:
        - Purchased Product
      summary: Update a purchased product.
      description: Update a purchased product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/unavailable"
            example: { "lastUpdatedOn": "2024-10-04T12:34:56.000" }
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                { "purchasedProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd" }
  /purchasedproducts/{purchasedProductId}/resources:
    parameters:
      - in: path
        name: purchasedProductId
        schema:
          type: string
          format: uuid
          example: 058a1af7-897f-45d5-b691-9cc9161e387f
        required: true
        description: The id of the purchased product to process.
    post:
      tags:
        - Purchased Product
      summary: Add a resource to a purchased product.
      description: Add a resource to a purchased product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/unavailable"
            example:
              {
                "resourceNameId": 1,
                "resourceIdentifier": "502d2e0d-4e3b-4a7e-9f6e-0d0b1e1e1e1e",
              }
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedProductResourceId": "ff572952-b16e-43ee-919c-a6edb620079e",
                }
  /purchasedproducts/{purchasedProductId}/gboproducts:
    parameters:
      - in: path
        name: purchasedProductId
        schema:
          type: string
          format: uuid
          example: 058a1af7-897f-45d5-b691-9cc9161e387f
        required: true
        description: The id of the purchased product to process.
    post:
      tags:
        - Purchased GBO Product
      summary: Add a GBO purchased product.
      description: Add a GBO purchased product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/unavailable"
            example:
              {
                "salesTimestamp": "2024-10-04T12:34:56.000",
                "refundTimestamp": "2024-10-04T12:34:56.000",
                "fromInclusive": "2024-10-04T12:34:56.000",
                "untilInclusive": "2024-10-04T12:34:56.000",
                "packageTemplateId": "30003",
                "xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
                "xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
                "xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
                "customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
                "ovPayTokenId": 13,
                "createdOn": "2024-10-04T12:34:56.000",
                "lastUpdatedOn": "2024-10-04T12:34:56.000",
                "createdBy": "someuser",
                "lastUpdatedBy": null,
              }
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedGboProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd",
                }
  /purchasedgboproducts:
    get:
      tags:
        - Purchased GBO Product
      summary: Find GBO purchased products.
      description: Find GBO purchased products.
      parameters:
        - in: query
          name: purchasedGboProductId
          schema:
            type: string
            format: uuid
            example: c99dea33-a1be-4336-ad25-ec0869693ef3
          description: The id of the purchased GBO product.
        - in: query
          name: purchasedProductId
          schema:
            type: string
            format: uuid
            example: 058a1af7-897f-45d5-b691-9cc9161e387f
          description: The id of the purchased product.
        - in: query
          name: salesTimestampBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be sold before this timestamp.
        - in: query
          name: salesTimestampAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be sold after this timestamp.
        - in: query
          name: refundTimestampBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be refunded before this timestamp.
        - in: query
          name: refundTimestampAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be refunded after this timestamp.
        - in: query
          name: fromInclusiveBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be valid before this timestamp.
        - in: query
          name: fromInclusiveAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be valid after this timestamp.
        - in: query
          name: untilInclusiveBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be valid before this timestamp.
        - in: query
          name: untilInclusiveAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be valid after this timestamp.
        - in: query
          name: packageTemplateId
          schema:
            type: string
            format: uuid
            example: 30003
          description: The id of the package template.
        - in: query
          name: xBot
          schema:
            type: string
            format: uuid
            example: f15efe6f-7353-4968-b134-60ba6fc2da8b
          description: The id of the XBOT.
        - in: query
          name: xTat
          schema:
            type: string
            format: uuid
            example: 42efebf7-132e-4ee0-9cbb-4037a9a54ad8
          description: The id of the XTAT.
        - in: query
          name: xSpit
          schema:
            type: string
            format: uuid
            example: d67b2f72-918a-4e6c-957d-a39ed9c9e16b
          description: The id of the XSPIT.
        - in: query
          name: customerTokenId
          schema:
            type: string
            format: uuid
            example: b6492322-c458-4857-9ac3-a109c1887b9f
          description: The id of the customer token.
        - in: query
          name: ovPayTokenId
          schema:
            type: integer
            example: 13
          description: The id of the ov pay token.
        - in: query
          name: createdOnBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be created before this timestamp.
        - in: query
          name: createdOnAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be created after this timestamp.
        - in: query
          name: lastUpdatedOnBefore
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be updated before this timestamp.
        - in: query
          name: lastUpdatedOnAfter
          schema:
            type: string
            format: date-time
            example: 2024-10-04T12:34:56.000
          description: The purchased GBO product should be updated after this timestamp.
        - in: query
          name: createdBy
          schema:
            type: string
            example: someuser
          description: The user that created the purchased GBO product.
        - in: query
          name: lastUpdatedBy
          schema:
            type: string
            example: someuser
          description: The user that last updated the purchased GBO product.
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedGboProducts":
                    [
                      {
                        "purchasedGboProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd",
                        "purchasedProductId": "9e166bb3-806a-4f43-a7a2-0d5b1e90e0c3",
                        "salesTimestamp": "2024-10-04T12:34:56.000",
                        "refundTimestamp": "2024-10-05T12:34:56.000",
                        "fromInclusive": "2024-10-04T12:34:56.000",
                        "untilInclusive": "2024-10-05T12:34:56.000",
                        "packageTemplateId": "30003",
                        "xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
                        "xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
                        "xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
                        "customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
                        "ovPayTokenId": 13,
                        "createdOn": "2024-10-04T12:34:56.000",
                        "lastUpdatedOn": "2024-10-04T12:34:56.000",
                        "createdBy": "someuser",
                        "lastUpdatedBy": null,
                      },
                      {
                        "purchasedGboProductId": 431e481f-4330-4ad4-be47-393db38cfe38,
                        "purchasedProductId": "9e166bb3-806a-4f43-a7a2-0d5b1e90e0c3",
                        "salesTimestamp": "2024-10-05T12:34:56.000",
                        "refundTimestamp": "2024-10-06T12:34:56.000",
                        "fromInclusive": "2024-10-05T12:34:56.000",
                        "untilInclusive": "2024-10-06T12:34:56.000",
                        "packageTemplateId": "30003",
                        "xBot": "f8f13d64-fd07-44e8-9c85-968857da5d68",
                        "xTat": "01a82ebe-5d07-45d8-a897-66152e8954dd",
                        "xSpit": "c3868858-b250-4480-9cb4-725d2e9198f3",
                        "customerTokenId": "6c7a6d4b-7e6c-4f6a-9b1e-0a9b1e6c7a6d",
                        "ovPayTokenId": 14,
                        "createdOn": "2024-10-05T12:34:56.000",
                        "lastUpdatedOn": "2024-10-05T12:34:56.000",
                        "createdBy": "someuser",
                        "lastUpdatedBy": null,
                      },
                    ],
                  "href": null,
                }
  /purchasedgboproducts/{purchasedGboProductId}:
    parameters:
      - in: path
        name: purchasedGboProductId
        schema:
          type: string
          format: uuid
          example: 058a1af7-897f-45d5-b691-9cc9161e387f
        required: true
        description: The id of the purchased product to process.
    patch:
      tags:
        - Purchased GBO Product
      summary: Update a GBO purchased product.
      description: Update a GBO purchased product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/unavailable"
            example:
              {
                "refundTimestamp": "2024-10-05T12:34:56.000",
                "lastUpdatedOn": "2024-10-05T12:34:56.000",
                "lastUpdatedBy": "someuser",
              }
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/unavailable"
              example:
                {
                  "purchasedGboProductId": "a9b3dea5-fb8a-4b1e-9fe6-90cad31c0cfd",
                }
components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    unavailable:
      type: object
    rfc9457:
      type: object
      properties:
        type:
          type: string
          format: url
          example: https://example.com/probs/out-of-credit
        title:
          type: string
          example: You do not have enough credit.
        detail:
          type: string
          example: Your current balance is 30, but that costs 50.
        instance:
          type: string
          example: /account/12345/msgs/abc
        balance:
          type: string
          example: 30
        accounts:
          type: array
          items:
            type: string
            example:
              - /account/12345
              - /account/67890
