x-explorer-enabled: false
openapi: 3.0.3
servers:
  - url: 'https://wallet.sandbox.uk.eagleeye.com/2.0'
    description: Sandbox UK
  - url: 'https://wallet.uk.eagleeye.com/2.0'
    description: UK Production
  - url: 'https://wallet.au.eagleeye.com/2.0'
    description: AU Production
  - url: 'https://wallet.us2.eagleeye.com/2.0'
    description: US2 Production
  - url: 'https://wallet.us.eagleeye.com/2.0'
    description: US Production
info:
  title: Tiers API
  description: >-
    These APIs are used for managing customer Tier Memberships in the Eagle Eye 
    Air platform. These APIs allow a customer to be placed in a Tier, to update
    their Tier Membership Balances, to manually move them into another Tier as well as retrieving
    their current Tier Membership Balances and Tier Membership Transaction history.

  version: 1.1.0
  contact:
    name: Eagle Eye Solutions
    url: 'https://www.eagleeye.com/'
tags:
  - name: Tier Membership
    description: API endpoints for managing a customer Tier Membership.
  - name: Tier Membership Transaction
    description: API endpoints for completing Transactions against a Tier Membership

paths:
  /wallet/{walletId}/account/{accountId}/membership:
    get:
      summary: Retrieve a Customer's Current Tier Membership
      operationId: getTierMembership
      description: >-
        This API allows a calling application to retrieve the current Tier Membership details for a customer.
      tags:
        - Tier Membership
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      responses:
        '200':
          $ref: '#/components/responses/tierMembershipResponseEntity'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /tier/{tierId}/membership:
    post:
      summary: Add a Customer into a Tier
      operationId: addTierMembership
      deprecated: true
      description: >-
        This API allows a customer's Loyalty Account to be given a Tier Membership.
      tags:
        - Tier Membership
      parameters:
        - $ref: '#/components/parameters/tierId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipCreateRequestEntity'
      responses:
        '201':
          description: >-
            The Tier Membership entity which defines the current state of a customer's Tier Membership.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tierMembershipEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.CREATE
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/{tierId}/membership/{tierMembershipId}:
    patch:
      summary: Update a Customer's Tier Membership
      operationId: updateTierMembership
      description: >-
        This API allows a customer's Loyalty Account Tier Membership to be updated.
      tags:
        - Tier Membership
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierId'
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipUpdateRequestEntity'
      responses:
        '200':
          description: >-
            The Tier Membership entity which defines the current state of a customer's Tier Membership.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tierMembershipEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.UPDATE
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /tier/membership/{tierMembershipId}/move:
    patch:
      summary: Move a Customer into a different Tier
      operationId: moveTierMembership
      deprecated: true
      description: >-
        This API allows a calling application to move a customer into a new Tier.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipMoveRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.MOVE
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /tier/membership/{tierMembershipId}/credit:
    patch:
      summary: Credit a Customer's Tier Membership Balances
      operationId: creditTierMembershipBalances
      deprecated: true
      description: >-
        This API allows a calling application to increase the balances of a customer tier. This API 
        enforces a positive movement of the balances. Only positive integers can be passed in the 
        balances object of the request payload.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.CREDIT
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /tier/membership/{tierMembershipId}/debit:
    patch:
      summary: Debit a Customer's Tier Membership Balances
      operationId: debitTierMembershipBalances
      deprecated: true
      description: >-
        This API allows a calling application to decrease the Tier Membership Balances for a customer. This 
        API completes a negative movement of balances only. The values passed in the balances of the request
        are validated to always be positive integers.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.DEBIT
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /tier/membership/{tierMembershipId}/adjust:
    patch:
      summary: Adjust a Customer's Tier Membership Balances
      operationId: adjustTierMembershipBalances
      deprecated: true
      description: >-
        This API allows a calling application to adjust the balances of a customer's Tier Membership. This API can 
        change balances in both a positive and negative direction. The values passed in the balances of the request 
        are allowed to be either positive or negative integers.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.ADJUST
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/{tierId}/membership:
    post:
      summary: Add a Customer into a Tier
      operationId: addTierMembershipWithWalletId
      description: >-
        This API allows a customer's Loyalty Account to be given a Tier Membership.
      tags:
        - Tier Membership
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipCreateRequestEntity'
      responses:
        '201':
          description: >-
            The Tier Membership entity which defines the current state of a customer's Tier Membership.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tierMembershipEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.CREATE
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/membership/{tierMembershipId}/move:
    patch:
      summary: Move a Customer into a different Tier
      operationId: moveTierMembershipWithWalletId
      description: >-
        This API allows a calling application to move a customer into a new Tier.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipMoveRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.MOVE
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/membership/{tierMembershipId}/credit:
    patch:
      summary: Credit a Customer's Tier Membership Balances
      operationId: creditTierMembershipBalancesWithWalletId
      description: >-
        This API allows a calling application to increase the balances of a customer tier. This API 
        enforces a positive movement of the balances. Only positive integers can be passed in the 
        balances object of the request payload.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.CREDIT
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/membership/{tierMembershipId}/debit:
    patch:
      summary: Debit a Customer's Tier Membership Balances
      operationId: debitTierMembershipBalancesWithWalletId
      description: >-
        This API allows a calling application to decrease the Tier Membership Balances for a customer. This 
        API completes a negative movement of balances only. The values passed in the balances of the request
        are validated to always be positive integers.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.DEBIT
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

  /wallet/{walletId}/tier/membership/{tierMembershipId}/adjust:
    patch:
      summary: Adjust a Customer's Tier Membership Balances
      operationId: adjustTierMembershipBalancesWithWalletId
      description: >-
        This API allows a calling application to adjust the balances of a customer's Tier Membership. This API can 
        change balances in both a positive and negative direction. The values passed in the balances of the request 
        are allowed to be either positive or negative integers.
      tags:
        - Tier Membership Transaction
      parameters:
        - $ref: '#/components/parameters/walletId'
        - $ref: '#/components/parameters/tierMembershipId'
        - $ref: '#/components/parameters/eesAuthenticationClientId'
        - $ref: '#/components/parameters/eesAuthenticationRequestHash'
        - $ref: '#/components/parameters/httpAcceptEncoding'
        - $ref: '#/components/parameters/eesMessageId'
        - $ref: '#/components/parameters/eesMessageRetry'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/tierMembershipTransactionRequestEntity'
      responses:
        '201':
          description: >-
            An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
          content:
            application/json:
              schema:
                type: object
                required:
                  - membership
                  - transactions
                properties:
                  membership:
                    $ref: '#/components/schemas/tierMembershipEntity'
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
          x-eventNotifications:
            events:
              - eventName: TIER.MEMBERSHIP.ADJUST
                atomicOperations:
                  - schema:
                      $ref: '#/components/schemas/tierMembershipEntity'
                    operationType: UPDATE
                  - schema:
                      $ref: '#/components/schemas/tierMembershipTransactionEntity'
                    operationType: CREATE
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '415':
          $ref: '#/components/responses/unsupportedMediaType'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/serverError'

