openapi: 3.0.1
info:
  title: Flinks EFT API V2
  description: Flinks Electronic Funds Transfer (EFT) API v2.
  version: v2
paths:
  /api/v2/sessions:
    post:
      tags:
        - Sessions
      operationId: InitiateSession
      parameters:
        - name: x-client-id
          in: header
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateSessionRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateSessionSetupResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  '/api/v2/sessions/{sessionId}/cancel':
    post:
      tags:
        - Sessions
      operationId: CancelSession
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: x-client-id
          in: header
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelSessionSetupResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  '/api/v2/sessions/{sessionId}/details':
    get:
      tags:
        - Sessions
      operationId: GetSessionDetails
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionSetupResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  '/api/v2/sessions/{sessionId}/status':
    get:
      tags:
        - Sessions
      operationId: GetSessionStatus
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionStatusResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    BaseAddressModel:
      type: object
      properties:
        addressLine1:
          type: string
          nullable: true
        addressLine2:
          type: string
          nullable: true
        unit:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        province:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        postalCode:
          type: string
          nullable: true
      additionalProperties: false
    CancelSessionSetupResponse:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
        referenceId:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/SessionStatus'
        statusDetails:
          type: string
          nullable: true
      additionalProperties: false
    CurrentStep:
      type: object
      properties:
        current:
          $ref: '#/components/schemas/SessionStep'
        aggregationRequestId:
          type: string
          format: uuid
          nullable: true
        padId:
          type: string
          format: uuid
          nullable: true
      additionalProperties: false
    GuaranteeOptions:
      type: object
      properties:
        enable:
          type: boolean
          default: false
      additionalProperties: false
    InitiateSessionRequest:
      type: object
      properties:
        referenceId:
          type: string
          nullable: true
        type:
          $ref: '#/components/schemas/PaymentType'
        direction:
          $ref: '#/components/schemas/PaymentDirection'
        currency:
          $ref: '#/components/schemas/PaymentCurrency'
        amount:
          type: number
          format: decimal
          nullable: true
        options:
          $ref: '#/components/schemas/SessionSetupOptionModel'
        payor:
          $ref: '#/components/schemas/PayorInfoRequest'
        payee:
          $ref: '#/components/schemas/PayeeInfoRequest'
      additionalProperties: false
    InitiateSessionSetupResponse:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
        referenceId:
          type: string
          nullable: true
      additionalProperties: false
    Language:
      enum:
        - EN
        - FR
      type: string
    NotificationPreferencesOptions:
      type: object
      properties:
        language:
          $ref: '#/components/schemas/Language'
      additionalProperties: false
    PayeeAccountInfoModel:
      type: object
      properties:
        institutionCode:
          type: string
          nullable: true
        transitNumber:
          type: string
          nullable: true
        accountNumber:
          type: string
          nullable: true
        accountLabel:
          type: string
          nullable: true
      additionalProperties: false
    PayeeAccountInfoRequest:
      type: object
      properties:
        institutionCode:
          type: string
          nullable: true
        transitNumber:
          type: string
          nullable: true
        accountNumber:
          type: string
          nullable: true
        accountLabel:
          type: string
          nullable: true
      additionalProperties: false
    PayeeInfoModel:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/PayeeAccountInfoModel'
      additionalProperties: false
    PayeeInfoRequest:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/PayeeAccountInfoRequest'
      additionalProperties: false
    PaymentCurrency:
      enum:
        - CAD
      type: string
    PaymentDirection:
      enum:
        - DEBIT
        - CREDIT
      type: string
      default: DEBIT
    PaymentType:
      enum:
        - EFT
        - e-Transfer
      type: string
      default: EFT
    PayorAccountInfoModel:
      type: object
      properties:
        accountId:
          type: string
          format: uuid
          nullable: true
        institutionCode:
          type: string
          nullable: true
        transitNumber:
          type: string
          nullable: true
        accountNumber:
          type: string
          nullable: true
        accountLabel:
          type: string
          nullable: true
        availableBalance:
          type: number
          format: decimal
          nullable: true
      additionalProperties: false
    PayorAccountInfoRequest:
      type: object
      properties:
        accountId:
          type: string
          format: uuid
          nullable: true
        institutionCode:
          type: string
          nullable: true
        transitNumber:
          type: string
          nullable: true
        accountNumber:
          type: string
          nullable: true
        accountLabel:
          type: string
          nullable: true
      additionalProperties: false
    PayorInfoModel:
      type: object
      properties:
        email:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        middleName:
          type: string
          nullable: true
        account:
          $ref: '#/components/schemas/PayorAccountInfoModel'
        address:
          $ref: '#/components/schemas/BaseAddressModel'
      additionalProperties: false
    PayorInfoRequest:
      type: object
      properties:
        email:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        middleName:
          type: string
          nullable: true
        occupation:
          type: string
          nullable: true
        birthDate:
          type: string
          nullable: true
        account:
          $ref: '#/components/schemas/PayorAccountInfoRequest'
        address:
          $ref: '#/components/schemas/BaseAddressModel'
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: { }
    RedirectPreferencesMode:
      enum:
        - JsEvents
        - RedirectUri
      type: string
    RedirectPreferencesResponse:
      type: object
      properties:
        mode:
          $ref: '#/components/schemas/RedirectPreferencesMode'
        urlSuccess:
          type: string
          format: uri
          nullable: true
        urlExit:
          type: string
          format: uri
          nullable: true
      additionalProperties: false
    SessionLimitsModel:
      type: object
      properties:
        minimumAmount:
          type: number
          format: decimal
          nullable: true
        maximumAmount:
          type: number
          format: decimal
          nullable: true
      additionalProperties: false
    SessionScheduleModel:
      type: object
      properties:
        id:
          type: string
          format: uuid
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/SessionTransactionModel'
          nullable: true
      additionalProperties: false
    SessionSetupOptionModel:
      type: object
      properties:
        guarantee:
          $ref: '#/components/schemas/GuaranteeOptions'
        notificationPreferences:
          $ref: '#/components/schemas/NotificationPreferencesOptions'
        showConsentScreen:
          type: boolean
          nullable: true
        limits:
          $ref: '#/components/schemas/SessionLimitsModel'
        amountModification:
          type: boolean
        redirectPreferences:
          $ref: '#/components/schemas/RedirectPreferencesResponse'
      additionalProperties: false
    SessionSetupResponse:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/SessionStatus'
        step:
          $ref: '#/components/schemas/CurrentStep'
        referenceId:
          type: string
          nullable: true
        amount:
          type: number
          format: decimal
          nullable: true
        type:
          $ref: '#/components/schemas/PaymentType'
        direction:
          $ref: '#/components/schemas/PaymentDirection'
        currency:
          $ref: '#/components/schemas/PaymentCurrency'
        options:
          $ref: '#/components/schemas/SessionSetupOptionModel'
        payor:
          $ref: '#/components/schemas/PayorInfoModel'
        payee:
          $ref: '#/components/schemas/PayeeInfoModel'
        userDetails:
          $ref: '#/components/schemas/UserDetails'
        statusDetails:
          type: string
          nullable: true
        schedule:
          $ref: '#/components/schemas/SessionScheduleModel'
        createdAt:
          type: string
          format: date-time
      additionalProperties: false
    SessionStatus:
      enum:
        - Initiated
        - Failed
        - Cancelled
        - Expired
        - Completed
      type: string
    SessionStatusResponse:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
        referenceId:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/SessionStatus'
        statusDetails:
          type: string
          nullable: true
        amount:
          type: number
          format: decimal
          nullable: true
      additionalProperties: false
    SessionStep:
      enum:
        - Start
        - Consent
        - BankSelection
        - BankConnection
        - AccountSelection
        - AmountSelection
        - GuaranteeOffer
        - Review
        - Pad
        - Complete
      type: string
    SessionTransactionModel:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          nullable: true
      additionalProperties: false
    UserDetails:
      type: object
      properties:
        matchingPerformed:
          type: boolean
        nameMatch:
          type: number
          format: double
      additionalProperties: false