openapi: 3.0.1
info:
  title: Aggregation API
  description: Service responsible for linking documents with payments
  version: 0.9.1
servers:
- description: Generated server url
  url: https://api.btx.fr.banqup.com/pay/aggregation
- description: Generated server url
  url: https://api.btx.eu.banqup.com/pay/aggregation
tags:
- name: messages
  description: the messages API
paths:
  /v1/receive/messages:
    post:
      tags:
      - messages
      operationId: receiveMessage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
      description: ' <br/> Scope: []'
  /payments/v1/spaces/{spaceId}/payments/{paymentId}:initiateAggregation:
    post:
      tags:
      - Payments
      summary: Initiate payment aggregation
      description: 'Initiate aggregation for a payment based on the mapping of document
        ids to payment end-to-end ids <br/> Scope: []'
      operationId: initiateAggregation_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: paymentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentCorrelationList'
        required: true
      responses:
        '200':
          description: OK
        '400':
          description: Incorrect id in document correlation
        '404':
          description: Payment could not be found
        '500':
          description: Internal server error
  /payments/v1/spaces/{spaceId}/payments/{paymentId}:findProposedDocuments:
    post:
      tags:
      - Payments
      summary: Find Proposed Documents
      description: 'Find proposed documents that could be an acceptable match for
        a given payment <br/> Scope: []'
      operationId: findProposedDocuments
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: paymentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DocumentMatchResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DocumentMatchResult'
  /enrichedMovementsReports/v2/spaces/{spaceId}/movements:enrich:
    post:
      tags:
      - EnrichedMovementsReports
      summary: Get enriched movements
      description: 'Get enriched movements V2 <br/> Scope: []'
      operationId: getEnrichedMovementsV2
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EMRContentRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRContentResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRContentResult'
  /enrichedMovementsReports/v2/spaces/{spaceId}/enrichedMovementsReports:generate:
    post:
      tags:
      - EnrichedMovementsReports
      summary: Generate enriched movements report
      description: 'Generate enriched movements report V2 <br/> Scope: []'
      operationId: generateEnrichedMovementsReportV2
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EMRRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EMRResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EMRResult'
  /enrichedMovementsReports/v1/spaces/{spaceId}/enrichedMovementsReports:generate:
    post:
      tags:
      - EnrichedMovementsReports
      summary: Generate enriched movements report
      description: 'Generate enriched movements report <br/> Scope: []'
      operationId: generateEnrichedMovementsReport
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: accountIdentifier
        in: query
        required: true
        schema:
          type: string
      - name: toDate
        in: query
        required: true
        schema:
          type: string
          format: date
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EMRResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EMRResult'
  /enrichedMovementsReports/v1/spaces/{spaceId}/enrichedMovementsReports/{statementId}:regenerate:
    post:
      tags:
      - EnrichedMovementsReports
      summary: Regenerate enriched movements report
      description: 'Regenerate enriched movements report <br/> Scope: []'
      operationId: regenerateEnrichedMovementsReport
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: statementId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRResult'
  /documents/v1/spaces/{spaceId}/documents:markAsUnpaid:
    post:
      tags:
      - Documents
      summary: Mark documents as unpaid
      description: 'Mark the given documents as unpaid <br/> Scope: []'
      operationId: markAsUnpaid
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsUnpaidRequest'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /documents/v1/spaces/{spaceId}/documents:markAsPaid:
    post:
      tags:
      - Documents
      summary: Mark documents as paid
      description: 'Mark the given documents as paid with full amount <br/> Scope:
        []'
      operationId: markAsPaid
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsPaidRequest'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /documents/v1/spaces/{spaceId}/documents/{documentId}:markAsUnpaid:
    post:
      tags:
      - Documents
      summary: Mark a document as unpaid
      description: 'Mark the given document as unpaid <br/> Scope: []'
      operationId: markAsUnpaid_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: documentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsUnpaidData'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /documents/v1/spaces/{spaceId}/documents/{documentId}:markAsPaid:
    post:
      tags:
      - Documents
      summary: Mark a document as paid
      description: 'Mark the given document as paid <br/> Scope: []'
      operationId: markAsPaid_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: documentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsPaidData'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /documents/v1/spaces/{spaceId}/documents/{documentId}:findProposedModifiers:
    post:
      tags:
      - Documents
      summary: Find Proposed Modifiers
      description: 'Find proposed documents or payments that could be an acceptable
        match for a given document <br/> Scope: []'
      operationId: findProposedModifiers
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: documentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ModifierMatchResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ModifierMatchResult'
  /documents/v1/actions/markAsUnpaid:
    post:
      tags:
      - DocumentActions
      summary: Mark documents as unpaid
      description: 'Document action to mark the given documents as unpaid <br/> Scope:
        []'
      operationId: markAsUnpaidDocumentAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsUnpaidActionRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentActionResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentActionResult'
  /documents/v1/actions/markAsPaid:
    post:
      tags:
      - DocumentActions
      summary: Mark documents as paid
      description: 'Document action to mark the given documents as paid <br/> Scope:
        []'
      operationId: markAsPaidDocumentAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkAsPaidActionRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentActionResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentActionResult'
  /aggregations/v1/spaces/{spaceId}/aggregations/{aggregationId}:reject:
    post:
      tags:
      - Aggregations
      summary: Reject aggregation
      description: 'Reject a proposed or previously confirmed aggregation <br/> Scope:
        []'
      operationId: rejectAggregation_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: aggregationId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /aggregations/v1/spaces/{spaceId}/aggregations/{aggregationId}:confirm:
    post:
      tags:
      - Aggregations
      summary: Confirm aggregation
      description: 'Confirm a proposed or previously rejected aggregation <br/> Scope:
        []'
      operationId: confirmAggregation_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: aggregationId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /aggregations/v1/spaces/{spaceId}/aggregations:
    post:
      tags:
      - Aggregations
      summary: Add aggregation
      description: 'Add a user-confirmed aggregation for the given payment and document
        <br/> Scope: []'
      operationId: addAggregation_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AggregationRequest'
        required: true
      responses:
        '200':
          description: OK
        '500':
          description: Internal server error
  /payments/v2/spaces/{spaceId}/payments/{paymentId}/aggregations:
    get:
      tags:
      - PaymentsV2
      summary: Get Aggregated Payment
      description: 'Get details of an aggregated payment <br/> Scope: []'
      operationId: getSinglePaymentAggregations
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: paymentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
  /payments/v2/spaces/{spaceId}/payments/aggregations:
    get:
      tags:
      - PaymentsV2
      summary: Get Aggregated Payments
      description: 'Get list of aggregated payments on the given space. <br/> Scope:
        []'
      operationId: getPaymentAggregationsPaginated
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        description: Zero-based page index, cannot be negative, default 0
        required: false
        schema:
          maximum: 10000
          minimum: 0
          type: string
          description: Zero-based page index, cannot be negative, default 0
          example: 0
          default: '0'
        example: 0
      - name: size
        in: query
        description: 'Page size. Minimum 1, maximum: 200, default 20'
        required: false
        schema:
          maximum: 200
          minimum: 1
          type: string
          description: 'Page size. Minimum 1, maximum: 200, default 20'
          example: 20
          default: '20'
        example: 20
      - name: includeTotalElements
        in: query
        description: Return the totalElements number of entries in the response
        required: false
        schema:
          type: string
          description: Return the totalElements number of entries in the response
          example: true
          default: 'true'
        example: true
      - name: sortBy
        in: query
        description: Sorting criteria
        required: false
        schema:
          type: string
          description: Sorting criteria
          enum:
          - createdAt
          - createdAt.asc
          - createdAt.desc
      - name: matchingStatus
        in: query
        required: false
        schema:
          type: string
          enum:
          - PROPOSED
          - UNMATCHED
          - MATCHED
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
  /payments/v1/spaces/{spaceId}/payments/{paymentId}/aggregations:
    get:
      tags:
      - Payments
      summary: Get Aggregated Payment
      description: 'Get details of an aggregated payment <br/> Scope: []'
      operationId: getSinglePaymentAggregations_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: paymentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
  /payments/v1/spaces/{spaceId}/payments/aggregations:
    get:
      tags:
      - Payments
      summary: Get Aggregated Payments
      description: 'Get list of aggregated payments on the given space. <br/> Scope:
        []'
      operationId: getPaymentAggregationsPaginated_1
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        description: Zero-based page index, cannot be negative, default 0
        required: false
        schema:
          maximum: 10000
          minimum: 0
          type: string
          description: Zero-based page index, cannot be negative, default 0
          example: 0
          default: '0'
        example: 0
      - name: size
        in: query
        description: 'Page size. Minimum 1, maximum: 200, default 20'
        required: false
        schema:
          maximum: 200
          minimum: 1
          type: string
          description: 'Page size. Minimum 1, maximum: 200, default 20'
          example: 20
          default: '20'
        example: 20
      - name: includeTotalElements
        in: query
        description: Return the totalElements number of entries in the response
        required: false
        schema:
          type: string
          description: Return the totalElements number of entries in the response
          example: true
          default: 'true'
        example: true
      - name: sortBy
        in: query
        description: Sorting criteria
        required: false
        schema:
          type: string
          description: Sorting criteria
          enum:
          - createdAt
          - createdAt.asc
          - createdAt.desc
      - name: matchingStatus
        in: query
        required: false
        schema:
          type: string
          enum:
          - PROPOSED
          - UNMATCHED
          - MATCHED
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentAggregationResponse'
  /enrichedMovementsReports/v1/spaces/{spaceId}/movements:enrich:
    get:
      tags:
      - EnrichedMovementsReports
      summary: Get enriched movements
      description: 'Get enriched movements <br/> Scope: []'
      operationId: getEnrichedMovements
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: accountIdentifier
        in: query
        required: true
        schema:
          type: string
      - name: fromDate
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: toDate
        in: query
        required: true
        schema:
          type: string
          format: date
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRContentResult'
        '500':
          description: Internal server error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/EMRContentResult'
  /documents/v1/spaces/{spaceId}/documents/{documentId}/aggregations:
    get:
      tags:
      - Documents
      summary: Get Aggregated Document
      description: 'Get details of an aggregated document <br/> Scope: []'
      operationId: getSingleDocumentAggregations
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: documentId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentAggregationResponse'
  /documents/v1/spaces/{spaceId}/documents/aggregations:
    get:
      tags:
      - Documents
      summary: Get Aggregated Documents
      description: 'Get list of aggregated documents on the given space. <br/> Scope:
        []'
      operationId: getDocumentAggregationsPaginated
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        description: Zero-based page index, cannot be negative, default 0
        required: false
        schema:
          maximum: 10000
          minimum: 0
          type: string
          description: Zero-based page index, cannot be negative, default 0
          example: 0
          default: '0'
        example: 0
      - name: size
        in: query
        description: 'Page size. Minimum 1, maximum: 200, default 20'
        required: false
        schema:
          maximum: 200
          minimum: 1
          type: string
          description: 'Page size. Minimum 1, maximum: 200, default 20'
          example: 20
          default: '20'
        example: 20
      - name: includeTotalElements
        in: query
        description: Return the totalElements number of entries in the response
        required: false
        schema:
          type: string
          description: Return the totalElements number of entries in the response
          example: true
          default: 'true'
        example: true
      - name: sortBy
        in: query
        description: Sorting criteria
        required: false
        schema:
          type: string
          description: Sorting criteria
          enum:
          - createdAt
          - createdAt.asc
          - createdAt.desc
      - name: matchingStatus
        in: query
        required: false
        schema:
          type: string
          enum:
          - PROPOSED
          - UNMATCHED
          - MATCHED
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentAggregationResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/DocumentAggregationResponse'
components:
  schemas:
    Message:
      required:
      - category
      - data
      - messageId
      - type
      type: object
      properties:
        messageId:
          type: string
          description: The ID assigned by the API to this message.
        category:
          type: string
          description: The category of the message.
        type:
          type: string
          description: The type of the message.
        data:
          type: object
          description: All information related to the event that was emitted.
    DocumentCorrelation:
      required:
      - documentId
      type: object
      properties:
        documentId:
          type: string
          format: uuid
        endToEndIdentification:
          type: string
    DocumentCorrelationList:
      required:
      - documents
      type: object
      properties:
        documents:
          type: array
          items:
            $ref: '#/components/schemas/DocumentCorrelation'
    AggregationConnection:
      required:
      - displayName
      - id
      type: object
      properties:
        id:
          type: string
          format: uuid
        displayName:
          type: string
    AggregationDocumentMetadata:
      type: object
      properties:
        documentNumber:
          type: string
        paymentReference:
          type: object
          additionalProperties:
            type: string
        documentReference:
          type: string
        currencyCode:
          type: string
        documentTotals:
          $ref: '#/components/schemas/DocumentAggregationTotals'
    DocumentAggregationTotals:
      type: object
      properties:
        payableAmount:
          type: number
        totalAmount:
          type: number
    DocumentInfo:
      required:
      - connections
      - createdAt
      - folder
      - id
      - metadata
      type: object
      properties:
        id:
          type: string
          format: uuid
        folder:
          type: string
        category:
          type: string
        createdAt:
          type: string
          format: date-time
        metadata:
          $ref: '#/components/schemas/AggregationDocumentMetadata'
        connections:
          type: array
          items:
            $ref: '#/components/schemas/AggregationConnection'
    DocumentMatchResult:
      type: object
      properties:
        document:
          $ref: '#/components/schemas/DocumentInfo'
        rule:
          type: string
    AccountIdentifier:
      required:
      - currency
      - identifier
      - scheme
      type: object
      properties:
        identifier:
          type: string
          description: Account Identifier
          example: BE83504010119715
        scheme:
          type: string
          description: Account Scheme
          example: IBAN
          enum:
          - IBAN
          - BBAN
          - ANB
          - SE_BANKGIRO
          - SE_PLUSGIRO
          - CREDIT_CARD
        bank:
          $ref: '#/components/schemas/BankIdentifier'
        country:
          pattern: ^[a-zA-Z]{2}
          type: string
          example: BE
        currency:
          pattern: '[A-Z]{3}'
          type: string
          description: International code ISO 4217 of the currency used
          example: EUR
    BankIdentifier:
      required:
      - identifier
      - scheme
      type: object
      properties:
        identifier:
          type: string
          description: Bank Identifier
          example: PANXBEB1XXX
        scheme:
          type: string
          description: Bank Identifier Scheme
          example: BIC
          enum:
          - BIC
          - CODE
      description: Information about the issuer of the account
    EMRContentRequest:
      required:
      - fromDate
      - toDate
      type: object
      properties:
        fromDate:
          type: string
          format: date
        toDate:
          type: string
          format: date
        account:
          $ref: '#/components/schemas/AccountIdentifier'
    EMRAccountResult:
      type: object
      properties:
        bic:
          type: string
        accountNumber:
          type: string
        scheme:
          type: string
        id:
          type: string
        country:
          type: string
        bank:
          $ref: '#/components/schemas/EMRBankResult'
        description:
          type: string
        currency:
          type: string
    EMRBalanceResult:
      type: object
      properties:
        amount:
          type: number
        debitOrCredit:
          type: string
    EMRBankResult:
      type: object
      properties:
        scheme:
          type: string
        id:
          type: string
    EMRContentResult:
      type: object
      properties:
        statement:
          $ref: '#/components/schemas/EMRStatementResult'
    EMRDateBalanceResult:
      type: object
      properties:
        date:
          type: string
          format: date
        balance:
          $ref: '#/components/schemas/EMRBalanceResult'
    EMRHeaderResult:
      type: object
      properties:
        sequenceNumber:
          type: integer
          format: int32
        orderingParty:
          $ref: '#/components/schemas/EMRPartyResult'
        summary:
          $ref: '#/components/schemas/EMRSummaryResult'
    EMRPartyResult:
      type: object
      properties:
        holderName:
          type: string
        account:
          $ref: '#/components/schemas/EMRAccountResult'
    EMRStatementResult:
      type: object
      properties:
        header:
          $ref: '#/components/schemas/EMRHeaderResult'
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/EMRTransactionResult'
    EMRSummaryResult:
      type: object
      properties:
        creditCount:
          type: integer
          format: int32
        creditTotal:
          type: number
        debitCount:
          type: integer
          format: int32
        debitTotal:
          type: number
        toDate:
          type: string
          format: date
        openingBalance:
          $ref: '#/components/schemas/EMRDateBalanceResult'
        closingBalance:
          $ref: '#/components/schemas/EMRDateBalanceResult'
    EMRTransactionResult:
      type: object
      properties:
        bookingDate:
          type: string
          format: date
        currency:
          type: string
        amount:
          type: number
        endToEndId:
          type: string
        counterParty:
          $ref: '#/components/schemas/EMRPartyResult'
        debitOrCredit:
          type: string
        structuredReference:
          type: string
        unstructuredReference:
          type: string
    EMRRequest:
      type: object
      properties:
        toDate:
          type: string
          format: date
        account:
          $ref: '#/components/schemas/AccountIdentifier'
    EMRResult:
      type: object
      properties:
        spaceId:
          type: string
          format: uuid
        statementId:
          type: string
          format: uuid
    MarkAsUnpaidData:
      type: object
      properties:
        comment:
          type: string
        reason:
          type: string
        email:
          type: string
        balanceOffsetIds:
          type: array
          items:
            type: string
            format: uuid
        sharePaymentStatus:
          type: boolean
    MarkAsUnpaidRequest:
      type: object
      properties:
        documents:
          type: array
          items:
            type: string
            format: uuid
        data:
          $ref: '#/components/schemas/MarkAsUnpaidData'
    MarkAsPaidData:
      type: object
      properties:
        comment:
          type: string
        paymentAmount:
          type: string
        paymentDate:
          type: string
        paymentReferenceNumber:
          type: string
        paymentMethod:
          type: string
          enum:
          - BANK_TRANSFER
          - CREDIT_CARD
          - DEBIT_CARD
          - CASH
          - OTHER
        sharePaymentStatus:
          type: boolean
    MarkAsPaidRequest:
      type: object
      properties:
        documents:
          type: array
          items:
            type: string
            format: uuid
        data:
          $ref: '#/components/schemas/MarkAsPaidData'
    AmountDto:
      type: object
      properties:
        value:
          type: string
        currency:
          type: string
    CounterPartyPaymentAccountInfo:
      required:
      - currency
      - identifier
      - scheme
      type: object
      properties:
        identifier:
          type: string
          description: Account Identifier
          example: BE83504010119715
        scheme:
          type: string
          description: Account Scheme
          example: IBAN
          enum:
          - IBAN
          - BBAN
          - ANB
          - SE_BANKGIRO
          - SE_PLUSGIRO
          - CREDIT_CARD
        bank:
          $ref: '#/components/schemas/BankIdentifier'
        country:
          pattern: ^[a-zA-Z]{2}
          type: string
          example: BE
        currency:
          pattern: '[A-Z]{3}'
          type: string
          description: International code ISO 4217 of the currency used
          example: EUR
        ownerName:
          type: string
    DocumentModifierInfo:
      required:
      - connections
      - createdAt
      - folder
      - id
      - metadata
      type: object
      allOf:
      - $ref: '#/components/schemas/ModifierInfo'
      - type: object
        properties:
          id:
            type: string
            format: uuid
          folder:
            type: string
          category:
            type: string
          createdAt:
            type: string
            format: date-time
          metadata:
            $ref: '#/components/schemas/AggregationDocumentMetadata'
          connections:
            type: array
            items:
              $ref: '#/components/schemas/AggregationConnection'
    ModifierInfo:
      required:
      - matchType
      type: object
      properties:
        matchType:
          type: string
      discriminator:
        propertyName: matchType
        mapping:
          PAYMENT: '#/components/schemas/PaymentModifierInfo'
          DOCUMENT: '#/components/schemas/DocumentModifierInfo'
    ModifierMatchResult:
      type: object
      properties:
        modifier:
          oneOf:
          - $ref: '#/components/schemas/DocumentModifierInfo'
          - $ref: '#/components/schemas/PaymentModifierInfo'
        rule:
          type: string
    OwnerBankInfo:
      required:
      - identifier
      - scheme
      type: object
      properties:
        identifier:
          type: string
          description: Bank Identifier
          example: PANXBEB1XXX
        scheme:
          type: string
          description: Bank Identifier Scheme
          example: BIC
          enum:
          - BIC
          - CODE
        logoUrl:
          type: string
        financialPlatformName:
          type: string
        financialPlatformId:
          type: string
          format: uuid
    OwnerPaymentAccountInfo:
      required:
      - currency
      - identifier
      - scheme
      type: object
      properties:
        identifier:
          type: string
          description: Account Identifier
          example: BE83504010119715
        scheme:
          type: string
          description: Account Scheme
          example: IBAN
          enum:
          - IBAN
          - BBAN
          - ANB
          - SE_BANKGIRO
          - SE_PLUSGIRO
          - CREDIT_CARD
        bank:
          $ref: '#/components/schemas/OwnerBankInfo'
        country:
          pattern: ^[a-zA-Z]{2}
          type: string
          example: BE
        currency:
          pattern: '[A-Z]{3}'
          type: string
          description: International code ISO 4217 of the currency used
          example: EUR
        ownerName:
          type: string
    PaymentModifierInfo:
      required:
      - amount
      - createdAt
      - id
      - operationType
      type: object
      allOf:
      - $ref: '#/components/schemas/ModifierInfo'
      - type: object
        properties:
          id:
            type: string
            format: uuid
          createdAt:
            type: string
            format: date-time
          operationType:
            type: string
            enum:
            - CREDIT
            - DEBIT
            - DOC_TO_DOC
          amount:
            $ref: '#/components/schemas/AmountDto'
          paymentReference:
            type: string
          paymentCertaintyLevel:
            type: string
          paymentAccount:
            $ref: '#/components/schemas/OwnerPaymentAccountInfo'
          counterpartyPaymentAccount:
            $ref: '#/components/schemas/CounterPartyPaymentAccountInfo'
    MarkAsUnpaidActionRequest:
      type: object
      properties:
        spaceId:
          type: string
          format: uuid
        documents:
          type: array
          items:
            type: string
            format: uuid
        data:
          $ref: '#/components/schemas/MarkAsUnpaidData'
    DocumentActionResult:
      type: object
      properties:
        success:
          type: array
          items:
            type: string
            format: uuid
        failure:
          type: array
          items:
            type: string
            format: uuid
    MarkAsPaidActionRequest:
      type: object
      properties:
        spaceId:
          type: string
          format: uuid
        documents:
          type: array
          items:
            type: string
            format: uuid
        data:
          $ref: '#/components/schemas/MarkAsPaidData'
    AggregationRequest:
      type: object
      properties:
        documentId:
          type: string
          format: uuid
        paymentId:
          type: string
          format: uuid
        modifierId:
          type: string
          format: uuid
        amount:
          type: string
        modifierType:
          type: string
          enum:
          - PAYMENT
          - DOCUMENT
          - CREDIT_NOTE
    AggregationWithDocument:
      required:
      - aggregationStatus
      - availableOperations
      type: object
      properties:
        balanceOffset:
          $ref: '#/components/schemas/BalanceOffsetSummary'
        aggregationStatus:
          type: string
          enum:
          - PROPOSED
          - UNMATCHED
          - MATCHED
        availableOperations:
          type: array
          items:
            type: string
            enum:
            - ACCEPT
            - REJECT
            - MATCH
            - UNMATCH
            - EDIT
        document:
          $ref: '#/components/schemas/DocumentInfo'
    BalanceOffsetSummary:
      required:
      - smartLink
      type: object
      properties:
        id:
          type: string
          format: uuid
        smartLink:
          type: boolean
        amount:
          type: string
        currency:
          type: string
    PaymentAggregation:
      required:
      - amount
      - createdAt
      - id
      - operationType
      type: object
      properties:
        id:
          type: string
          format: uuid
        createdAt:
          type: string
          format: date-time
        operationType:
          type: string
          enum:
          - CREDIT
          - DEBIT
          - DOC_TO_DOC
        amount:
          $ref: '#/components/schemas/AmountDto'
        paymentReference:
          type: string
        paymentCertaintyLevel:
          type: string
        paymentAccount:
          $ref: '#/components/schemas/OwnerPaymentAccountInfo'
        counterpartyPaymentAccount:
          $ref: '#/components/schemas/CounterPartyPaymentAccountInfo'
        aggregations:
          type: array
          items:
            $ref: '#/components/schemas/AggregationWithDocument'
      description: List of payment aggregations
    PaymentAggregationResponse:
      type: object
      properties:
        paymentAggregations:
          type: array
          items:
            $ref: '#/components/schemas/PaymentAggregation'
        totalElements:
          type: integer
          description: Total number of items in the database that correspond to this
            search criteria
          format: int64
        currentPage:
          type: integer
          description: Current page
          format: int32
        pageSize:
          type: integer
          description: Response page size
          format: int32
        totalMatchedElements:
          type: integer
          description: Total number of items that are fully matched
          format: int64
        totalProposedElements:
          type: integer
          description: Total number of items that have proposed matches
          format: int64
        totalUnmatchedElements:
          type: integer
          description: Total number of items that are not fully matched
          format: int64
    DocumentAggregation:
      required:
      - aggregationStatus
      - availableOperations
      - connections
      - createdAt
      - folder
      - id
      - metadata
      type: object
      properties:
        balanceOffset:
          $ref: '#/components/schemas/BalanceOffsetSummary'
        aggregationStatus:
          type: string
          enum:
          - PROPOSED
          - UNMATCHED
          - MATCHED
        availableOperations:
          type: array
          items:
            type: string
            enum:
            - ACCEPT
            - REJECT
            - MATCH
            - UNMATCH
            - EDIT
        id:
          type: string
          format: uuid
        folder:
          type: string
        category:
          type: string
        createdAt:
          type: string
          format: date-time
        metadata:
          $ref: '#/components/schemas/AggregationDocumentMetadata'
        connections:
          type: array
          items:
            $ref: '#/components/schemas/AggregationConnection'
        modifier:
          oneOf:
          - $ref: '#/components/schemas/DocumentModifierInfo'
          - $ref: '#/components/schemas/PaymentModifierInfo'
      description: List of document aggregations
    DocumentAggregationResponse:
      type: object
      properties:
        documentAggregations:
          type: array
          items:
            $ref: '#/components/schemas/DocumentAggregation'
        totalElements:
          type: integer
          description: Total number of items in the database that correspond to this
            search criteria
          format: int64
        currentPage:
          type: integer
          description: Current page
          format: int32
        pageSize:
          type: integer
          description: Response page size
          format: int32
        totalMatchedElements:
          type: integer
          description: Total number of items that are fully matched
          format: int64
        totalProposedElements:
          type: integer
          description: Total number of items that have proposed matches
          format: int64
        totalUnmatchedElements:
          type: integer
          description: Total number of items that are not fully matched
          format: int64
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/client_credential/gettoken
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
        authorizationCode:
          authorizationUrl: https://api.btx.fr.banqup.com/oauth2/auth
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/token
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