components:
  parameters:
    eesAuthenticationClientId:
      name: X-EES-AUTH-CLIENT-ID
      in: header
      description: Client ID, This will be provided by EES and is unique to the company calling the API.
      required: true
      schema:
        type: string
        format: string
    eesAuthenticationRequestHash:
      name: X-EES-AUTH-HASH
      in: header
      description: Request Security Hash, calculated using SHA-256 function from concatenated full Request
        URI Path with Query String(s), Payload and Client Secret.
      required: true
      schema:
        type: string
        format: string
    eesMessageId:
      name: X-EES-TRANSACTION-ID
      in: header
      description: Unique Reference for the API transaction within the calling company.
      required: false
      schema:
        type: string
        format: string
    eesMessageRetry:
      name: X-EES-RETRY
      in: header
      description: This flag denotes the number of attempts that have been made for this request.
      required: false
      schema:
        type: string
        format: string
    httpAcceptEncoding:
      name: Accept-Encoding
      in: header
      required: false
      description: >
        This request HTTP header advertises which content encoding (usually a
        compression algorithm) the calling application is able to understand.
        The server selects one of the proposals, use it and informs the client
        of its choice with the Content-Encoding response header. Currently
        supported `gzip` and `deflate`, if request header not present no
        compression will be used.
      schema:
        type: string
        enum:
          - ''
          - gzip
          - deflate
          - 'gzip,deflate'
        default: ''

    walletId:
      name: walletId
      in: path
      required: true
      description: EES Air Wallet ID
      schema:
        type: string

    accountId:
      name: accountId
      in: path
      required: true
      description: EES Air Account ID
      schema:
        type: string

    tierId:
      name: tierId
      in: path
      required: true
      description: The ID of a Tier defined in Air
      schema:
        type: string

    tierMembershipId:
      name: tierMembershipId
      in: path
      required: true
      description: The ID of the Tier Membership for a given customer
      schema:
        type: string

  responses:
    badRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/defaultErrorEntity'

    unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/defaultErrorEntity'
          example:
            errorCode: AF
            errorMessage: >-
              Authentication Failure, Please check if required AUTH
              headers are present in your Request and if AUTH Hash is
              calculated correctly

    forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/defaultErrorEntity'
            example:
              errorCode: P
              errorMessage: >-
                You don't have appropriate Privileges to perform this
                operation

    notFound:
      description: Not Found
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/defaultErrorEntity'
            example:
              errorMessage: Not Found
              errorCode: NF

    conflict:
      description: Conflict
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/defaultErrorEntity'
            example:
              errorMessage: Conflict
              errorCode: C

    unsupportedMediaType:
      description: Unsupported Media Type
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/defaultErrorEntity'
            example:
              errorMessage: Unsupported media type - Check the content type of your request
              errorCode: MP

    tooManyRequests:
      description: Too Many Requests
      headers:
        Retry-after:
          description: The number of seconds after which to retry the request
          schema:
            type: integer
      content:
        application/json:
          schema:
            properties:
              errorCode:
                type: string
                description: The error code
                enum:
                  - 'CE'
              errorMessage:
                type: string
                description: The error message for this error
                enum:
                  - 'This request has been throttled. Please try again later.'

    serverError:
      description: Server Error
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/defaultErrorEntity'
            example:
              errorMessage: Internal Server Error

    tierMembershipResponseEntity:
      description: >-
        The Tier Membership entity which defines the current state of a customer's Tier Membership.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tierMembershipEntity'

    tierMembershipTransactionResponseEntity:
      description: >-
        An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership.
      content:
        application/json:
          schema:
            type: object
            required:
              - membership
              - transactions
            properties:
              membership:
                $ref: '#/components/schemas/tierMembershipEntity'
              transactions:
                type: array
                items:
                  $ref: '#/components/schemas/tierMembershipTransactionEntity'

  schemas:
    tierMembershipTransactionRequestEntity:
      type: object
      required:
        - balances
      properties:
        walletTransactionId:
          type: string
          description: >-
            The ID of a Wallet Transaction to associate to this Tier Membership Transaction.
        balances:
          type: object
          properties:
            points:
              type: integer
              description: >-
                The number of Tier Membership Points to alter in the customer's Tier Membership Balance. One or many 
                Tier Membership Balance Types can be passed together.
            transactions:
              type: integer
              description: >-
                The number of Tier Membership Transactions to alter against the customer's Tier Membership Balance. 
                One or many Tier Membership Balance Types can be passed together.
            spend:
              type: integer
              description: >-
                The amount of Tier Membership Spend to alter against the customer's Tier Membership Balance. One or 
                many tier Tier Membership Balance Types can be passed together.

    tierMembershipCreateRequestEntity:
      type: object
      required:
        - accountIds
        - status
      allOf:
        - type: object
          properties:
            status:
              type: string
              enum:
                - ACTIVE
            expiryDate:
              nullable: true
              $ref: "#/components/schemas/dateTimeEntity"
            tierBalancesResetDate:
              nullable: true
              $ref: "#/components/schemas/dateTimeEntity"
            accountIds:
              type: array
              minItems: 1
              description: >-
                An array of accountIds with which to link this Tier Membership.
              items:
                type: string

    tierMembershipUpdateRequestEntity:
      type: object
      anyOf:
        - required:
            - expiryDate
        - required:
            - tierBalancesResetDate
      properties:
        expiryDate:
          nullable: true
          description: DateTime in ATOM format, cannot be in the past.
          allOf:
            - $ref: "#/components/schemas/dateTimeEntity"
        tierBalancesResetDate:
          nullable: true
          description: DateTime in ATOM format, cannot be in the past.
          allOf:
            - $ref: "#/components/schemas/dateTimeEntity"

    tierMembershipMoveRequestEntity:
      type: object
      required:
        - tierId
      properties:
        walletTransactionId:
          type: string
          description: >-
            A Wallet Transaction Id to associate to this Tier Membership Transaction.
        tierId:
          type: string
          description: >-
            The ID of the Tier in which to place the customer.
        expiryDate:
          $ref: '#/components/schemas/dateTimeEntity'

    tierMembershipBalancesEntity:
      type: object
      properties:
        transactions:
          type: integer
          description: >-
            The value representing the Tier Membership Balance for a customer's Tier Membership relating to the 
            number of Tier Membership Transactions completed.
        spend:
          type: integer
          description: >-
            The value representing the Tier Membership Balance for a customer's Tier Membership relating to the 
            Tier Membership Spend amount completed.
        points:
          type: integer
          description: >-
            The value representing the Tier Membership Balance for a customer's Tier Membership showing the
            Tier Membership Points earned.

    tierMembershipEntity:
      type: object
      required:
        - tierMembershipId
        - tierId
        - status
        - balances
        - expiryDate
        - tierBalancesResetDate
        - dateCreated
        - lastUpdated
        - accountIds
      properties:
        tierMembershipId:
          type: string
          description: >-
            The unique ID for this Tier Membership. This will be a numeric string value of variable length.
        tierId:
          type: string
          description: >-
            The ID for the Tier Membership to which the customer belongs. This will be a numeric string 
            value of variable length.
        status:
          type: string
          description: >-
            The status of this Tier Membership.
          enum:
            - ACTIVE
        accountIds:
          type: array
          minItems: 1
          items:
            type: string
            description: >-
              The IDs of the Accounts to which the Tier Membership is linked. These are numeric strings
              of variable length.
        balances:
          $ref: '#/components/schemas/tierMembershipBalancesEntity'
        expiryDate:
          $ref: '#/components/schemas/dateTimeEntity'
          nullable: true
        tierBalancesResetDate:
          $ref: '#/components/schemas/dateTimeEntity'
          nullable: true
        dateCreated:
          $ref: '#/components/schemas/dateTimeEntity'
        lastUpdated:
          $ref: '#/components/schemas/dateTimeEntity'


    tierMembershipTransactionEntity:
      description: >-
        An object displaying the details of a Tier Membership Transaction against a customer's Tier Membership. It
        holds links back to the Wallet Transactions associated with this Tier Membership Transaction. The Tier
        Membership Transaction can hold one or many Tier Membership Transaction Actions such as incrementing two Tier 
        Membership Balances and moving a Tier Membership to the Tier above.
      type: object
      required:
        - tierMembershipTransactionId
        - tierMembershipId
        - transactionType
        - parentTierMembershipTransactionId
        - walletTransactionId
        - dateCreated
        - lastUpdated
        - actions
      properties:
        tierMembershipTransactionId:
          type: string
          description: >-
            The unique ID for this Tier Membership Transaction.
        tierMembershipId:
          type: string
          description: The ID of the Tier Membership.
        transactionType:
          type: string
          enum:
            - CREDIT
            - DEBIT
            - ADJUSTMENT
            - MOVE
            - RESET
        parentTierMembershipTransactionId:
          type: string
          nullable: true
          description: >-
            The parent Tier Membership Transaction ID.
        walletTransactionId:
          nullable: true
          type: string
          description: The Wallet Transaction to which this Tier Membership Transaction is linked.
        dateCreated:
          $ref: '#/components/schemas/dateTimeEntity'
        lastUpdated:
          $ref: '#/components/schemas/dateTimeEntity'
        actions:
          type: array
          minItems: 1
          description: >-
            An array that displays the actions taken within this Tier Membership Transaction. These could be actions
            that adjust multiple Tier Membership Balances. The `amount` key will contain a positive integer if 
            the Tier Membership Balance increased or a negative integer if the Tier Membership Balance was decreased.
          items:
            type: object
            properties:
              balanceType:
                type: string
                enum:
                  - transactions
                  - spend
                  - points
              amount:
                type: integer
                description: >-
                  The value of the action taken against the Tier Membership Balance. This can only be positive for 
                  credit or negative for debit.
              balanceBefore:
                type: integer
                description: The value of the Tier Membership Balance before the transaction.
              balanceAfter:
                type: integer
                description: >-
                  The value of the Tier Membership Balance after the transaction. This value will be equal to: 
                  `balanceBefore + amount`.

    dateTimeEntity:
      type: string
      pattern: /\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T[0-2]\d:[0-5]\d:[0-5]\d[+-][0-2]\d:[0-5]\d/
      example: "2024-03-11T16:33:00+00:00"
      description: DateTime in ATOM format.

    defaultErrorEntity:
      type: object
      required:
        - errorCode
        - errorMessage
      properties:
        errorCode:
          type: string
          description: Internal Error Code.
          enum:
            - AA
            - AF
            - CE
            - CI
            - CLPPR
            - CILR
            - CU
            - CX
            - IP
            - IPR
            - IR
            - ITID
            - MNA
            - MPA
            - NF
            - P
            - U
        errorMessage:
          type: string
          description: Human Friendly Error Message.
      x-enum:
        - errorCode: AA
          errorMessage: Invalid Access to API Method
        - errorCode: AF
          errorMessage: Authorisation Failed
        - errorCode: CE
          errorMessage: Configuration Error
        - errorCode: CI
          errorMessage: Campaign Inactive
        - errorCode: CILR
          errorMessage: Campaign Issuance Limit Reached
        - errorCode: CLPPR
          errorMessage: Campaign Limit Per Period Reached
        - errorCode: CU
          errorMessage: Campaign Unknown
        - errorCode: CX
          errorMessage: Campaign Expired
        - errorCode: IP
          errorMessage: Invalid Parameter
        - errorCode: IPR
          errorMessage: IP Address Rejected
        - errorCode: IR
          errorMessage: Invalid Request
        - errorCode: ITID
          errorMessage: Invalid Transaction ID
        - errorCode: MNA
          errorMessage: Method Not Allowed
        - errorCode: MPA
          errorMessage: Missing Parameter
        - errorCode: NF
          errorMessage: Not Found
        - errorCode: P
          errorMessage: Privileges
        - errorCode: U
          errorMessage: Unknown Error
