openapi: 3.0.0
info:
  contact:
    name: stephane.chretien@thalesgroup.com
  title: Inbound Account API
  version: '1.0'
  description: |-
    API set dedicated to core banking management.

    This API is used by the bank to:
    - Register an account
    - Delete an account
servers:
  - url: https://api.d1.thalescloud.io/banking/v1
    description: Production server
  - url: https://api.d1-stg.thalescloud.io/banking/v1
    description: Staging server
security:
  - bearerAuth: []
tags:
  - name: Deprecated
    description: Deprecated APIs
paths:
  /issuers/{issuerId}/accounts/{accountId}:
    parameters:
      - $ref: '#/components/parameters/issuer-id-path'
      - $ref: '#/components/parameters/account-id-path'
      - $ref: '#/components/parameters/x-correlation-id'
    put:
      description: |-
        > Please check with Thales integration team before using this API request.
        This request is used by the issuer backend to register an account.
      tags:
        - Deprecated
      deprecated: true
      requestBody:
        content:
          application/json:
            schema:
              description: The following object represents the account
              type: object
              properties:
                consumerId:
                  $ref: '#/components/schemas/consumerId'
                accountProductId:
                  $ref: '#/components/schemas/accountProductId'
                state:
                  description: the state of the account
                  type: string
                  enum:
                    - INACTIVE
                    - ACTIVE
              required:
                - consumerId
                - state
      responses:
        '204':
          description: Successful account registration
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Forbidden action, check the state of the linked end user (consumer)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorGeneric'
        '404':
          description: Account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorGeneric'
        '500':
          $ref: '#/components/responses/InternalServerError'
      summary: Register account
      operationId: registerAccount
  /issuers/{issuerId}/accounts/{accountId}/operations:delete:
    parameters:
      - $ref: '#/components/parameters/issuer-id-path'
      - $ref: '#/components/parameters/account-id-path'
    post:
      summary: Delete
      operationId: deleteAccount
      deprecated: true
      responses:
        '200':
          description: Account deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/operationStatusSuccessful'
        '400':
          description: Bad Request, Invalid request URI or header, or unsupported nonstandard parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorGeneric'
        '401':
          description: The provided Authorization header is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorGeneric'
        '500':
          $ref: '#/components/responses/OperationsInternalServerError'
      description: |-
        > Please check with Thales integration team before using this API request.
        This request is used by the core banking system to delete an account.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  $ref: '#/components/schemas/reason'
                reasonCode:
                  $ref: '#/components/schemas/reasonCode'
            examples: {}
      parameters:
        - $ref: '#/components/parameters/x-correlation-id'
      tags:
        - Deprecated
components:
  securitySchemes:
    bearerAuth:
      description: A JWT generated by the [Get Authorization Token API](oauth2-api).<br/>The server checks the validity of the provided token to control access to this protected resource. Please refer to [Get OAuth 2.0 access token](../../../integrate-the-d1-api/get-oauth-2.0-access-token) for more details on the flow and on how to get this JWT.
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    issuerId:
      maxLength: 10
      minLength: 10
      type: string
    accountId:
      type: string
      description: Unique identifier of the account.
      minLength: 1
      maxLength: 64
      pattern: '[A-Za-z0-9_-]{1,64}'
    consumerId:
      type: string
      description: 'Unique identifier of the end user. '
      minLength: 1
      maxLength: 64
      pattern: '[A-Za-z0-9_-]{1,64}'
    accountProductId:
      type: string
      description: RFU - Unique identifier of the type of account
      minLength: 1
      maxLength: 64
      pattern: '[A-Za-z0-9_-]{1,64}'
    errorGeneric:
      type: object
      description: Generic error returned by the APIs.
      properties:
        error:
          type: string
          description: Description of the error.<br/>This field is for troubleshooting purposes only, it can change at any time so MUST NOT be parsed, and is not supposed to be human readable so CANNOT be displayed to end users.
          example: Card does not exist
    reason:
      type: string
      title: reason
      example: customer was contacted on June 28
      pattern: ^[a-zA-Z0-9 ]{1,64}$
      description: |-
        The reason why the action is performed.

        This a free text field in case the Issuer wants to send details, that will be returned in the operations list.
    reasonCode:
      type: string
      title: reasonCode
      enum:
        - USER_DECISION
        - ISSUER_DECISION
        - DEVICE_LOST
        - DEVICE_STOLEN
        - CARD_LOST
        - CARD_STOLEN
        - CARD_BROKEN
      description: |-
        The reason code why the action is performed.

        If not provided, default reason code is ISSUER_DECISION.
    operationId:
      type: string
      description: Unique identifier of the operation
      minLength: 1
      maxLength: 64
      pattern: '[A-Za-z0-9_-]{1,64}'
    operationStatusSuccessful:
      title: operation
      type: object
      description: Operation result information.
      properties:
        operationId:
          $ref: '#/components/schemas/operationId'
        status:
          type: string
          description: Status of the operation
          enum:
            - SUCCESSFUL
    operationStatusFailed:
      title: operation
      type: object
      description: Operation result information.
      properties:
        operationId:
          $ref: '#/components/schemas/operationId'
        status:
          type: string
          description: Status of the operation
          enum:
            - FAILED
  parameters:
    issuer-id-path:
      description: The id of the issuer
      in: path
      name: issuerId
      required: true
      schema:
        $ref: '#/components/schemas/issuerId'
    account-id-path:
      description: The id of the account
      in: path
      name: accountId
      required: true
      schema:
        $ref: '#/components/schemas/accountId'
    x-correlation-id:
      description: |-
        Random identifier which can be used to correlate the different API calls done as part of a single use-case. This identifier will be the one primarily used for troubleshooting.

        **Warning:** This identifier should not be derived from sensitive personal data, as its value will be logged in clear.

        There is no strong guarantee of the uniqueness of this identifier, so please refrain from using it for purposes other than logging and troubleshooting.
      in: header
      name: x-correlation-id
      schema:
        type: string
        minimum: 1
        maximum: 64
        pattern: '[a-zA-Z0-9_\-\. ]{1,64}'
  responses:
    BadRequest:
      description: Bad Request, Invalid request URI or header, or unsupported non-standard parameter
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorGeneric'
    Unauthorized:
      description: The provided Authorization header is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorGeneric'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorGeneric'
    OperationsInternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/operationStatusFailed'
              - $ref: '#/components/schemas/errorGeneric'
          examples: {}
