openapi: 3.0.1
info:
  title: PAY/Connect API Reference
  version: "1.0"
servers:
  - url: https://banksapi.io
paths:
  /payconnect/backend/transaction:
    post:
      tags:
        - PayConnect
      operationId: createTransaction
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Transaction'
        required: true
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Session'
  /payconnect/backend/token:
    post:
      tags:
        - PayConnect
      operationId: createToken
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                type: string
                format: uuid
  /payconnect/backend/transaction/{transactionId}:
    get:
      tags:
        - PayConnect
      operationId: getTransaction
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
        - name: transactionId
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/TransactionDB'
components:
  schemas:
    Transaction:
      required:
        - amount
        - callbackUrl
        - currency
        - purpose
        - recipient
      type: object
      properties:
        transactionType:
          type: string
          enum:
            - PAYMENT
            - VERIFICATION
        recipient:
          maxLength: 70
          minLength: 1
          pattern: ^[a-zA-Z0-9/\-\?:\(\)\.\,\'\+ ]*$
          type: string
        recipientIban:
          pattern: ^[A-Z]{2}[0-9]{2}[0-9A-Z]{1,30}$
          type: string
        recipientBic:
          pattern: ^[A-Z]{4}[A-Z]{2}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?$
          type: string
        amount:
          pattern: ^[0-9]{1,5}\.[0-9]{2}$
          type: string
        currency:
          pattern: ^[A-Z]{3}$
          type: string
        purpose:
          maxLength: 140
          minLength: 1
          pattern: ^[a-zA-Z0-9/\-\?:\(\)\.\,\'\+ ]*$
          type: string
        callbackUrl:
          type: string
        endUserAccessToken:
          pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
          type: string
        senderIban:
          pattern: ^[A-Z]{2}[0-9]{2}[0-9A-Z]{1,30}$
          type: string
    Session:
      type: object
      properties:
        sessionId:
          type: string
        transactionId:
          type: string
    TransactionDB:
      type: object
      properties:
        id:
          type: string
          format: uuid
        dateCreated:
          type: string
          format: date-time
        dateModified:
          type: string
          format: date-time
        tenant:
          type: string
        transactionType:
          type: string
          enum:
            - PAYMENT
            - VERIFICATION
        transactionStatus:
          type: string
          enum:
            - CREATED
            - PROVIDER_SELECTED
            - TRANSFER_STARTED
            - BANK_ACCESS_CONSENT
            - SUCCESS
            - ERROR
        provider:
          type: string
          format: uuid
        sender:
          type: string
        senderIban:
          type: string
        senderBic:
          type: string
        recipient:
          type: string
        recipientIban:
          type: string
        recipientBic:
          type: string
        amount:
          type: string
        currency:
          type: string
        purpose:
          type: string
        callbackUrl:
          type: string
