openapi: 3.0.0
info:
  title: Extension API
  description: |-
    # extension-api

    API glue for external integrations to support our
    core API.
  contact:
    name: API Integration Support
    email: integration@dintero.com
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
security:
  - JWT: []
paths:
  /PosService/InsertReceipts:
    post:
      operationId: aid_silenttouch_receipt_legacy_post
      summary: aid_silenttouch_receipt_legacy_post
      description: |
        create a new Dintero Receipt from SilentTouch receipt

        Requires existing
        [SalesLocation](https://docs.dintero.com/api.html#tag/locations)
        tobe define upfront before receiving SilentTouch receipt
      tags:
        - silenttouch
      parameters:
        - $ref: '#/components/parameters/sms_recruitment'
      requestBody:
        $ref: '#/components/requestBodies/aid_silenttouch_receipt_legacy_postData'
      responses:
        '200':
          description: receipt created
          content:
            application/json:
              schema:
                type: object
                properties:
                  duplicates:
                    type: integer
                  receipts:
                    type: array
                    items:
                      type: object
                      properties:
                        created_at:
                          type: string
                          format: date-time
                        created_by:
                          type: string
                        id:
                          type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        default:
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Legacy - Create new receipt
          sidebarTitle: Legacy - Create new receipt
  /accounts/{aid}/customers/company/departments:
    get:
      operationId: aid_company_departments_get
      summary: aid_company_departments_get
      description: |
        List all departments register by company customers

        scopes:
        - admin:customers
        - read:customers
        - public:customers
      tags:
        - company
      x-scopes:
        - admin:customers
        - read:customers
        - public:customers
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: organization_number
          in: query
          required: true
          schema:
            type: string
      security:
        - JWT: []
      responses:
        '200':
          description: company departments
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    organization_number:
                      type: string
                      example: 123456789MVA
                    departments:
                      type: array
                      example:
                        - Production
                        - Research and Development
                        - Accounting and Finance
                      items:
                        type: string
        '400':
          $ref: '#/components/responses/BadRequest'
      x-mint:
        metadata:
          title: Get departments
          sidebarTitle: Get departments
  /accounts/{aid}/offline/receipt:
    post:
      operationId: aid_offline_receipt_post
      summary: aid_offline_receipt_post
      description: |
        Process offline Dintero Receipt.

        Outage or service down during a purchase may result in
        a receipt with incomplete data.

          - missing `customer_id`
          - did not receive discounts
          - was not sent to the receipts service

        ## Use this endpoint to:

        **insert receipt** where `customer.token` will be resolved to `customer_id`
        if found.

          - The `token.value` will be excluded from the receipt created.

        **update receipt** with `customer_id` or resolve it from `customer.token`.
          - Update only allowed if the receipt has not customer_id
          - The receipt must have an `id`.

        **create debit discount** from the discounts that is applicable
        for the receipt.

          - Only possible if the receipt has not yet received any discounts
            (receipt.discounts empty)
          - All discount used in the debit discount will be claimed
          - A claim  can be reverted to release the discounts

        *NOTE:* All receipt properties other than `customer_id/customer.token` is
        read-only, and can't be updated with this endpoint.

        You can subscribe to `receipt_update` to receive notification on
        the update done to the receipt.

        `receipt_add` event will be published when sending a new receipt to
        this endpoint.

        ## Extra info

        A receipt sent to this endpoint will be extended with `extra_info` with info about
        the offline processing of the receipt.

          - `dintero.offline.receipt.created_at`: datetime, when sent to this endpoint
          - `dintero.offline.receipt.claim_id`: string, set if discounts was claimed
          - `dintero.offline.receipt.discount_debit_template_id`: string, set if debit template was used
          - `dintero.offline.receipt.discount_debit_id`: string, set if debit discount was created
          - `dintero.offline.receipt.customer_updated`: boolean, set if customer_id was updated
      tags:
        - offline
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: discount_debit_template_id
          description: |
            Calculate discounts from the receipt and give the reward
            as debit discount based on the template.

            All discounts that was used in the debit discount will be
            [claimed](/discounts-api/use-discounts/aid_discounts_available_for_receipt_post_claim)
            to ensure any limitation to be fullfilled.

            The receipt id will be used as claim ref to ignore
            duplicate offline receipts
          in: query
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - properties:
                    id:
                      type: string
                      format: uuid
                      description: |
                        An UUID that unniquely identifies the resource
                      readOnly: false
                    receipt_id:
                      type: string
                      minLength: 1
                - $ref: '#/components/schemas/Receipt'
        description: receipt
        required: true
      responses:
        '200':
          description: receipt created
          content:
            application/json:
              schema:
                type: object
                properties:
                  claim:
                    description: |
                      Discount claimed from the receipt
                    allOf:
                      - $ref: '#/components/schemas/Claim'
                  discount:
                    description: |
                      Debit discount created from discount calculated
                      from the receipt
                    allOf:
                      - $ref: '#/components/schemas/Discount'
                  duplicates:
                    type: integer
                  receipts:
                    type: array
                    minItems: 0
                    maxItems: 1
                    items:
                      type: object
                      properties:
                        created_at:
                          type: string
                          format: date-time
                        created_by:
                          type: string
                        id:
                          type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        default:
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: process receipt
          sidebarTitle: process receipt
  /accounts/{aid}/search/external/organizations/{country}:
    get:
      operationId: aid_search_external_organizations_country
      summary: aid_search_external_organizations_country
      description: |
        Proxy queries to the Norwegian or Danish organization registry.

        Please note that the only supported countries currently are "no" (Norway)
        and "dk" (Denmark).

        scopes:
        - public
      security:
        - JWT: []
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/startingAfter'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/country'
        - name: name
          description: Search for organization
          in: query
          required: false
          schema:
            type: string
        - name: organization_number
          description: Search for organization
          in: query
          required: false
          schema:
            type: string
      tags:
        - organizations
      responses:
        '200':
          description: Organization search result collection
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SearchExternalOrganizationResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Search external organization registry
          sidebarTitle: Search external organization registry
  /accounts/{aid}/silenttouch/receipt:
    post:
      operationId: aid_silenttouch_receipt_post
      summary: aid_silenttouch_receipt_post
      description: |
        create a new Dintero Receipt from SilentTouch receipt

        Requires existing
        [SalesLocation](https://docs.dintero.com/api.html#tag/locations)
        tobe define upfront before receiving SilentTouch receipt
      tags:
        - silenttouch
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/sms_recruitment'
      requestBody:
        $ref: '#/components/requestBodies/aid_silenttouch_receipt_legacy_postData'
      responses:
        '200':
          description: receipt created
          content:
            application/json:
              schema:
                type: object
                properties:
                  duplicates:
                    type: integer
                  receipts:
                    type: array
                    items:
                      type: object
                      properties:
                        created_at:
                          type: string
                          format: date-time
                        created_by:
                          type: string
                        id:
                          type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        default:
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Create new receipt
          sidebarTitle: Create new receipt
  /{instance}/sftp/customer:
    post:
      operationId: post_sftp_customer
      summary: post_sftp_customer
      description: |
        Endpoint for receiving customer events (webhooks) and
        transform the customer event to CSV and send it
        via SFTP.
      tags:
        - events
      parameters:
        - name: instance
          description: sftp instance
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                customer_id:
                  type: string
                first_name:
                  type: string
                last_name:
                  type: string
                email:
                  type: string
                phone_number:
                  type: string
                marketing_consent:
                  type: object
                  properties:
                    sms:
                      type: object
                      properties:
                        consent:
                          type: boolean
                        updated_at:
                          type: string
                          format: date-time
                    email:
                      type: object
                      properties:
                        consent:
                          type: boolean
                        updated_at:
                          type: string
                          format: date-time
                addresses:
                  type: array
                  items:
                    type: object
                    properties:
                      address_line:
                        type: string
                      address_line_2:
                        type: string
                      postal_code:
                        type: string
                      postal_place:
                        type: string
                updated_at:
                  type: string
                  format: date-time
        description: |
          Dintero webhook customer event, following are the
          properties used when creating the CSV file
          (8859 text, with CRLF, CR line terminators)

          CSV Example:
          ```
            id;name;email;email_consent;phonenr;sms_consent;address;postal_code;postal_name;last_updated
            7e4ff3e5-18fe-4932-b322-2a5f549a141f;Bob Smith;bs@test.dintero.com;TRUE;004799999999;TRUE;ROAD 1;0000;CITY;2018-02-13T15:28:48
          ```

          JSON to CSV mapping
            - customer_id: id
            - first_name,last_name: name
            - email
            - marketing_consent.email.consent: email_consent
            - phone_number: phonenr (+ replaced with 00)
            - marketing_consent.sms.consent: sms_consent
            - addresses[any].[address_line..]: address
            - addresses[any].[postal_code]: postal_code
            - addresses[any].[postal_place]: postal_name
            - updated_at: last_updated
        required: true
      responses:
        '200':
          description: csv of customer sent
          content:
            text/csv:
              schema:
                type: string
                example: |
                  id;name;email;email_consent;phonenr;sms_consent;address;postal_code;postal_name;last_updated
                  7e4ff3e5-18fe-4932-b322-2a5f549a141f;Bob Smith;bs@test.dintero.com;TRUE;004799999999;TRUE;ROAD 1;0000;CITY;2018-02-13T15:28:48
        '400':
          $ref: '#/components/responses/BadRequest'
      x-mint:
        metadata:
          title: Send customer events
          sidebarTitle: Send customer events
servers:
  - url: https://ei.api.dintero.com/v1/
  - url: https://ei.test.dintero.com/v1/
components:
  parameters:
    sms_recruitment:
      name: sms_recruitment
      description: |
        Send registration link by SMS to phone number found
        in the receipt.

        Requires a registration link and SMS to be enabled for
        the account, contact Dintero for support.
      in: query
      schema:
        type: boolean
        default: true
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
    startingAfter:
      name: starting_after
      in: query
      description: |
        cursor for use in pagination. starting_after is an object ID
        that defines your place in the list. For instance, if you make
        a list request and receive 100 objects, end the result contains
          `paging_token=pt1`, your subsequent call can include
        `starting_after=pt1` in order to fetch the next page of the list.
      required: false
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: |
        A limit on the number of objects to be returned. Limit can range
        between 1 and 100 items, and the default is 10 items.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 10
    country:
      name: country
      description: |
        ISO 3166-1 country code
      in: path
      required: true
      schema:
        type: string
  responses:
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Bad / Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  requestBodies:
    aid_silenttouch_receipt_legacy_postData:
      content:
        application/json:
          schema:
            type: object
            properties:
              receipts:
                type: array
                items:
                  type: string
                  description: silenttouch receipt
      description: SilentTouch receipt
      required: true
  securitySchemes:
    JWT:
      type: http
      description: |
        Bearer authentication (token authentication) should be used for accessing the API.

        Use [Get Token](/api-reference/authenticate/aid_auths_oauth_token_post) to get an access token for client credentials.
        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
    Entity:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was last updated
          readOnly: true
        deleted_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
    Item:
      type: object
      properties:
        id:
          type: string
          example: b714118
        group_id:
          type: string
          example: B1
    Limitation:
      type: object
      properties:
        dynamic_purchase_to_days:
          type: number
          format: int32
          minimum: 1
          description: |
            Limit the `purchase_to` to the time added to a customer + the days

            The customer discount rule `purchase_to` will be set to the minimum
            of `requirement.purchase_to` and `now + limitation.dynamic_purchase_to_days`
        discount_activation:
          type: array
          description: |
            Dynamically control if the discount should be active.
          items:
            minItems: 1
            maxItems: 1
            type: object
            required:
              - type
              - value
            properties:
              type:
                type: string
                description: |
                  - `deactivate_if_discount_active`: The discount is deactivated if
                    the value match the `id` of another active discount
                    available for the purchase
                enum:
                  - deactivate_if_discount_active
              value:
                type: string
                description: |
                  Value given the type
        discount_hours:
          type: object
          description: |
            Limit the discount to hours of the day
          required:
            - hours
          properties:
            timezone:
              description: |
                The timezone identifier for the hour start/end, see
                https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
                for examples. DST is handled when using a Timezone with DST.
              default: Europe/Oslo
              type: string
            hours:
              description: |
                an array of periods, day and time when discount will be
                available. Multiple periods for one day is accepted.
                Any hour of purchase is accepted if the array is empty.
              type: array
              items:
                type: object
                required:
                  - day
                  - start
                  - end
                properties:
                  day:
                    type: string
                    enum:
                      - mon
                      - tue
                      - wed
                      - thu
                      - fri
                      - sat
                      - sun
                  start:
                    type: string
                    pattern: ^([01]?[0-9]|2[0-3]):[0-5][0-9]$
                    example: '10:00'
                  end:
                    type: string
                    pattern: ^([01]?[0-9]|2[0-3]):[0-5][0-9]$
                    example: '20:00'
        discount_reward_usage:
          type: integer
          description: |
            Limit the number of rewards to be given in a purchase
            where multiple receipt items match the requirement
          example: 1
          default: -1
        discount_combination:
          type: integer
          description: |
            Limit how many other discounts can be combined in a purchase
            where multiple discounts are applicable.
          default: -1
          enum:
            - -1
            - 0
        discount_eligible:
          type: string
          description: |
            Limit what items in the purchase is eligible for this discount
          enum:
            - item_eligible_for_discount
            - item_eligible_for_discount_no_discount
            - receipt_no_discount
          default: item_eligible_for_discount
        discount_repeat_usage:
          type: integer
          description: |
            Limit how many purchases the discount can be used
          default: -1
        stamp_expire_days:
          type: integer
          description: |
            Number of days between first and last (exceeding count) stamp
            where reward will be given
          example: 100
          default: -1
        blacklist:
          type: array
          description: |
            items not eligible for discount.
          items:
            $ref: '#/components/schemas/Item'
          minItems: 1
    CustomerRequirement:
      type: object
      properties:
        addresses:
          type: array
          description: Require customer to have one or more addresses matching the properties. All properties defined must match a single address.
          items:
            type: object
            minItems: 1
            maxItems: 5
            properties:
              country:
                type: array
                example:
                  - 'NO'
                items:
                  type: string
                  minItems: 1
                  maxItems: 5
              postal_code:
                type: array
                example:
                  - '0349'
                items:
                  type: string
                  minItems: 1
                  maxItems: 5
              postal_place:
                type: array
                example:
                  - Oslo
                items:
                  type: string
                  minItems: 1
                  maxItems: 5
              custom_type:
                type: array
                example:
                  - offsite
                items:
                  type: string
                  minItems: 1
                  maxItems: 5
              type:
                type: array
                example:
                  - custom
                items:
                  type: string
                  minItems: 1
                  maxItems: 5
        company:
          type: object
          description: |
            Require customer to be a company matching all properties defined.
          properties:
            bussiness_name:
              type: array
              example:
                - TKP tech AS
              items:
                type: string
                minItems: 1
                maxItems: 5
            department:
              type: array
              example:
                - production
                - research
              items:
                type: string
                minItems: 1
                maxItems: 5
            industry:
              type: array
              example:
                - J62.0.1
                - J62.0.2
              items:
                type: string
                minItems: 1
                maxItems: 5
            number_of_employees:
              type: array
              example:
                - '20'
              items:
                type: string
                minItems: 1
                maxItems: 5
            organization_number:
              type: array
              example:
                - 123456789MVA
              items:
                type: string
                minItems: 1
                maxItems: 5
            website:
              type: array
              example:
                - https://dintero.com
              items:
                type: string
                minItems: 1
                maxItems: 5
        date_of_birth:
          type: array
          example:
            - '1990-09-20'
            - '1990-05-10'
          items:
            type: string
            minItems: 1
            maxItems: 5
        enrolled_by:
          type: object
          properties:
            type:
              type: array
              example:
                - url
              items:
                type: string
                minItems: 1
                maxItems: 5
            value:
              type: array
              example:
                - https://mypage.example.dintero.com
              items:
                type: string
                minItems: 1
                maxItems: 5
        favorite_store:
          type: array
          example:
            - sc029
          items:
            type: string
            minItems: 1
            maxItems: 5
        first_name:
          type: array
          example:
            - John
          items:
            type: string
            minItems: 1
            maxItems: 5
        gender:
          type: array
          example:
            - male
          items:
            type: string
            minItems: 1
            maxItems: 5
        last_name:
          type: array
          example:
            - Doe
          items:
            type: string
            minItems: 1
            maxItems: 5
        marketing_consent:
          type: object
          properties:
            email:
              type: object
              properties:
                consent:
                  type: array
                  example:
                    - 'true'
                  items:
                    type: string
                    minItems: 1
                    maxItems: 5
            sms:
              type: object
              properties:
                consent:
                  type: array
                  example:
                    - 'true'
                  items:
                    type: string
                    minItems: 1
                    maxItems: 5
        status:
          type: array
          example:
            - vip
          description: |
            limit discount to only receipt where customer status
            is included in the receipt and match one of the status
            values required by the discount
          items:
            type: string
            minItems: 1
            maxItems: 5
        term:
          type: object
          properties:
            id:
              type: array
              items:
                type: string
                minItems: 1
                maxItems: 5
        type:
          type: array
          items:
            type: string
            minItems: 1
            maxItems: 5
        attributes:
          type: object
          description: |
            Limit discount to only receipt where customer attributes are included
            and match one of the values required by the discount
          additionalProperties:
            type: array
            items:
              type: string
            minItems: 1
            maxItems: 5
    ItemMixProperty:
      type: object
      description: |
        Use mix in case where all items are required in one purchase.

        A reward will be eligible to all items in the mix that
        has `mix.reward_eligible=true`
      required:
        - items
        - quantity
        - reward_eligible
      properties:
        items:
          description: |
            Acceptable items for the mix "item" (`any`). No wildcard `*` is
            accepted.
          type: array
          example:
            - id: b714118
            - group_id: g4
          items:
            type: object
            minItems: 1
            properties:
              id:
                type: string
                example: b714118
                pattern: ^(\*.+|(?!\*).*)$
              group_id:
                type: string
                pattern: ^(\*.+|(?!\*).*)$
                example: g4
        quantity:
          type: number
          description: |
            minimum quantity of given item (match by id or group) by the mix
          minimum: 0
        reward_eligible:
          type: boolean
          description: |
            The item will be eligible for discount when calculating the reward
            Example: The value of `discount_item_new_price` reward will be the
            total price of all items in a mix that has the applicable set to `true`
    StoreRequirement:
      type: object
      properties:
        id:
          type: array
          items:
            type: string
            example: sc029
        name:
          type: array
          description: |
            name of the store, aka trade name of the store
          items:
            type: string
            example: SC Oslo
        business_name:
          type: array
          description: |
            Official name of the person or entity that owns the store.
          items:
            type: string
            example: SC Oslo AS
        address:
          type: object
          description: Require customer to have one or more addresses matching the properties. All properties defined must match a single address.
          properties:
            country:
              type: array
              example:
                - 'NO'
              items:
                type: string
                minItems: 1
                maxItems: 5
            postal_code:
              type: array
              example:
                - '0349'
              items:
                type: string
                minItems: 1
                maxItems: 5
            postal_place:
              type: array
              example:
                - Oslo
              items:
                type: string
                minItems: 1
                maxItems: 5
        chain:
          type: array
          items:
            type: string
            example: SuperChain
        email:
          type: array
          items:
            type: string
            example: contact@superchain.com
        gln:
          type: array
          items:
            type: string
            example: '5790001398644'
        organization_number:
          type: array
          items:
            type: string
            example: 123456789MVA
        phone_number:
          type: array
          items:
            type: string
            example: '+4738260107'
        mcc:
          type: array
          description: |
            A four-digit Merchant Category Code (MCC) for the store
            [ISO 18245:2003](https://www.iso.org/standard/33365.html)
          items:
            type: string
            format: iso-18245
            example: 5814
        mcc_ranges:
          type: array
          description: |
            Ranges of MCC codes to accept the discount for.
            Multiple ranges are possible.
            Prefer `mcc` if not a range.
          items:
            type: object
            required:
              - start
              - end
            properties:
              start:
                type: string
                format: iso-18245
                example: 5814
                minimum: 4
                maximum: 4
                pattern: ^\d{4}$
              end:
                type: string
                format: iso-18245
                example: 5815
                minimum: 4
                maximum: 4
                pattern: ^\d{4}$
        bax:
          type: array
          description: |
            Merchant number associated with the stores
            payment terminal
          items:
            type: string
            example: '102603'
        terminal_id:
          type: array
          description: |
            Id to a specific point-of-sale (POS) terminal
            or workstation
          items:
            type: string
            example: T0292
    BaseRequirement:
      type: object
      description: |
        Discount base requirement
      properties:
        customer:
          $ref: '#/components/schemas/CustomerRequirement'
        item:
          type: object
          properties:
            quantity:
              type: number
              description: |
                minimum number of items
              default: 0
              minimum: 0
            mixes:
              type: array
              minItems: 1
              description: |
                Required mix items for the discount.

                A purchase must include `all` the items to fulfill the `item.mixes`
                requirement.
              items:
                $ref: '#/components/schemas/ItemMixProperty'
            items:
              type: array
              description: |
                Required items for the discount

                A purchase can include `any` of the items to fulfill the `item.items`
                requirement.

                The values contols if the reward is given on the receipt (all items) or
                if they are limited to matching items

                **Receipt**
                - A rule with no items or items with only wildcard items

                **Item**
                - A rule with one or more items (except wildcard)
                - A rule with a single item `{"id": "ANY_ITEM"}` in items
              items:
                $ref: '#/components/schemas/Item'
              minItems: 1
        store_ids:
          type: array
          description: |
            `DEPRECATED`: [@since 2021-09-01](#section/Changelog/2021-09-01)
          items:
            type: string
            example: sc029
        gross_amount:
          type: integer
          description: |
            Minimum gross amount on purchase.
            Monetary amount in smallest unit for the currency
          default: 0
        net_amount:
          type: integer
          description: |
            Minimum net amount on purchase (amount after existing discounts).
            Monetary amount in smallest unit for the currency
          default: 0
        currencies:
          description: |
            List of valid currencies, or `[{"anything-but": ["NOK"]}]` to exclude currencies.
            Currency format is the three-character [ISO-4217 currency](https://en.wikipedia.org/wiki/ISO_4217).
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  anything-but:
                    type: array
                    items:
                      type: string
                      example: NOK
              - type: string
                example: NOK
        stamp:
          type: integer
          description: |
            Stamp count required for the reward
          example: 5
        discount_code:
          type: string
          description: |
            A code required for the reward. The purchase must include the
            promotion code in the `receipt.discount_code` property or as
            an `receipt.item` where the `item.id` is the promotion code.
          example: TACO
        store:
          $ref: '#/components/schemas/StoreRequirement'
    Requirement:
      type: object
      allOf:
        - $ref: '#/components/schemas/BaseRequirement'
        - required:
            - purchase_from
            - purchase_to
          properties:
            purchase_from:
              type: string
              format: date-time
            purchase_to:
              type: string
              format: date-time
    RewardBase:
      type: string
      description: |
        Let the discount reward be calculated from net or gross price.
        Not applicable for `discount_item_new_price`

        *Example*:
          item A à 100,- NOK with existing rebate of 20,-

          - 10% net reward is 10% of 80,- : 8,-
          - 10% gross reward is 10% of 100,- : 10,-

          * *net*: `gross - "any existing discounts"`
          * *gross*: `"total expense amount, including taxes"`
      default: gross
      enum:
        - net
        - gross
    Reward:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          description: |

            Reward Type:
              * `discount_amount` - value as discount
              * `discount_percent` - value percentage of gross amount
                  as discount
              * `discount_item_new_price` - discount as old price subtracted with value
              * `discount_item_quantity` - number of items to get as discount (free)
              * `discount_item_percent` - percent discount of the cheapest item (stamp)
                  as discount
              * `discount_debit` - value as discount, remaining amount after a
                purchase will be available in future purchases (if not limited by usage)
              * `discount_mix_new_price` - discount as old mix total value (reward_eligible=true)
                subtracted with value
          enum:
            - discount_amount
            - discount_percent
            - discount_item_new_price
            - discount_item_quantity
            - discount_item_percent
            - discount_mix_new_price
            - discount_debit
        value:
          example: 10000
          description: |
            The reward value, unit of the value is resolved
            from the reward type

            Examples:
              - Percent: 10.5
              - Amount: 10000 (amount in smallest unit for the currency)
              - Quantity: 1
          minimum: 0
          oneOf:
            - type: integer
            - type: number
        values:
          description: |
            Reward values that is used to "override" the reward value for matching items.
            Add support for having a single rule for multiple items that gives different
            reward value for each items

            > Only available for rules where `requirements.item.items` is non-empty.
          type: array
          minItems: 1
          items:
            type: object
            required:
              - items
              - value
            properties:
              items:
                type: array
                minItems: 1
                description: |
                  `id` or `group_id` is required, if both are included both id and
                  group id must match
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      example: b714118
                    group_id:
                      type: string
                      example: B1
              value:
                type: number
        base:
          $ref: '#/components/schemas/RewardBase'
        effect:
          type: string
          description: |
            How the reward will be added to the receipt.
            - `discount`: the reward will be applied as a discount directly on the receipt
            - `bonus`: the reward will be accumulated as bonus on the customers discount balance
          default: discount
          enum:
            - discount
            - bonus
    Links:
      description: Links to resources related to the discount
      type: array
      example:
        - href: https://example.dintero.com/c/photos/2018/6_20_thumbnail_discount_image.png
          rel: thumbnail_discount_image
        - href: https://example.dintero.com/c/photos/2018/6_20_medium_discount_image.png
          rel: medium_discount_image
        - href: https://example.dintero.com/shop?utm_source=dintero&utm_medium=email&utm_campaign=spring-summer
          rel: webshoop
        - href: https://example.dintero.com/newsletter/2018.pdf
          rel: newletter
          type: application/pdf
      items:
        type: object
        maxItems: 10
        required:
          - href
        properties:
          href:
            description: The URL of the link.
            type: string
            format: uri
          rel:
            description: |
              Specifies the relationship between the discount and the link

              Following `rel` values are reserved for specific usage

                - thumbnail_discount_image: link to discount image
                - medium_discount_image: link to discount image
                - large_discount_image: link to discount image
                - webshop: link to site where the discount may be used
            type: string
          type:
            type: string
            description: Specifies the media type of the link
    Discount:
      required:
        - requirement
        - reward
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was last updated
          readOnly: true
        deleted_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
        campaign_id:
          type: string
          description: |
            The campaign the rule belongs to
        active:
          description: |
            the discount is active and can be available
            for purchase (if given to any or all customers)
          type: boolean
          default: true
        private:
          description: |
            the discount will be excluded from  public discount collection
            (GET /discounts/public/rules).
          type: boolean
          default: false
        updated_by:
          type: string
          example: 3d1e4824-5474-48e7-a369-4f603fa4c5b8
          description: |
            The ID of the user/client that last updated the resource
          readOnly: true
        type:
          type: string
          description: The discount base type * `receipt` discount is given on receipt * `item` discount is given to items
          enum:
            - item
            - receipt
          readOnly: true
        name:
          type: string
          example: Spar 100,-
        receipt_text:
          type: string
          description: |
            Text that should be used when displaying
            the discount, e.g. on receipt
          example: Mai Salg
        visible_from:
          type: string
          format: date-time
          description: |
            Make the discount visible to the customer from
            given date. Default behavior is to only return
            discount to the customer where the current time
            is between purchase_from and purchase_to
        description:
          type: string
          example: Gjør et Stablestol kupp!
        limitation:
          $ref: '#/components/schemas/Limitation'
        requirement:
          $ref: '#/components/schemas/Requirement'
        reward:
          $ref: '#/components/schemas/Reward'
        metadata:
          type: object
          maxProperties: 10
          description: |
            Additional metadata about the discount

            Metadata prefixed with `dintero:exclude:public:` will
            be excluded when listing the rules from the public endpoint

            - [GET /v1/accounts/{aid}/discounts/public/rules](/discounts-api/rules/aid_discounts_public_get)

            and included in all other endpoints that returns discount rules
          example:
            campaign_id: V101
            is_featured: true
            dintero:private_text:kind: Gold
        links:
          $ref: '#/components/schemas/Links'
    DiscountRefs:
      allOf:
        - $ref: '#/components/schemas/Discount'
        - properties:
            refs:
              type: array
              description: |
                References to instances of the discount, a customer can
                have multiple instances of the same discount, this propery
                list the instances used
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: |
                      reference id to the customer instance of the
                      discount
                    example: e3da6be5-d8e0-466c-af66-b7f69472ebb5
                  stamp:
                    type: integer
                    description: |
                      number of stamp collected by the discount when
                      used on the receipt.
                  amount:
                    type: integer
                    description: |
                      reward amount for the the ref used,
                      monetary amount in smallest unit for the currency
                    example: 10000
                  bonus:
                    type: integer
                    description: |
                      reward bonus for the ref used
                    example: 9050
                  statistics:
                    type: object
                    description: |
                      statistics for given discount instance (ref)
                    properties:
                      amount:
                        type: integer
                        description: |
                          total amount discount given, inclusive discount
                          amounts from previous purchases where the
                          the discount was used
                        example: 15050
                      bonus:
                        type: integer
                        description: |
                          total bonus given, inclusive bonus from previous
                          purchases where the the discount was used
                        example: 11050
                      debit_balance:
                        type: integer
                        description: |
                          the discount debit balance, only applicable if
                          discount reward type is `discount_debit`
                        example: 12350
                      stamp:
                        type: integer
                        description: |
                          total stamp collected by the discount, inclusive
                          previous purchases
                        example: 11
                      usage:
                        type: integer
                        description: |
                          total times the discount reward was used,
                          inclusive discount usage from previous purchases
                        example: 2
                  items:
                    type: array
                    description: |
                      Items receiving the discount, list what items
                      received an discount_lines entry for this discount
                    example:
                      - line_id: 1
                        amount: 3000
                      - line_id: 5
                        amount: 7000
                    items:
                      type: object
                      properties:
                        line_id:
                          type: integer
                          description: |
                            item line_id
                        bonus:
                          type: integer
                          description: bonus for given line_id
                        amount:
                          type: integer
                          description: |
                            discount amount for given line_id
                            monetary amount in smallest unit for the currency
                  usage:
                    type: integer
                    description: number of times the ref was used
                    example: 1
    Address:
      type: object
      required:
        - address_line
        - postal_place
        - country
      properties:
        address_line:
          type: string
          example: Sommerkroveien 34
        address_line_2:
          type: string
          example: PB 123
        postal_code:
          type: string
          example: '0349'
        postal_place:
          type: string
          example: Oslo
        country:
          type: string
          format: iso-3166-1
          description: |
            ISO 3166-1 country code
          example: 'NO'
    Store:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          example: sc029
        name:
          type: string
          description: |
            name of the store, aka trade name of the store
          example: SC Oslo
        business_name:
          type: string
          description: |
            Official name of the person or entity that owns the store.
          example: SC Oslo AS
        address:
          $ref: '#/components/schemas/Address'
        chain:
          type: string
          example: SuperChain
        email:
          type: string
          example: contact@superchain.com
        gln:
          type: string
          example: '5790001398644'
        organization_number:
          type: string
          example: 123456789MVA
        phone_number:
          type: string
          example: '+4738260107'
        mcc:
          type: string
          format: iso-18245
          description: |
            A four-digit Merchant Category Code (MCC) for the store
            [ISO 18245:2003](https://www.iso.org/standard/33365.html)
          example: '5814'
          minimum: 4
          maximum: 4
        bax:
          type: string
          example: '102603'
          description: |
            Merchant number associated with the stores
            payment terminal
        terminal_id:
          type: string
          description: |
            Id to a specific point-of-sale (POS) terminal
            or workstation
          example: T0292
        payout_destination_id:
          type: string
          maxLength: 40
          description: |
            The payout destination id for the merchant of record,
            i.e. the seller responsible for the transaction.

            Required when `seitatech.in_person` payment is enabled.
          example: seller-1
    InfoCodeItem:
      type: object
      properties:
        line_id:
          type: integer
          example: 1
        amount:
          type: integer
          description: |
            Monetary amount in smallest unit for the currency
        amount_dwh:
          type: string
          example: '1.14'
          description: Monetary value with decimal
        infocode_id:
          type: string
        sub_infocode_id:
          type: string
        information:
          type: string
        input_type:
          type: integer
        withdrawal_from_stock:
          type: boolean
          example: false
    TaxItem:
      type: object
      properties:
        amount:
          type: integer
          example: 5584
          description: |
            Monetary amount in smallest unit for the currency
        amount_dwh:
          type: string
          example: '5584.0440'
          description: Monetary value with decimal
        exempt:
          type: boolean
          example: false
        included_in_price:
          type: boolean
          example: true
        percentage:
          type: number
          example: 25
        tax_basis:
          type: integer
          example: 27920
          description: Total monetary value without tax
        tax_basis_dwh:
          type: string
          example: '27920.22'
          description: Total monetary value without tax in decimal
        tax_code:
          type: string
          example: '3'
        tax_group:
          type: string
          example: Vmva-høy
    Dimension:
      type: object
      description: |
        Identify item attributes, such as size and color
      properties:
        color:
          type: string
        size:
          type: string
        style:
          type: string
        config:
          type: string
        variant:
          type: string
    DiscountType:
      type: string
      enum:
        - customer
        - periodic
        - manual
        - loyalty
        - total
        - employee
        - external
    DiscountItem:
      type: object
      properties:
        amount:
          type: integer
          example: 4400
          description: |
            Monetary amount in smallest unit for the currency
        percentage:
          type: number
          description: |
            Optional, set if the amount given was from a percentage discount
          example: 44
        discount_type:
          $ref: '#/components/schemas/DiscountType'
        discount_id:
          type: string
          example: 766da0ef-9283-42bd-b012-0582344ec53c
        description:
          type: string
        line_id:
          type: integer
          example: 1
    BonusItem:
      type: object
      properties:
        bonus:
          type: integer
          example: 3130
          description: Bonus in smallest unit for the currency
        percentage:
          type: number
          description: |
            Optional, set if the bonus given was from a percentage discount
          example: 10
        discount_type:
          $ref: '#/components/schemas/DiscountType'
        discount_id:
          type: string
          example: 766da0ef-9283-42bd-b012-0582344ec53c
        description:
          type: string
        line_id:
          type: integer
          example: 1
    ExtraInfo:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
        value_type:
          type: string
          enum:
            - string
            - integer
            - number
            - boolean
            - datetime
    ReceiptItem:
      type: object
      properties:
        id:
          type: string
          example: '175938'
        groups:
          type: array
          example:
            - id: B234
              name: Stol
            - id: B1
              name: Møbel
          items:
            type: object
            required:
              - id
            properties:
              id:
                type: string
                description: group id
              name:
                type: string
                description: group name
        quantity:
          type: number
          example: 2
          default: 1
        unit:
          type: string
          example: stk
          description: unit type
        description:
          type: string
          example: Stablestol for utendørsbruk
        description_alias:
          type: string
          example: Stablestol
        net_amount:
          type: integer
          example: 27840
          description: |
            Monetary amount in smallest unit for the currency
            after discounts for items in this line
        net_amount_dwh:
          type: string
          example: '27840.10'
          description: |
            Monetary amount in smallest unit for the currency
            after discounts for items in this line in decimal
        gross_amount:
          type: integer
          example: 39800
          description: |
            Monetary amount in smallest unit for the currency
            before discounts for items in this line
        gross_amount_dwh:
          type: string
          example: '34800.12'
          description: |
            Monetary amount in smallest unit for the currency
            before discounts for items in this line in decimal
        unit_gross_price:
          type: integer
          example: 10900
        tax_percent:
          type: number
          example: 25
        line_id:
          type: integer
          example: 1
        barcode:
          type: string
          example: '3123212343212'
        cost_price:
          type: integer
          example: 2033
          description: The purchase price the company pay for item
        voided:
          type: boolean
          example: false
        scale_item:
          type: boolean
          example: false
          description: |
            The price is calculated from scale (weight/volume).
        eligible_for_discount:
          type: boolean
          example: true
        included_in_total_discount:
          type: boolean
          example: true
        price_has_been_keyedIn:
          type: boolean
          example: false
        discount_has_been_keyedIn:
          type: boolean
          example: false
        is_return_item:
          type: boolean
          example: false
        is_linked_item:
          type: boolean
          example: false
        is_virtual_product:
          type: boolean
          example: false
        is_changed:
          description: Discount applied to gross amount
          type: boolean
          example: true
        salesperson_id:
          type: string
          description: |
            Id of the sales person if other
            then the operator
          example: '000111'
        salesperson_name:
          type: string
          description: |
            Name of the sales person
          example: Jesper
        serial_id:
          type: string
          example: '32424234231312312'
        comment:
          type: string
          example: Kan være hva som helst
        infocode_lines:
          type: array
          items:
            $ref: '#/components/schemas/InfoCodeItem'
        tax_lines:
          type: array
          items:
            $ref: '#/components/schemas/TaxItem'
        dimension:
          $ref: '#/components/schemas/Dimension'
        discount_lines:
          type: array
          items:
            $ref: '#/components/schemas/DiscountItem'
        bonus_lines:
          type: array
          items:
            $ref: '#/components/schemas/BonusItem'
        extra_info:
          type: array
          items:
            $ref: '#/components/schemas/ExtraInfo'
    CardInfo:
      type: object
      properties:
        balance_amount:
          type: integer
          description: |
            Monetary amount in smallest unit for the currency
        card_amount:
          type: integer
          description: |
            Monetary amount in smallest unit for the currency
        issuer_id:
          type: integer
        issuer_name:
          type: string
          example: Barcley
        session_id:
          type: string
          example: '022'
        terminal_id:
          type: string
          example: '71015233'
        card_number:
          type: string
          example: '************00198-1'
        card_type:
          type: string
          example: VISA
        receipt:
          type: string
          example: |
            BAX: 111010-71015233\n\r\11/11/2015 14:41\n\r\345849\n\r\ VISA CLASSIC\n\r\************5671\n\r\AID:A0000000031010\n\r\ REF:011 006687000000\n\r\RESP:00 GODKJENT\n\r\RETUR AV VARER\n\r \NOK=           50.00\n\r\SIGNATUR................\n\r \KORTHOLDERS KOPI
    PaymentItem:
      type: object
      properties:
        line_id:
          type: integer
          example: 1
        amount:
          type: integer
          description: |
            Monetary amount in smallest unit for the currency
        type_id:
          type: string
        token_id:
          type: string
          description: Id of the token
          example: 983558fe-05bd-495f-92b5-9075d085db32
        token_type:
          type: string
          description: The token issuer
          example: VIPPS
        description:
          type: string
        voided:
          type: boolean
        card_info:
          $ref: '#/components/schemas/CardInfo'
        reference_id:
          type: string
          example: B00668107235
        infocode_lines:
          type: array
          items:
            $ref: '#/components/schemas/InfoCodeItem'
    Receipt:
      allOf:
        - $ref: '#/components/schemas/Entity'
        - required:
            - store
            - receipt_id
            - purchase_at
          properties:
            discounts:
              description: |
                List all discounts referenced in discount_lines
              type: array
              items:
                $ref: '#/components/schemas/DiscountRefs'
            store:
              $ref: '#/components/schemas/Store'
            items:
              type: array
              items:
                $ref: '#/components/schemas/ReceiptItem'
            receipt_id:
              type: string
              example: '714118'
            delivery:
              type: object
              description: |
                Details for the delivery
              properties:
                first_name:
                  type: string
                  example: John
                last_name:
                  type: string
                  example: Doe
                email:
                  type: string
                  example: customer@example.com
                phone_number:
                  type: string
                  description: |
                    A phone number in E.164 number formatting.
                  format: ^\+?[1-9]\d{1,14}$
                  example: '+4799999999'
                address:
                  $ref: '#/components/schemas/Address'
            customer_id:
              type: string
              description: |
                The customer id identifying the customer.
                (must not have trailing or leading spaces)
              example: C13db4f63
              maxLength: 255
            customer:
              type: object
              description: |
                The customer, owner of the receipt
              properties:
                gender:
                  type: string
                  example: male
                first_name:
                  type: string
                  example: John
                last_name:
                  type: string
                  example: Doe
                email:
                  type: string
                  example: customer@example.com
                metadata:
                  type: object
                  description: |
                    A set of key/value pairs that you can attach to a
                    customer object. It can be useful for storing additional
                    information about the customer in a structured format.
                  example:
                    dob_year: 1985
                phone_number:
                  type: string
                  description: |
                    A phone number in E.164 number formatting.
                  format: ^\+?[1-9]\d{1,14}$
                  example: '+4799999999'
                addresses:
                  type: array
                  items:
                    allOf:
                      - $ref: '#/components/schemas/Address'
                      - properties:
                          type:
                            type: string
                          custom_type:
                            type: string
                pays_tax:
                  type: boolean
                  description: |
                    Is customer required to pay tax
                  example: false
                date_of_birth:
                  type: string
                  format: date
                  example: '1990-09-20'
                  nullable: true
                enrolled_by:
                  type: object
                  required:
                    - value
                  description: discribe where customers was recruit from
                  properties:
                    type:
                      type: string
                      description: |
                        Enrollment type, e.g. `url`, `store`, `qr_code`, any string
                      example: url
                    value:
                      type: string
                      example: https://facebook.com
                      nullable: true
                favorite_store:
                  type: string
                  description: customer favorite store
                  nullable: true
                company:
                  type: object
                  required:
                    - bussiness_name
                  description: |
                    Company details, supported when type is Company
                  properties:
                    organization_number:
                      type: string
                      description: Companys identification number
                      example: 123456789MVA
                    bussiness_name:
                      type: string
                      example: TKP tech AS
                    department:
                      type: string
                      description: companys department
                      example: sales department
                    industry:
                      type: string
                      example: computer industry
                    website:
                      type: string
                    number_of_employees:
                      type: string
                marketing_consent:
                  type: object
                  description: Customers consent for marketing in different channels
                  properties:
                    sms:
                      type: object
                      properties:
                        consent:
                          type: boolean
                          example: true
                        updated_at:
                          readOnly: true
                          type: string
                          format: date-time
                          example: '2018-01-12T13:42:00Z'
                          description: |
                            The date-time when the resource was last updated:
                    email:
                      type: object
                      properties:
                        consent:
                          type: boolean
                          example: true
                        updated_at:
                          readOnly: true
                          type: string
                          format: date-time
                          example: '2018-01-12T13:42:00Z'
                          description: |
                            The date-time when the resource was last updated:
                status:
                  type: string
                  description: |
                    Status of the customer
                term:
                  description: The term and condition accepted by the customer
                  properties:
                    id:
                      type: string
                type:
                  type: string
                  enum:
                    - customer
                    - company
                    - contact
                    - employee
                    - other
                  description: |
                    Describe type of an customer.
                    Company only allowed to be set when the type is "Company"
                token:
                  type: object
                  description: |
                    Token used to identify the customer
                  properties:
                    token_id:
                      type: string
                      description: |
                        Id of token identifying the customer
                      example: 983558fe-05bd-495f-92b5-9075d085db32
                    value:
                      type: string
                      description: |
                        Token value that combined with type
                        was used to identify the customer
                      example: 5345346544ffea22
                    type:
                      type: string
                      description: The token issuer
                      example: VIPPS
            gross_amount:
              type: integer
              description: |
                Monetary amount in smallest unit for the currency
                before discounts
              example: 59800
            gross_amount_dwh:
              type: string
              description: |
                Monetary amount in smallest unit for the currency
                before discounts with decimal
              example: '59800.01'
            net_amount:
              type: integer
              example: 47840
              description: |
                Monetary amount in smallest unit for the currency
                after discounts
            net_amount_dwh:
              type: string
              description: Monetary value in smallest unit for the currency after discounts with decimal
              example: '47840.01'
            round_off_to_coin:
              type: integer
              example: 100
            currency:
              type: string
              example: NOK
              description: |
                The three-character ISO-4217 currency.
                https://en.wikipedia.org/wiki/ISO_4217
            purchase_at:
              description: |
                The date and time for the receipt purchase
              type: string
              format: date-time
            order_number:
              type: string
              example: order12345
            transaction_date:
              type: string
              format: date-time
            amount_due:
              type: integer
              description: |
                How much more need to be paid before the
                transaction is completed.
                Monetary amount in smallest unit for the currency
              example: 2050
            amount_due_dwh:
              type: string
              example: '2050.10'
              description: Monetary value with decimal
            no_of_items:
              type: number
              description: |
                How many items did the customer buy
              example: 4
            is_changed:
              description: Discount applied to gross amount
              type: boolean
            transaction_id:
              type: string
              example: SC999-9991-1828
            total_discount:
              type: integer
              example: 0
            total_manual_discount_amount:
              type: integer
              example: 0
              description: |
                Monetary amount in smallest unit for the currency
            total_manual_percentage_discount:
              type: integer
              example: 0
            operator_id:
              type: string
              description: POS user
              example: '000210'
            operator_name:
              type: string
              description: Name of the POS user
              example: Ole Anders
            salesperson_id:
              type: string
              description: ID of the POS user
              example: '000111'
            salesperson_name:
              type: string
              example: Jesper
            entry_status:
              type: string
              description: Status for the transaction
              enum:
                - None
                - Voided
                - Posted
                - Concluded
                - Cancelled
                - OnHold
                - Training
                - Reprinted
            comment:
              type: string
              example: Kunden ønsker mer for info
            tax_lines:
              description: |
                Breakdown of the tax to different
                tax groups
              type: array
              items:
                $ref: '#/components/schemas/TaxItem'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/PaymentItem'
            infocode_items:
              type: array
              items:
                $ref: '#/components/schemas/InfoCodeItem'
            receipt_text:
              type: string
            discount_code:
              type: array
              items:
                type: string
            extra_info:
              type: array
              items:
                $ref: '#/components/schemas/ExtraInfo'
    Claim:
      type: object
      allOf:
        - $ref: '#/components/schemas/Entity'
        - required:
            - customer_id
            - discounts
            - purchase_at
          properties:
            ref:
              type: string
              description: |
                an external reference for the claim. Must be unique
                for the claim, reuse of ref will result in conflict
              example: transactionid1
            type:
              type: string
              description: |
                an external type for the claim
              example: pos
            purchase_at:
              type: string
              format: date-time
              description: |
                The date and time for the purchase the
                claim is done for.
            customer_id:
              type: string
              maxLength: 255
              description: |
                The customer id you have defined for the customer.
                (must not have trailing or leading spaces)
            discounts:
              type: array
              description: |
                Discounts to claim
              minItems: 1
              items:
                type: object
                required:
                  - id
                  - refs
                properties:
                  id:
                    description: |
                      Discount ID
                    type: string
                  refs:
                    type: array
                    description: |
                      Customer reference to the discount
                    minItems: 1
                    items:
                      type: object
                      required:
                        - id
                        - usage
                        - amount
                      properties:
                        id:
                          type: string
                          description: |
                            reference id to the customer instance of
                            the discount
                        amount:
                          type: integer
                          description: |
                            the amount for the ref to be claimed
                          minimum: 0
                          exclusiveMinimum: true
                        usage:
                          type: integer
                          description: number of times the ref should be claimed
                          example: 1
                          minimum: 0
                          exclusiveMinimum: true
    SearchExternalOrganizationResult:
      type: object
      required:
        - response_from
        - organization_type
        - organization_number
        - business_name
      properties:
        response_from:
          type: string
          enum:
            - enhetsregisteret
            - cvr
            - underenheter
          example: enhetsregisteret
        organization_type:
          type: string
          example: AS
          description: |
            A code or string specifying the type of organization.
        phone_number:
          type: string
          description: |
            A phone number in E.164 number formatting.
          format: ^\+?[1-9]\d{1,14}$
          example: '+4799999999'
        email:
          type: string
          example: hello@company.com
        organization_number:
          type: string
          description: Company identification number.
          example: 123456789MVA
        business_name:
          type: string
          description: The location's legal name.
          example: TKP technology AS
        business_address:
          $ref: '#/components/schemas/Address'
        registry_address:
          $ref: '#/components/schemas/Address'
        website_url:
          type: string
          description: The company's website.
