openapi: 3.0.1
info:
  title: Flinks Interac API
  description: Flinks E-Transfer (RFM) API.
  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'
          text/json:
            schema:
              $ref: '#/components/schemas/InitiateSessionRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/InitiateSessionRequest'
      responses:
        '201':
          description: Created
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/InitiateSessionSetupResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateSessionSetupResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/InitiateSessionSetupResponse'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/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:
            text/plain:
              schema:
                $ref: '#/components/schemas/CancelSessionSetupResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/CancelSessionSetupResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/CancelSessionSetupResponse'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/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:
            text/plain:
              schema:
                $ref: '#/components/schemas/SessionSetupResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/SessionSetupResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/SessionSetupResponse'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    AccountInfoModel:
      type: object
      properties:
        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
    AccountInfoRequest:
      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
    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
    GuaranteeDetails:
      type: object
      properties:
        guaranteeOffered:
          type: boolean
        guaranteeAccepted:
          type: boolean
          nullable: true
        highestDebitAmountToGuarantee:
          type: number
          format: decimal
        overallRiskLevel:
          $ref: '#/components/schemas/GuaranteeRiskLevel'
        transactionRiskLevel:
          $ref: '#/components/schemas/GuaranteeRiskLevel'
        userRiskLevel:
          $ref: '#/components/schemas/GuaranteeRiskLevel'
        otherRiskLevel:
          $ref: '#/components/schemas/GuaranteeRiskLevel'
        guaranteedEftType:
          $ref: '#/components/schemas/GuaranteedEftType'
      additionalProperties: false
    GuaranteeOptions:
      type: object
      properties:
        enable:
          type: boolean
      additionalProperties: false
    GuaranteeRiskLevel:
      enum:
        - Unknown
        - Low
        - Medium
        - High
        - Low_Medium
        - Medium_High
      type: string
    GuaranteedEftType:
      enum:
        - Full
        - Partial
        - Minimal
      type: string
    InitiateSessionRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/PaymentType'
        direction:
          $ref: '#/components/schemas/PaymentDirection'
        payor:
          $ref: '#/components/schemas/PartyInfoRequest'
        referenceId:
          type: string
          nullable: true
        currency:
          $ref: '#/components/schemas/PaymentCurrency'
        amount:
          type: number
          format: decimal
          nullable: true
        options:
          $ref: '#/components/schemas/SessionSetupOptionModel'
        payee:
          $ref: '#/components/schemas/PartyInfoRequest'
      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'
        sendInteracLink:
          type: boolean
          nullable: true
      additionalProperties: false
    PartyInfoRequest:
      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/AccountInfoRequest'
        address:
          $ref: '#/components/schemas/BaseAddressModel'
      additionalProperties: false
    PartyModel:
      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/AccountInfoModel'
        address:
          $ref: '#/components/schemas/BaseAddressModel'
      additionalProperties: false
    PaymentCurrency:
      enum:
        - CAD
      type: string
    PaymentDirection:
      enum:
        - DEBIT
        - CREDIT
      type: string
    PaymentType:
      enum:
        - EFT
        - e-Transfer
      type: string
    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:
        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/PartyModel'
        payee:
          $ref: '#/components/schemas/PartyModel'
        guaranteeDetails:
          $ref: '#/components/schemas/GuaranteeDetails'
        userDetails:
          $ref: '#/components/schemas/UserDetails'
        statusDetails:
          type: string
          nullable: true
        schedule:
          $ref: '#/components/schemas/SessionScheduleModel'
      additionalProperties: false
    SessionStatus:
      enum:
        - Initiated
        - Failed
        - Cancelled
        - Expired
        - Completed
      type: string
    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
