Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Awesome api app render macro
authHeaderName
linksColor#0052cc
showInfotrue
allowSpecUrlLoadfalse
primaryColor#0052CC
schemaStyletable
methodGetColor#0065FF
authHeaderValue
methodPutColor#6554c0
generalThemeconfluence_light
allowTryfalse
layoutHeight1200
allowAdvancedSearchtrue
codeBg#F4F5F7
methodHeadColor#ffab00
navHoverTextColor
showComponentstrue
allowServerSelectiontrue
textColor#172B4D
methodPatchColor#ffab00
navBgColor#FAFBFC
codeFg#172B4D
navTextColor#172B4D
fontSizedefault
sortEndpointsBymethod
usePathInNavBartrue
navAccentColor#6554C0
methodDeleteColor#ff5630
headerColor#fff
allowAuthenticationfalse
bgColor#fff
allowSearchtrue
sortTagstrue
themelight
methodPostColor#36b37e
authTypeNone
inlineCodeFg#6554C0
resourceContentTypejson
showHeaderfalse
allowSpecFileLoadfalse
inlineCodeBg#F4F5F7
renderStyleread
layoutcolumn
headingText
navItemSpacingdefault
infoDescriptionHeadingsInNavbartrue
specUrl
navHoverBgColor
resourceTypeCONTENT
openapi: 3.0.1

servers:
  - url: https://{your-cm-serverx}
    description: Consent manager for the tenant

info:
  title: Consent Manager Apis
  description: |
    This document provides the OAS3 specification for the APIs provided by the Ozone Consent Manager.
    These APIs are implemented by Ozone and should be called by the financial institution to find, modify and delete consents.

    #### Coming soon
    The following changes can be expected in the next release:
    - some enumeration and object definitions remain to be aligned with CBUAE specifications. These will be updated
    - specific changes expected in the next release have been marked as ***TODO*** in the document

  contact:
    name: Ozone Financial Technology Limited


  version: Version 2024.3134

tags:
  - name: consents
  - name: consent-groups
  - name: consents-by-psu
  - name: consents-by-account
  - name: payments
  - name: actions

paths:
  /consents:
    post:
      tags:
        - consents
      summary: Creates a new consent
      description: |
        Used by Ozone to create a new consent using a Heimdall interaction.

      operationId: addConsent
      requestBody:
        description: |
          Creates a new consent in the consent Manager.

          The API is primararily used by Ozone for creating consents when requested by a TPPs.

          Financial Institutions may use this end-point to import consents and for supporting externally managed consents. This is not part of the CBUAE standard.

        required: true
        content:
          application/json:
            schema:
              type$ref: object"#/components/schemas/AuthorizationDetails"

      responses:
        description'201':
  |        description: |
       The request body for creating aIndicates newthe consent.successful creation of a consent
          content:
  The body consists of the RAR request that is sent byapplication/json:
the TPP to the authorization server.         schema:
        ***TODO*** Import the schemas for the RAR requests from the CBUAE specification
              additionalProperties: true

      responses:
        '201':
          description: |
            Indicates the successful creation of a consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsentPostResponse"

        '400':
          description: |
            Indicates a failure to create the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

    get:
      tags:
        - consents
      summary: Retrieves all the consents that meet the search criteria
      description: |
        Retrieves an array of consents that meets the search criteria.

        If no consents could be found, then an empty array is returned.

        This API may be used by an financial institution to get a "stream" of consents that have been created or updated since a given timestamp.

      operationId: getAllConsents

      parameters:
        - name: updatedAt
          in: query
          schema:
            type: number
          required: false
          description: |
            Select only consents updated after the specified time

        - $ref: "#/components/parameters/consentType"
        - $ref: "#/components/parameters/status"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"

      responses:
        '200':
          description: |
            Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/multiConsentResponse"
        '400':
          description: Indicates a failure to retrieve the consents
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /consents/{consentId}:
    get:
      tags:
        - consents
      summary: Retrieve a consent by its id
      description: Retrieves a consent by its id.
      operationId: getConsentsByConsentId
      parameters:
        - $ref: "#/components/parameters/consentId"

      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - meta
                properties:
                  data:
                    $ref: "#/components/schemas/consent"
                  meta:
                    $ref: "#/components/schemas/meta"

        '400':
          description: |
            Indicates a failure to retrieve the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

    patch:
      tags:
        - consents
      summary: Patches one or more fields in a consent
      description: |
        This operation allows an financial institution modify fields within a consent's `consentBody`.

        Typically, this API would be called after the PSU has authorised a consent. This would
        allow the financial institution to "patch in" the `psuIdentifier` and `accountIds` associated with the
        consent.

        This is also called as authentication progresses for a multi-auth consent.
      operationId: patchConsent
      parameters:
        - $ref: "#/components/parameters/consentId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/cbuaePatchBody"

      responses:
        '204':
          description: |
            Indicates a successful operation.
            The response does not have a body.

        '400':
          description: |
            Indicates a failure to patch the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /consents/{consentId}/audit:
    get:
      tags:
        - consents
      summary: Retrieve an audit of a consent by the consent's id
      description:
        Retrieves an audit of a consent by the consent's id.

        The audit log is a low-level record of all changes applied to a Consent
        throughout its life-cycle
      operationId: getAuditConsentsByConsentId
      parameters:
        - $ref: "#/components/parameters/consentId"

      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - meta
                properties:
                  data:
                    type: array

                    items:
                      type: object
                      required:
                        - providerId
                        - operation
                        - timestamp
                        - fkMongoId
                        - fkId
                        - id
                        - ozoneInteractionId

                      properties:
                        providerId:
                          type: string
                          description: |
                            The provider id of the financial institution that made the change

                        operation:
                          type: string
                          description: |
                            Like "create" or "patch"

                        timestamp:
                          type: integer

                        fkMongoId:
                          type: string
                          description: |
                            A unique identifier for the audit log in mongodb

                        fkId:
                          type: string
                          description: |
                            A unique identifier for the consentId

                        id:
                          type: string
                          description: |
                            A unique identifier for the audit log

                        ozoneInteractionId:
                          type: string
                          description: |
                            The ozone interaction id assigned to the interaction that caused this changed. Useful for looking up the api-log.

                            Note - this is not the "heimdall Interaction Id" - this is an identifier for the API log

                        callerDetails:
                          type: object
                          description: |
                            The details of the API caller that made the change
                          additionalProperties: false
                          properties:
                            callerOrgId:
                              type: string
                            callerClientId:
                              type: string
                            callerSoftwareStatementId:
                              type: string

                        patchFilter:
                          type: string
                          description: |
                            Low-level operation description of the selector for the patch

                        patch:
                          type: string
                          description: |
                            Low-level operation description of the patch that was applied at the storage level

                  meta:
                    $ref: "#/components/schemas/meta"
        '400':
          description: |
            Indicates a failure to retrieve the consent's audit trail
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /consent-groups/{consentGroupId}/consents:
    get:
      tags:
        - consent-groups
      summary: Retrieves consents within a consent group
      description: |
        Retrieves an array of consents that are within a consent group.

        If no consents could be found, then an empty array is returned.

        For CBUAE, a consent group id is the `BaseConsentId`

      operationId: getConsentsInConsentGroup

      parameters:
        - name: consentGroupId
          in: path
          schema:
            type: string
          required: true
          description: |
            Select consents within the consentGroupId

        - $ref: "#/components/parameters/consentType"
        - $ref: "#/components/parameters/status"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"

      responses:
        '200':
          description: |
            Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/multiConsentResponse"
        '400':
          description: Indicates a failure to retrieve the consents
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /psu/{userId}/consents:
    get:
      tags:
        - consents-by-psu
      summary: Retrieves all the consents associated with a given PSU
      description: |
        Retrieves an array of consents associated with the PSU.

        If no consents could be found associated with the PSU, then an empty array is returned.

        The userId path parameter is matched with the `psuIdentifiers.userId` field in the consent.
      operationId: getConsents
      parameters:
        - $ref: "#/components/parameters/userId"
        - $ref: "#/components/parameters/consentType"
        - $ref: "#/components/parameters/status"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"

      responses:
        '200':
          description: |
            Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/multiConsentResponse"
        '400':
          description: Indicates a failure to retrieve the consents
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /accounts/{accountId}/consents:
    get:
      tags:
        - consents-by-account
      summary: Retrieve consents of a account by its id
      description: |
        Retrieve consents of a account by its id
      operationId: getAccountIdConsents
      parameters:
        - name: accountId
          in: path
          schema:
            type: string
          required: true
          description: Identifier for the account

        - $ref: "#/components/parameters/consentType"
        - $ref: "#/components/parameters/status"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"

      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/multiConsentResponse"

        '400':
          description: |
            Indicates a failure to create the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /consent-groups/{consentGroupId}/consents/action/revoke:
    post:
      tags:
        - actions
      summary: Revokes consents within a consent group
      description: |
        Revokes consents that are within a consent group.

      operationId: revokeConsentsInConsentGroup

      parameters:
        - name: consentGroupId
          in: path
          schema:
            type: string
          required: true
          description: |
            Select consents within the consentGroupId

      requestBody:
        description: |
          An end-point for revoking a consent within a consent group.

          This is similar in behaviour to the consent revocation endpoint, but operates on a consent group id parameter instead
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeConsent"

      responses:
        '204':
          description: |
            Indicates a successful operation.
            The response does not have a body.

        '400':
          description: Indicates a failure to revoke the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /consents/{consentId}/action/revoke:
    post:
      tags:
        - actions
      summary: Revoke a consent by its id
      description:
        Revokes a consent by its id along with any associated access and refresh tokens.

        This API is used by ozone internally to revoke consents.

        The API should be used by a financial institution to revoke consents (rather than simply patching the consent) to also revoke the tokens associated with the consent
      operationId: revokeConsentsByConsentId

      parameters:
        - $ref: "#/components/parameters/consentId"

      requestBody:
        description: |
          An end-point for revoking a consent.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeConsent"

      responses:
        '204':
          description: |
            Indicates a successful operation.
            The response does not have a body.

        '400':
          description: |
            Indicates a failure to revoke the consent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /payment-log:
    get:
      tags:
        - payments
      summary: Retrieve a payment log by its consent id or account id
      operationId: getAuditConsentsByConsentIdw
      description: |
        Either one of the query parameters can be used, not both.
      parameters:
        - name: consentId
          in: query
          schema:
            type: string
          required: true
          description: |
            Identifier for the consent

        - name: accountId
          in: query
          schema:
            type: string
          required: true
          description: |
            Identifier for the account

      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - meta
                properties:
                  data:
                    type: array
                    items:
                      type: object

                      required:
                        - consentId
                        - paymentType
                        - paymentId
                        - idempotencyKey
                        - paymentResponse
                        - tpp
                        - accountId
                        - psuIdentifiers
                        - interactionId
                        - authorizationCode
                        - requestBody
                        - requestHeaders

                      properties:

                        consentId:
                          type: string
                          description: |
                            A ConsentId generated by the financial institution for the consent.

                        paymentType:
                          type: string
                          description: |
                            The underlying payment type

                           •••TODO••• SpecifyFor theexample,
payment
types supported for CBUAE                          paymentId: - cbuae-payment (Single Instant Payment, Multi Payment - Fixed and Variable Recurring Payment, Future Dated Payment etc)
                              - cbuae-file-payment

                        paymentId:
                          type: string

                        idempotencyKey:
                          type: string

                        paymentResponse:
                          type: object
                          description: |
                            The payment response as received from the financial institution as a result of a `make-payment` call
                          properties:
                            id:
                              type: string
                              description: |
                                A unique id for the payment in uuid-v4 format.

                            status:
                              type: string
                              description: |
                                The current status of the payment
                              enum:
                  •••TODO••• Specify the payment types supported for CBUAE              - "Pending"
                                creationDateTime:- "AcceptedSettlementCompleted"
                             type: string  - "AcceptedCreditSettlementCompleted"
                           pattern: ($date-time)    - "AcceptedWithoutPosting"
                         description: |      - "Rejected"
                         An ISO date-time representing when the consent was- created"Received"

                            statusUpdateDateTimecreationDateTime:
                              type: string
                              pattern: ($date-time)
                              description: |
                                An ISO date-time representing when the consent statuswas created

was last updated                          signedResponsestatusUpdateDateTime:
                              type: string
                         tpp:     pattern: ($date-time)
                    $ref: "#/components/schemas/tpp"         description: |
               accountId:                 An ISO date-time representing when the consent status was last type:updated
integer
                         psuIdentifierssignedResponse:
                          $reftype: "#/components/schemas/psuIdentifiers"string

                        interactionIdtpp:
                          $ref: "#/components/schemas/apiLogInteractionIdtpp"

                        authorizationCodeaccountId:
                          type: objectinteger

                        psuIdentifiers:
 properties:                         $ref: "#/components/schemas/psuIdentifiers"

 paymentId:                       interactionId:
       type: string                  $ref: "#/components/schemas/apiLogInteractionId"

         accessTokenHash:               authorizationCode:
               type: string          type: object

                 currentDateTime:         properties:
                     type: string      paymentId:
                        pattern: ($date-time)     type: string

                  requestBody:          accessTokenHash:
                type: object             type: string

           description: |                currentDateTime:
            The payment request body as received from the TPP          type: string
                  •••TODO••• Import in the schema as supported for CBUAE    pattern: ($date-time)

                    additionalProperties: true   requestBody:
                          $ref: "#/components/schemas/AEPaymentAndFilePaymentRequest"

                        signedRequestBody:
                          type: string

                        requestHeaders:
                          type: object
                          description: |
                            The entire set of Http request headers that was received by Ozone from the TPP
                          additionalProperties: true

                  meta:
                    $ref: "#/components/schemas/meta"
        '400':
          description: |
            Indicates a failure to retrieve the payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

  /payment-log/{id}:
    patch:
      tags:
        - payments
      summary: Patches one or more fields in a payment-log based on id .
      description: |
        This operation allows an  modify fields within a payment's `paymentResponse`.
        This is used by the financial institutions to update the status of a payment

      operationId: patchPymentlog
      parameters:
        - $ref: "#/components/parameters/id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CbuaePatchPaymentRecordBody"

      responses:
        '204':
          description: |
            Indicates a successful operation.
            The response does not have a body.

        '400':
          description: |
            Indicates a failure to retrieve the payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errorResponse"

components:
  schemas:
    errorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: Error code identifying the problem occured
        errorMessage:
          type: string
          description: Message describing what problem has occured

    meta:
      type: object
      additionalProperties: false

    apiLogInteractionId:
      type: object
      properties:
        ozoneInteractionId:
          type: string

        clientInteractionId:
          type: string

      additionalProperties: false
      required:
        - ozoneInteractionId

    tpp:
      type: object
      description: |
        The TPP record as held by Ozone.

        If Ozone TPP Connect has been integrated into a directory, the `directoryRecord` provides the TPP's directory record as held by Ozone in base 64 encoded format.

      required:
        - clientId
        - orgId
        - softwareStatementId
        - tppName

      properties:
        clientId:
          type: string
          description: The clientId for the TPP as issued by Ozone

        orgId:
          type: string
          description: The organization id for the TPP

        softwareStatementId:
          type: string
          description: The organization id for the TPP

        tppName:
          type: string
          description: The name of the TPP

        directoryRecord:
          type: string
          description: The latest copy of the TPP directory record if the TPP has registered with a directory

      additionalProperties: false

    psuIdentifiers:
      type: object
      description: |
        The PSU that is associated with this consent.

        The `PSUIdentifiers` object may have artitrary custom fields that an financial institution may use to
        identify the PSU.

        However, all `PSUIdentifiers` must have a mandatory `userId` field that provides a unique
        user id for the PSU.

        The consent is initially created without a PSU identified.

        The value must be specified once the consent is authorised.
      properties:
        userId:
          type: string
      required:
        - userId
      additionalProperties: true

    newConsent:
      type: object
      properties:
        id:
          type: string
          description: |
            A unique identifier for the consent in uuid-v4 format.

        consentGroupId:
          type: string
          description: |
            A unique identifier for the consent group in uuid-v4 format.
            The consent group id is used to group together consents that are related to each other.

        requestUrl:
          type: string
          format: url
          description: |
            The request url of Http request that was received by Ozone from the TPP

        consentType:
          type: string
          description: |
            The type of the consent that is being created.

            Each financial institution's instance may support a different set of consent types
            The Consent Manager supports the creation of consents of different consent types depending on the standards supported.

            •••TODO••• Specify the consent types supported for CBUAE- cbuae-account-access-consents
            - cbuae-service-initiation-consents
 status:           type: string- cbuae-insurance-consents

         descriptionstatus:
|          $ref: "#/components/schemas/AEConsentStatus"

The current status of the consent   request:
          The Consent Manager ensures that this field is synchronised with the status of the consent body (the disposition of that field depending on the underlying standard)$ref: "#/components/schemas/AuthorizationDetails"

        requestHeaders:
          type: object
          description: |
   •••TODO••• Specify the consent statuses supported for CBUAE  The entire set of Http request headers that request:was received by Ozone from the TPP
    type: object     additionalProperties: true

   description: |    consentBody:
        The entire Http request body that was received by Ozone from the TPP to create the consent.$ref: "#/components/schemas/cbuaeConsentBody"

        interactionId:
          type: string
     The Consent Manager uses the consentdescription: type|
to identify the schema         The heimdall interaction id that shouldthis beconsent usedis toassociated validatewith.
the
request. (These schemas are defined by the  tpp:
          underlying standard)$ref: "#/components/schemas/tpp"

         additionalPropertiesozoneSupplementaryInformation:
true          requestHeaderstype: object
         type additionalProperties: objecttrue

        updatedAt:
description: |         type: number

 The entire set of Http requestrequired:
headers that was received by Ozone from the TPP- id
        - additionalProperties:consentType
true        - request
consentBody:        - requestHeaders
 $ref: "#/components/schemas/cbuaeConsentBody"      - tpp
  interactionId:    additionalProperties: true

    typecbuaeConsentBody:
  string    type: object
      description: |
        An object representing the Thecurrent heimdallstate interactionof id thatthe this consent.
is associated with.      This includes the entire tpp:request, augmented by additional computed properties
     $ref: "#/components/schemas/tpp"  (e.g. ids, charges  etc)
   ozoneSupplementaryInformation:           typeoneOf:
object        -   additionalProperties: true

        updatedAt:
          type: number

      required:$ref: "#/components/schemas/AEAccountAccessAndInsuranceConsentBody"
        - id
        - consentType
        - request
        - requestHeaders
        - tpp
      additionalProperties: true$ref: "#/components/schemas/AEPaymentConsentResponse"

    patchedConsent:
      type: object
      properties:
        psuIdentifiers:
          $ref: "#/components/schemas/psuIdentifiers"

        accountIds:
          type: array
          items:
            type: string
          minItems: 1
          description: |-
            An array of account ids associated with the consent. The array must be populated once consent has been authorised.
            For payment consents, the array must always have one element - the debtor account from which the payment will be made
            For CBPII consents, the array must always have one element - the account for which CoF requests will be answered
            For AIS requests, the array may contain multiple values, representing each of the payment accounts for which an AIS service will be provided.

        supplementaryInformation:
          description:
            Contains additional information at the discretion of the financial institution.

          type: object
          additionalProperties: true

        interactionId:
          type: string
          description: The heimdall interaction id that this consent is associated with. This is updated by heimdall and must not be set by financial institutions.

        paymentContext:
          type: object
          additionalProperties: true

        ConnectToken:
          type: string
          description: A bearer token that will be sent as the `Authorization` header for calls to Ozone Connect made under this consent.
      additionalProperties: true

    CbuaePatchPaymentRecordBodycbuaePatchBody:
      type: object
      description: |
        Describes the fields to be patched and their corresponding values.

      type: object
•••TODO••• Specify the exact fields that areadditionalProperties: mayfalse
be patched into the request based onproperties:
CBUAE standard       requiredpsuIdentifiers:
           - paymentResponse.status$ref: "#/components/schemas/psuIdentifiers"

        additionalPropertiesaccountIds:
   false       propertiestype: array
          paymentResponse.statusitems:
            type: string
          descriptionminItems: |1
          description: |-
The current status of the payment       An array of account ids associated •••TODO•••with Specifythe theconsent. paymentThe statusesarray supportedmust forbe CBUAEpopulated once consent has been authorised.
cbuaeConsentBody:       type: object    For service initiation, description:the |array must always have one element - the debtor Anaccount objectfrom representingwhich the payment will currentbe statemade
of the consent.         This includesFor thedata entiresharing requestrequests, augmentedthe byarray additionalmay computedcontain propertiesmultiple values, representing each of the payment accounts for (e.g. ids, charges etc)

 which an AIS service will be provided.

     The Ozone Consent Manager caters to consents from various standards. The actual schema for each consentBody would be determined by the underlying standard.

   As a convenience, when updating the status, the LFI may patch `status` or `consentBody.Data.Status` - the CM will ensure that these are synced.

    •••TODO••• Import the schemas for the consentBody from theNot CBUAEall specificationstate transitions are possible for consent statuses - additionalProperties:the truestandard provides a list of valid cbuaePatchBody:transitions.

     description: |  supplementaryInformation:
      Describes the fields to bedescription:
patched and their corresponding values.        Contains  ***TODO*** Specifyadditional information at the exactdiscretion fieldsof thatthe arefinancial mayinstitution.
be
patched into the request       type: object
      additionalProperties: false   additionalProperties: true

 properties:         psuIdentifiersstatus:
          $ref: "#/components/schemas/psuIdentifierscbuaePatchableConsentStatus"

        accountIdsconsentBody.Data.Status:
          type$ref: array"#/components/schemas/cbuaePatchableConsentStatus"

         itemsconsentBody.Data.ExchangeRate:
            type$ref: string"#/components/schemas/AEExchangeRateInformation"
          minItems: 1consentBody.Data.Charges:
          $ref: "#/components/schemas/AECharges"
        consentBody.Data.RevokedBy:
          $ref: "#/components/schemas/AERevokedBy"
        consentBody.Meta.MultipleAuthorizers:
          $ref: "#/components/schemas/AEMetaMultiAuthorization"

    cbuaePatchableConsentStatus:
      description: |
        Specifies the statuses that a consent can be patched to by an LFI.

      type: "string"
      enum:
        - "Authorized"
        - "Rejected"
        - "Revoked"
        - "Expired"
        - "Consumed"
        - "Suspended"

    CbuaePatchPaymentRecordBody:
      type: object
      description: |
        Describes the fields to be patched and their corresponding values.

      required:
        - paymentResponse.status
      additionalProperties: false
      properties:
        paymentResponse.status:
          type: string
          description: |
            The current status of the payment
          enum:
            - "Pending"
            - "AcceptedSettlementCompleted"
            - "AcceptedCreditSettlementCompleted"
            - "AcceptedWithoutPosting"
            - "Rejected"
            - "Received"

    AEAccountAccessAndInsuranceConsentBody:
      type: object
      required:
        - Data
      properties:
        Data:
          type: object
          required:
            - "ConsentId"
            - "BaseConsentId"
            - "Status"
          properties:
            ConsentId:
              $ref: '#/components/schemas/AEConsentId'
            Permissions:
              $ref: '#/components/schemas/AEAccountAccesssConsentPermissionCodes'
          allOf:
            - $ref: '#/components/schemas/AEAccountAccessAuthorizationDetailProperties'
          additionalProperties: false
        Meta:
         type: object
         properties:
          MultipleAuthorizers:
           $ref: '#/components/schemas/AEMetaMultiAuthorization'
        Subscription:
          type: object
          properties:
           Webhook:
            $ref: '#/components/schemas/Webhook'
    AEAccountAccessAuthorizationDetailProperties:
      type: object
      properties:
        BaseConsentId:
          $ref: '#/components/schemas/AEBaseConsentId'
        ExpirationDateTime:
          type: string
          format: date-time
          description: >-
            Specified date and time the permissions will expire.

            If this is not populated, the permissions will be open ended.All
            dates in the JSON payloads are represented in ISO 8601 date-time
            format.

            All date-time fields in responses must include the timezone. An
            example is below:

            2017-04-05T10:43:07+00:00
        TransactionFromDateTime:
          type: string
          format: date-time
          description: |2-
                Specified start date and time for the transaction query period.

                If this is not populated, the start date will be open ended, and
                data will be returned from the earliest available
                transaction.All dates in the JSON payloads are represented in
                ISO 8601 date-time format.

                All date-time fields in responses must include the timezone. An
                example is below:

                2017-04-05T10:43:07+00:00
        TransactionToDateTime:
          type: string
          format: date-time
          description: |2-
                Specified end date and time for the transaction query period.

                If this is not populated, the end date will be open ended, and
                data will be returned to the latest available transaction.All
                dates in the JSON payloads are represented in ISO 8601 date-time
                format.

                All date-time fields in responses must include the timezone. An
                example is below:

                2017-04-05T10:43:07+00:00
        AccountType:
          type: array
          items:
            $ref: '#/components/schemas/AEAccountTypeCode'
        AccountSubType:
          type: array
          items:
            $ref: '#/components/schemas/AEAccountSubTypeCode'
        OnBehalfOf:
          $ref: '#/components/schemas/AEOnBehalfOf'
        Status:
           $ref: '#/components/schemas/AEAccountAccessConsentStatus'
        Purpose:
          type: array
          items:
            $ref: '#/components/schemas/AEAccountAccessConsentPurpose'
        RevokedBy:
              $ref: '#/components/schemas/AERevokedBy'
      additionalProperties: false
    AEAccountAccessConsentStatus:
      description: >-
        Consent Status is set
        to either Authorized ,Revoked ,Rejected or AwaitingAuthorization
      type: string
      enum:
        - Authorized
        - AwaitingAuthorization
        - Rejected
        - Revoked
        - Expired
        - Suspended
    AEAccountAccessConsentPurpose:
      type: string
      enum:
        - Account Aggregation
        - Personal Finance Manager
        - Credit Assessment
        - Tax Filing
        - Enterprise Financial Management
        - Other
    AEAccountAccesssConsentPermissionCodes:
      type: string
      enum:
        - ReadAccountsBasic
        - ReadAccountsDetail
        - ReadBalances
        - ReadBeneficiariesBasic
        - ReadBeneficiariesDetail
        - ReadTransactionsBasic
        - ReadTransactionsDetail
        - ReadTransactionsCredits
        - ReadTransactionsDebits
        - ReadProduct
        - ReadScheduledPaymentsBasic
        - ReadScheduledPaymentsDetail
        - ReadDirectDebits
        - ReadStandingOrdersBasic
        - ReadStandingOrdersDetail
        - ReadConsents
        - ReadPartyPSU
        - ReadPartyPSUIdentity
        - ReadParty
      description: >-
        Specifies the permitted account access policy data types.

        This is a list of the data groups being consented by the User, and
        requested for authorization with the LFI.
    AEAccountSubTypeCode:
      type: string
      enum:
        - CurrentAccount
        - Savings
        - CreditCard
        - PrePaidCard
        - EMoney
        - ChargeCard
        - Other
      description: Specifies the sub type of account (product family group)
    AEAccountTypeCode:
      type: string
      enum:
        - Retail
        - Corporate
      description: Specifies the type of account (Retail or Corporate).
    AEBaseConsentId:
      type: string
      minLength: 1
      maxLength: 128
      description: >-
        The original ConsentId assigned by the TPP.


        It is used by the TPP for updating/renewing parameters associated with
        long-lived consents.

        It must be provided when long-lived consent parameters are
        updated/renewed for a current consent that has not yet finished.
    AEConsentId:
      type: string
      minLength: 1
      maxLength: 128
      description: >-
        Unique identification assigned by the TPP to identify the consent
        resource.
    AEOnBehalfOf:
      type: object
      properties:
        TradingName:
          type: string
          description: Trading Name
        LegalName:
          type: string
          description: Legal Name
        IdentifierType:
          allOf:
            - $ref: '#/components/schemas/AEOnBehalfOfIdentifierType'
          description: Identifier Type
        Identifier:
          type: string
          description: Identifier
      additionalProperties: false
    AEOnBehalfOfIdentifierType:
      type: string
      enum:
        - Other
    Webhook:
      type: object
      description: |
        A Webhook Subscription Schema
      properties:
            Url:
              description: |
                The TPP Callback URL being registered with the LFI
              type: string
              example: https://api.tpp.com/webhook/callbackUrl
            IsActive:
              description: >
                The TPP specifying whether the LFI should send (IsActive true)
                or not send (IsActive false) Webhook Notifications to the TPP's
                Webhook URL
              type: boolean
              example: false
      additionalProperties: false

    AERevokedBy:
      description: |
        Denotes the Identifier of the revocation.

        | Identifier| Description|
        |-----------|------------|
        | LFI | Revoked by LFI without User initiation|
        | TPP | Revoked by TPP without User initiation|
        | LFI.InitiatedByUser | Initiated by User via the LFI|
        | TPP.InitiatedByUser | Initiated by User via the TPP|
      type: string
      enum:
        - LFI
        - TPP
        - LFI.InitiatedByUser
        - TPP.InitiatedByUser

    AEMetaMultiAuthorization:
      type: "object"
      description: |
        Meta Data with Multi-Authorization relevant to the payload.
        For a payment, it represents any Authorizers within the financial institution domain that are involved in approving the payment request.
      properties:
        TotalRequired:
          description: |
            The total number of Authorizers required to process the request
          type: "number"
        Authorizations:
          type: "array"
          items:
            description: |
              Authorizer
            type: "object"
            properties:
              AuthorizerId:
                description: |
                  The Authorizer's Identifier
                type: "string"
              AuthorizerType:
                description: |
                  The Type of Authorizer. For example, Financial, Management, etc.
                type: "string"
              AuthorizationDate:
                description: |
                  The DateTime of when the Authorization occurred. All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2023-04-05T10:43:07+00:00
                type: "string"
                format: "date-time"
              AuthorizationStatus:
                description: |
                  The Status reflecting the Authorizer's final decision regarding the request
                type: "string"
                enum:
                  - "Pending"
                  - "Approved"
                  - "Rejected"
            additionalProperties: false
          additionalProperties: false
      additionalProperties: false
    AEReference:
      description: |
        A reason or reference in relation to a payment.
        Reason or reference for the beneficiary regarding the Payment
      type: "string"
      minLength: 1
      maxLength: 120
    AEPaymentConsentResponse:
      description: |
        Payment Consent Response Schema
      type: "object"
      additionalProperties: false
      required:
        - "Data"
      properties:
        Data:
          type: "object"
          additionalProperties: false
          required:
            - "ConsentId"
            - "BaseConsentId"
            - "Status"
            # - "StatusUpdateDateTime"
            # - "CreationDateTime"
            # - "ControlParameters"
            # - "PaymentPurposeCode"
            # - "PaymentConsumption"
            # - "AcceptedAuthorizationType"
            # - "ExpirationDateTime"
          properties:
            ConsentId:
              $ref: "#/components/schemas/AEConsentId"
            BaseConsentId:
              $ref: "#/components/schemas/AEBaseConsentId"
            AcceptedAuthorizationType:
              $ref: "#/components/schemas/AEAcceptedAuthorizationType"
            AuthorizationExpirationDateTime:
              $ref: "#/components/schemas/AEAuthorizationExpirationDateTime"
            Permissions:
              $ref: "#/components/schemas/AEConsentPermissions"
            ReadRefundAccount:
              $ref: "#/components/schemas/AEReadRefundAccount"
            ExpirationDateTime:
              $ref: "#/components/schemas/AEConsentExpirationDateTime"
            Status:
              $ref: "#/components/schemas/AEConsentStatus"
            RevokedBy:
              $ref: "#/components/schemas/AERevokedBy"
            CreationDateTime:
              $ref: "#/components/schemas/AECreationDateTime"
            StatusUpdateDateTime:
              $ref: "#/components/schemas/AEStatusUpdateDateTime"
            Charges:
              $ref: "#/components/schemas/AECharges"
            ExchangeRate:
              $ref: "#/components/schemas/AEExchangeRateInformation"
            CurrencyRequest:
              $ref: "#/components/schemas/AECurrencyRequest"
            ControlParameters:
              description: |
                Control Parameters set the overall rules for the Payment Schedule
              type: "object"
              additionalProperties: false
              properties:
                IsPayByAccount:
                  $ref: "#/components/schemas/AEIsPayByAccount"
                ConsentSchedule:
                  type: "object"
                  description: |
                    The various payment types that can be initiated:
                    * A Single Payment
                    * A Multi-Payment
                    * A Combined Payment (one SinglePayment and one MultiPayment)
                  properties:
                    SinglePayment:
                      description: |
                        A Consent definition for defining Single Payments
                      oneOf:
                        - $ref: "#/components/schemas/AESingleInstantPayment"
                        - $ref: "#/components/schemas/AESingleFutureDatedPayment"
                      discriminator:
                        propertyName: Type
                    MultiPayment:
                      $ref: "#/components/schemas/AELongLivedPaymentConsent"
                    FilePayment:
                      $ref: "#/components/schemas/AEFilePaymentConsent"
                  additionalProperties: false
            DebtorReference:
              $ref: "#/components/schemas/AEStructuredDebtorReference"
            CreditorReference:
              $ref: "#/components/schemas/AEReference"
            PaymentPurposeCode:
              $ref: "#/components/schemas/AEPaymentPurposeCode"
            SponsoredTPPInformation:
              $ref: "#/components/schemas/AESponsoredTPPInformation"
            PaymentConsumption:
              $ref: "#/components/schemas/AEPaymentConsumption"
            IsSingleAuthorization:
              description: |
                Specifies to the LFI that the consent authorization must be completed in a single authorization Step
                with the LFI
              type: "boolean"
        Subscription:
          $ref: "#/components/schemas/AEEventNotification"
        Meta:
          $ref: "#/components/schemas/AEMetaMultiAuthorization"
    AEEventNotification:
      type: "object"
      description: |
        A Webhook Subscription Schema
      required:
        - "Webhook"
      properties:
        Webhook:
          description: |
            A Webhook Schema
          type: "object"
          properties:
            Url:
              description: |
                The TPP Callback URL being registered with the LFI
              type: "string"
              example: "https://api.tpp.com/webhook/callbackUrl"
            IsActive:
              description: |
                The TPP specifying whether the LFI should send (IsActive true) or not send (IsActive false) Webhook Notifications to the TPP's Webhook URL
              type: "boolean"
              example: false
          additionalProperties: false
      additionalProperties: false
    AEAcceptedAuthorizationType:
      description: |
        Specifies to the LFI the type of consent authorization accepted by the TPP when staging the consent
        * Single - The consent should incur a single authorization Step with the LFI
        * Multi - The consent should incur a multi-authorization Step with the LFI
      type: "string"
      enum:
        - "Single"
        - "Multi"
    AEAuthorizationExpirationDateTime:
      description: |
        A time window by which a Consent (in AwaitingAuthorization status) must be Authorized by the User.
        The time window starts from the actual CreationDateTime (when the Consent is staged with the LFI).
        If the current time window exceeds the Authorization Expiration Time Window (and the Consent status is AwaitingAuthorization) then the Consent Status must be set to Rejected.
        The time window is based on a custom time format hhh:mm:ss. e.g. 720:00:00 represents a time window of 720 hours, 00 minutes, 00 seconds (30 days) after the CreationDateTime to Authorize the Consent.
      type: "string"
      pattern: "^(00[0-9]|0[1-9][0-9]|[1-6][0-9]{2}|7[01][0-9]|720):[0-5][0-9]:[0-5][0-9]$"
      example: "720:00:00"
    AEConsentPermissions:
      type: "array"
      description: |
        Specifies the permitted Account Access data types.
        This is a list of the data groups being consented by the User, and requested for authorization with the LFI.

        This allows a TPP to request a balance check permission.
      items:
        type: "string"
        enum:
          - "ReadAccountsBasic" # Ability to read basic account information
          - "ReadAccountsDetail" # Ability to read account identification details
          - "ReadBalances" # Ability to read all balance information
      minItems: 1
    AEReadRefundAccount:
      description: "Allows the LFI to share the refund account details with TPP"
      type: boolean
    AEFileNumberOfTransactions:
      type: "integer"
      description: |
        Number of individual transactions contained in the payment information group.
    AEControlSum:
      description: |
        Total of all individual amounts included in the group, irrespective of currencies.
      type: "string"
      pattern: "^\\d{1,16}\\.\\d{2}$"
      example: "100.00"
    AEFileType:
      type: "string"
      description: "Specifies the payment file type"
      minLength: 1
      maxLength: 40
    AEFileHash:
      type: "string"
      description: "A base64 encoding of a SHA256 hash of the file to be uploaded."
      minLength: 1
      maxLength: 44
    AEConsentExpirationDateTime:
      description: |
        Specified date and time the consent will expire.
        If this is not populated, the consent will remain active as a long lived consent until the maximum consent validity period as per section 4.1.1 Consent Elements in the API User Guide.
        All dates in the JSON payloads are represented in ISO 8601 date-time format.
        All date-time fields in responses must include the timezone. An example is :2023-04-05T10:43:07+00:00

        * For Payment Consents, the maximum expiration time limit should be 23:59:59 (1 second before 00:00:00)
      type: "string"
      format: "date-time"
    AEConsentStatus:
      description: |
        Specifies the status of a payment consent.

        | Consent Status| State Type| Description|
        |---------------|-----------|------|
        | AwaitingAuthorization | Pending | The consent is awaiting authorization.|
        | Authorized | In Use | The consent has been successfully authorized.|
        | Rejected | Terminal | The unauthorized consent has been rejected at the LFI.|
        | Revoked | Terminal | The consent has been revoked at the TPP or LFI.|
        | Expired | Terminal | The consent is now expired.|
        | Consumed | Terminal | The consented action(s) have either been completed successfully.|
        | Suspended | In Use | The consent has been suspended, pending further enquiries.|
      type: "string"
      enum:
        - "AwaitingAuthorization"
        - "Authorized"
        - "Rejected"
        - "Revoked"
        - "Expired"
        - "Consumed"
        - "Suspended"
    AECreationDateTime:
      description: "Date and time at which the message was created. All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2023-04-05T10:43:07+00:00"
      type: "string"
      format: "date-time"
    AEStatusUpdateDateTime:
      description: "Date and time at which the resource status was updated.All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2023-04-05T10:43:07+00:00"
      type: "string"
      format: "date-time"
    AECharges:
      type: "array"
      items:
        type: "object"
        additionalProperties: false
        description: |
          Set of elements used to provide details of a charge for the payment initiation.
          * For Payments, these Charges are on the Debtor.
        required:
          - "ChargeBearer"
          - "Type"
          - "Amount"
        properties:
          ChargeBearer:
            $ref: "#/components/schemas/AEChargeBearerType1Code"
          Type:
            $ref: "#/components/schemas/AEExternalPaymentChargeTypeCode"
          Amount:
            $ref: "#/components/schemas/AEActiveCurrencyAmount"
    AEExchangeRateInformation:
      type: "object"
      additionalProperties: false
      required:
        - "UnitCurrency"
        - "ExchangeRate"
        - "RateType"
      description: "Further detailed information on the exchange rate that has been used in the payment transaction."
      properties:
        UnitCurrency:
          description: "Currency in which the rate of exchange is expressed in a currency exchange. In the example 1GBP = xxxCUR, the unit currency is GBP."
          type: "string"
          pattern: "^[A-Z]{3,3}$"
        ExchangeRate:
          description: "The factor used for conversion of an amount from one currency to another. This reflects the price at which one currency was bought with another currency."
          type: "number"
        RateType:
          description: "Specifies the type used to complete the currency exchange."
          type: "string"
          enum:
            - "Actual"
            - "Agreed"
            - "Indicative"
        ContractIdentification:
          description: "Unique and unambiguous reference to the foreign exchange contract agreed between the initiating party/creditor and the debtor agent."
          type: "string"
          minLength: 1
          maxLength: 256
        ExpirationDateTime:
          description: "Specified date and time the exchange rate agreement will expire.All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00"
          type: "string"
          format: "date-time"
    AECurrencyRequest:
      description: |
        The details of the non-local currency or FX request that has been agreed between the User and the TPP.
        The requested ChargeBearer and ExchangeRateInformation are included in this object may be overwritten by the LFI in the returned Consent object.
      type: "object"
      additionalProperties: false
      required:
        - "CurrencyOfTransfer"
      properties:
        InstructionPriority:
          description: "Indicator of the urgency or order of importance that the instructing party would like the instructed party to apply to the processing of the instruction."
          type: "string"
          enum:
            - "Normal"
            - "Urgent"
        ExtendedPurpose:
          description: "Specifies the purpose of an international payment, when there is no corresponding 4 character code available in the ISO20022 list of Purpose Codes."
          type: "string"
          minLength: 1
          maxLength: 140
        ChargeBearer:
          $ref: "#/components/schemas/AEChargeBearerType1Code"
        CurrencyOfTransfer:
          description: "Specifies the currency of the to be transferred amount, which is different from the currency of the debtor's account."
          type: "string"
          pattern: "^[A-Z]{3,3}$"
        DestinationCountryCode:
          description: "Country in which Credit Account is domiciled. Code to identify a country, a dependency, or another area of particular geopolitical interest, on the basis of country names obtained from the United Nations (ISO 3166, Alpha-2 code)."
          type: "string"
          pattern: "[A-Z]{2,2}"
        ExchangeRateInformation:
          type: "object"
          additionalProperties: false
          required:
            - "UnitCurrency"
            - "RateType"
          description: "Provides details on the currency exchange rate and contract."
          properties:
            UnitCurrency:
              description: "Currency in which the rate of exchange is expressed in a currency exchange. In the example 1GBP = xxxCUR, the unit currency is GBP."
              type: "string"
              pattern: "^[A-Z]{3,3}$"
            ExchangeRate:
              description: "The factor used for conversion of an amount from one currency to another. This reflects the price at which one currency was bought with another currency."
              type: "number"
            RateType:
              description: "Specifies the type used to complete the currency exchange."
              type: "string"
              enum:
                - "Actual"
                - "Agreed"
                - "Indicative"
            ContractIdentification:
              description: "Unique and unambiguous reference to the foreign exchange contract agreed between the initiating party/creditor and the debtor agent."
              type: "string"
              minLength: 1
              maxLength: 256
    AEIsPayByAccount:
      type: boolean
      description: |
        A flag to denote if the Payment is an E-Commerce transaction
      default: false
    AESingleInstantPayment:
      type: "object"
      description: |
        A single immediate payment consent that MUST be be used for a single payment which will be initiated immediately after User authorization at the LFI.
      required:
        - "Type"
        - "Amount"
      properties:
        Type:
          type: "string"
          description: "The Payment Type"
          enum:
            - SingleInstantPayment
        Amount:
          $ref: "#/components/schemas/AEActiveCurrencyAmount"
        ExpectedInitiationTimeWindow:
          $ref: "#/components/schemas/AEExpectedInitiationTimeWindow"
      additionalProperties: false
    AESingleFutureDatedPayment:
      type: "object"
      description: |
        A long-lived consent that MUST be used for a single payment which will be authorized by the User during the payment journey, but the payment will be initiated by the TPP in the future.
      required:
        - "Type"
        - "Amount"
        - "RequestedExecutionDate"
      properties:
        Type:
          type: "string"
          description: "The Payment Type"
          enum:
            - SingleFutureDatedPayment
        Amount:
          $ref: "#/components/schemas/AEActiveCurrencyAmount"
        RequestedExecutionDate:
          $ref: "#/components/schemas/AERequestedExecutionDate"
      additionalProperties: false
    AEFixedPeriodicSchedule:
      description: |
        Payment Controls that apply to all payment instructions in a given period under this payment consent.
      type: "object"
      additionalProperties: false
      required:
        - "PeriodType"
        - "PeriodStartDate"
        - "Amount"
        - "Type"
      properties:
        Type:
          type: "string"
          description: "The Periodic Schedule Type"
          enum:
            - FixedPeriodicSchedule
        PeriodType:
          $ref: "#/components/schemas/AEPeriodType"
        PeriodStartDate:
          $ref: "#/components/schemas/AEPeriodStartDate"
        Amount:
          $ref: "#/components/schemas/AEActiveCurrencyAmount"
    AELongLivedPaymentConsent:
      type: "object"
      description: |
        A long-lived payment consent.
        A Consent definition for defining Multi Payments
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveCurrencyAmount"
        MaximumIndividualPaymentAmount:
          $ref: "#/components/schemas/AEMaximumIndividualPaymentAmount"
        MaximumCumulativeValueOfPayments:
          $ref: "#/components/schemas/AEMaximumCumulativeValueOfPayments"
        MaximumCumulativeNumberOfPayments:
          $ref: "#/components/schemas/AEMaximumCumulativeNumberOfPayments"
        PeriodicSchedule:
          description: |
            The definition for a schedule
          oneOf:
            - $ref: "#/components/schemas/AEDefinedSchedule"
            - $ref: "#/components/schemas/AEFixedPeriodicSchedule"
            - $ref: "#/components/schemas/AEVariablePeriodicSchedule"
          discriminator:
            propertyName: Type
      additionalProperties: false
    AEStructuredDebtorReference:
      description: |
        A reason or reference in relation to a payment, set to facilitate a structured Payer reference consisting of:

        * For payments to Merchants: TPP ID, Merchant ID, BIC and PostCode for the Creditor Account, followed by freeform text to a maximum of 120 characters.

        * For other payments: TPP ID, followed by freeform text to a maximum of 120 characters.

        The TPP ID value will match the organization ID value from the Trust Framework, and therefore will be a v4 UUID.

        The Merchant ID wil be as per the existing IPP rules for the Merchant identification, and will incorporate the Trade License number for the Merchant.

        A BIC is specific according to the standard format for ISO 20022, and can therefore be either 8 or 11 characters in length.

        A PostCode is specified according to the standard format for ISO 20022, and can therefore be either a maximum of 16 characters in length.

        If the value of the concatenated string exceeds 120 characters, the TPP must first omit or truncate the freeform element of the reference, followed by the PostCode.
      oneOf:
        - type: "string"
          minLength: 1
          maxLength: 120
          pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12},Merchant=[A-Z0-9]{3}-[A-Z]{4}-TL.+-[0-9]{4},BIC=[A-Z0-9]{4}[A-Z0-9]{2}[A-Z0-9]{2}([A-Z0-9]{3}){0,1},PostCode=[A-Z0-9]{1,16}($|,.+$)"
        - type: "string"
          minLength: 1
          maxLength: 120
          pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}($|,.+$)"
    AEPaymentPurposeCode:
      description:  A category code that relates to the type of services or goods that corresponds to the underlying purpose of the payment. The code must conform to the published AANI payment purpose code list.
      type: "string"
      minLength: 1
      maxLength: 4
      pattern: "^[A-Z]{3}$"
    AESponsoredTPPInformation:
      type: "object"
      description: |
        The Sponsored TPP is:
        * A TPP that itself has no direct Open Banking API integrations.
        * A TPP that is using the integration of another TPP that does have direct Open Banking API integrations.
      properties:
        Name:
          type: "string"
          minLength: 1
          maxLength: 50
          description: |
            The Sponsored TPP Name
        Identification:
          type: "string"
          minLength: 1
          maxLength: 50
          description: |
            The Sponsored TPP Identification
      additionalProperties: false
    AEFilePaymentConsent:
      type: "object"
      description: |
        A file based payment consent.
        A Consent definition for defining Multi Payments
      required:
        - "FileType"
        - "FileHash"
        - "NumberOfTransactions"
        - "ControlSum"
      properties:
        FileType:
          $ref: "#/components/schemas/AEFileType"
        FileHash:
          $ref: "#/components/schemas/AEFileHash"
        FileReference:
          $ref: "#/components/schemas/AEReference"
        NumberOfTransactions:
          $ref: "#/components/schemas/AEFileNumberOfTransactions"
        ControlSum:
          $ref: "#/components/schemas/AEControlSum"
        RequestedExecutionDate:
          $ref: "#/components/schemas/AERequestedExecutionDate"
      additionalProperties: false
    AEPaymentConsumption:
      type: "object"
      description: |
        Data to track the consumption of Payments in relation to an authorized Consent Schedule
      required:
        - "CumulativeNumberOfPayments"
        - "CumulativeValueOfPayments"
        - "CumulativeValueOfPaymentsPerCurrentPeriod"
      properties:
        CumulativeNumberOfPayments:
          type: "number"
          description: |
            The cumulative number of payment instructions successfully accepted under the current consent schedule (Settlement on the Creditor's account has been completed)
          minLength: 1
          example: 4
        CumulativeValueOfPayments:
          description: |
            The cumulative value of payment instructions successfully accepted under the current consent schedule (Settlement on the Creditor's account has been completed)
            A number of monetary units specified in an active currency where the unit of currency is explicit and compliant with ISO 4217."
          type: "object"
          required:
            - "Amount"
            - "Currency"
          properties:
            Amount:
              $ref: "#/components/schemas/AEActiveOrHistoricAmount"
            Currency:
              $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"
        CumulativeNumberOfPaymentsPerCurrentPeriod:
          type: "number"
          description: |
            The cumulative number of payment instructions in the current period that are successfully accepted (Settlement on the Creditor's account has been completed)
          minLength: 1
          example: 1
        CumulativeValueOfPaymentsPerCurrentPeriod:
          description: |
            The cumulative value of payment instructions in the current period that are successfully accepted (Settlement on the Creditor's account has been completed)
            A number of monetary units specified in an active currency where the unit of currency is explicit and compliant with ISO 4217."
          type: "object"
          required:
            - "Amount"
            - "Currency"
          properties:
            Amount:
              $ref: "#/components/schemas/AEActiveOrHistoricAmount"
            Currency:
              $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"
      additionalProperties: false
    AEActiveOrHistoricAmount:
      description: "A number of monetary units specified in an active currency where the unit of currency is explicit and compliant with ISO 4217."
      type: "string"
      pattern: "^\\d{1,16}\\.\\d{2}$"
      example: "100.00"
    AEActiveOrHistoricCurrencyCode:
      description: "A 3 character alphabetic code allocated to a currency under an international currency identification scheme, as described in the latest edition of the international standard ISO 4217 'Codes for the representation of currencies and funds'."
      type: "string"
      pattern: "^[A-Z]{3,3}$"
      example: "AED"

    AERequestedExecutionDate:
      description: |
        The date when the TPP expects the LFI to execute the payment.
        The date must be in the future and cannot be on the same day or a day in the past.
        The maximum date in the future that can be specified is 1 year from the day of the consent of the User to the TPP.
        All dates in the JSON payloads are represented in ISO 8601 date format.
      type: "string"
      format: "date"
    AEExternalPaymentChargeTypeCode:
      description: "Charge type, in a coded form."
      type: "string"
      enum:
        - "VAT"
        - "Fees"
    AEChargeBearerType1Code:
      description: "Specifies which party/parties will bear the charges associated with the processing of the payment transaction."
      type: "string"
      enum:
        - "BorneByCreditor"
        - "BorneByDebtor"
        - "FollowingServiceLevel"
        - "Shared"
    AEActiveCurrencyAmount:
      description: |
        The Currency and Amount relating to the Payment, Refund or Request to Pay
      type: "object"
      required:
        - "Amount"
        - "Currency"
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveOrHistoricAmount"
        Currency:
          $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"

    AEDefinedSchedule:
      type: "object"
      description: |
        Payment Schedule denoting a list of pre-defined future dated payments all with fixed amounts and dates.
      additionalProperties: false
      required:
        - "Schedule"
        - "Type"
      properties:
        Type:
          type: "string"
          description: "The Periodic Schedule Type"
          enum:
            - DefinedSchedule
        Schedule:
          type: "array"
          minItems: 1
          uniqueItems: false
          items:
            type: "object"
            additionalProperties: false
            required:
              - "PaymentExecutionDate"
              - "Amount"
            properties:
              PaymentExecutionDate:
                $ref: "#/components/schemas/AEPaymentExecutionDate"
              Amount:
                $ref: "#/components/schemas/AEActiveCurrencyAmount"
    AEPaymentExecutionDate:
      description: |
        Used to specify the expected payment execution date/time.
        All dates in the JSON payloads are represented in ISO 8601 date format.
        An example is: 2023-04-05
      type: "string"
      format: "date"
    AEMaximumIndividualPaymentAmount:
      description: |
        This is the Maximum amount a variable payment related to the Consent can take.
        All payment amounts must be smaller or equal to this value.
      type: "object"
      required:
        - "Amount"
        - "Currency"
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveOrHistoricAmount"
        Currency:
          $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"
    AEPeriodType:
      type: "string"
      description: |
        A Period may begin from the Consent CreationDateTime if a PeriodStartDate is not provided.

        |Period Type|Description|
        |-----------|-----------|
        |Day|A continuous period of time, consisting of 24 consecutive hours, starting from midnight (00:00:00) and finishing at 23:59:59 of the same day. |
        |Week|A continuous period of time, consisting of seven consecutive days, starting from midnight (00:00:00) and finishing at 23:59:59 of the 7th day. |
        |Month|A continuous period of time starting from midnight (00:00:00) of the first day of a month and finishing at 23:59:59 of the last day of that month.|
        |Year|A continuous period of time, consisting of 12 months.|
      enum:
        - Day
        - Week
        - Month
        - Year
    AEPeriodStartDate:
      type: "string"
      description: |
        * Payments: Specifies the start date of when a payment schedule begins.

        Where this is an optional field, if a value is not provided, then it must default to the Consent CreationDateTime, starting from midnight 00:00:00.
      format: "date"
    AEVariablePeriodicSchedule:
      description: |
        Payment Controls that apply to all payment instructions in a given period under this payment consent.
      type: "object"
      additionalProperties: false
      required:
        - "PeriodType"
        - "Type"
      properties:
        Type:
          type: "string"
          description: "The Periodic Schedule Type"
          enum:
            - VariablePeriodicSchedule
        PeriodType:
          $ref: "#/components/schemas/AEPeriodType"
        PeriodStartDate:
          $ref: "#/components/schemas/AEPeriodStartDate"
        MaximumCumulativeValueOfPaymentsPerPeriodType:
          $ref: "#/components/schemas/AEPeriodTypeMaximumCumulativeValueOfPayments"
        MaximumCumulativeNumberOfPaymentsPerPeriodType:
          $ref: "#/components/schemas/AEPeriodTypeMaximumCumulativeNumberOfPayments"
    AEPeriodTypeMaximumCumulativeValueOfPayments:
      description: |
        The maximum cumulative payment value of all payment initiations per Period Type.
      type: "object"
      required:
        - "Amount"
        - "Currency"
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveOrHistoricAmount"
        Currency:
          $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"
    AEPeriodTypeMaximumCumulativeNumberOfPayments:
      type: "integer"
      description: |
        The maximum frequency of payment initiations per Period Type.
    AEMaximumCumulativeNumberOfPayments:
      type: "integer"
      description: |
        The maximum cumulative number of all successful payment rails executions under the Consent.
        Each successful payment rails execution (related to the Consent) is added to the total cumulative number of payments for the Consent which cannot exceed the maximum value agreed with the User at the point of consent.
    AEMaximumCumulativeValueOfPayments:
      description: |
        The maximum cumulative value of all successful payment rails executions under the Consent.
        Each successful payment rails execution amount (related to the Consent) is added to the total cumulative value of the Consent which cannot exceed the maximum value agreed with the User at the point of consent.
      type: "object"
      required:
        - "Amount"
        - "Currency"
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveOrHistoricAmount"
        Currency:
          $ref: "#/components/schemas/AEActiveOrHistoricCurrencyCode"
    AEExpectedInitiationTimeWindow:
      description: |
        A time window set by the TPP in which a Payment must be initated by the LFI.
        The time window is based on a custom time format hhh:mm:ss. e.g. 000:00:15 represents a time window of 15 seconds to initiate the Payment.
      type: "string"
      pattern: "^(00[0-9]|0[1-9][0-9]|[1-6][0-9]{2}|7[01][0-9]|720):[0-5][0-9]:[0-5][0-9]$"
      example: "000:00:15"

    AEPaymentAndFilePaymentRequest:
      description: The payment request body as received from the TPP
      oneOf:
        - $ref: "#/components/schemas/AEPaymentRequest"
        - $ref: "#/components/schemas/AEFilePaymentRequest"

    AEPaymentRequest:
      description: |
        Payment Request Schema
      type: "object"
      additionalProperties: false
      required:
        - "Data"
      properties:
        Data:
          type: "object"
          additionalProperties: false
          required:
            - "ConsentId"
            - "Instruction"
            - "PersonalIdentifiableInformation"
            - "PaymentPurposeCode"
          properties:
            ConsentId:
              $ref: "#/components/schemas/AEConsentId"
            Instruction:
              $ref: "#/components/schemas/AEPaymentInstruction"
            CurrencyRequest:
              $ref: "#/components/schemas/AECurrencyRequest"
            PersonalIdentifiableInformation:
              $ref: "#/components/schemas/AEJWEPaymentPII"
            PaymentPurposeCode:
              $ref: "#/components/schemas/AEPaymentPurposeCode"
            DebtorReference:
              $ref: "#/components/schemas/AEStructuredDebtorReference"
            CreditorReference:
              $ref: "#/components/schemas/AEStructuredCreditorReference"

    AEFilePaymentRequest:
      description: |
        File Payment Request Schema
      type: "object"
      additionalProperties: false
      required:
        - "Data"
      properties:
        Data:
          type: "object"
          additionalProperties: false
          required:
            - "ConsentId"
            - "PaymentPurposeCode"
          properties:
            ConsentId:
              $ref: "#/components/schemas/AEConsentId"
            Instruction:
              $ref: "#/components/schemas/AEFilePaymentConsent"
            PaymentPurposeCode:
              $ref: "#/components/schemas/AEPaymentPurposeCode"
            DebtorReference:
              $ref: "#/components/schemas/AEStructuredDebtorReference"

    AEStructuredCreditorReference:
      description: |
        A reason or reference in relation to a payment, set to facilitate a structured Creditor reference consisting of:

        * TPP ID and BIC for the Debtor Account, followed by freeform text to a maximum of 120 characters.

        The TPP ID value will match the organization ID value from the Trust Framework, and therefore will be a v4 UUID.

        A BIC is specific according to the standard format for ISO 20022, and can therefore be either 8 or 11 characters in length.

        If the value of the concatenated string exceeds 120 characters, the TPP must first omit or truncate the freeform element of the reference.
      type: "string"
      minLength: 1
      maxLength: 120
      pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12},BIC=[A-Z0-9]{4}[A-Z0-9]{2}[A-Z0-9]{2}([A-Z0-9]{3}){0,1}($|,.+$)"

    AEPaymentInstruction:
      type: "object"
      additionalProperties: false
      required:
        - "Amount"
        - "PaymentSequenceNumber"
      description: "The Initiation payload is sent by the initiating party to the LFI. It is used to request movement of funds from the debtor account to a creditor for a single payment."
      properties:
        Amount:
          $ref: "#/components/schemas/AEActiveCurrencyAmount"
        PaymentSequenceNumber:
          $ref: "#/components/schemas/AEPaymentSequenceNumber"

    AEPaymentSequenceNumber:
      type: "string"
      description: |
        This indicates the underlying sequence of the recurring payment that is being instructed.
        For example:
        * 1 can represent the first payment instruction
        * 12 can represent the twelfth payment instruction
      minLength: 1
      maxLength: 10
      pattern: "^[1-9]\\d*$"

    consent:
      description: |

        A consent in its current state.

        If the consent has been authorised, then it can be expected that the financial institution would have patched in `accountIds` and `psuIdentifier` fields.

        Additionally, the financial institution may also patch in an arbitrary set of fields along with consent in the `supplementaryInformation` field.

      allOf:
        - $ref: "#/components/schemas/newConsent"
        - $ref: "#/components/schemas/patchedConsent"

    multiConsentResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/consent"
        meta:
          $ref: "#/components/schemas/meta"

    ConsentPostResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: "#/components/schemas/newConsent"

        meta:
          $ref: "#/components/schemas/meta"

    RevokeConsent:
      type: object
      required:
        - revokedBy
      properties:
        revokedBy:
          $ref: "#/components/schemas/AERevokedBy"
        revokedByPsu:
          type: object
          properties:
            userId:
              type: string


    AuthorizationDetails:
      description: |
        The request body for creating a new consent.

        The body consists of the RAR request that is sent by the TPP to the authorization server.

      oneOf:
        - $ref: "#/components/schemas/DataSharingAuthorizationDetails"
        - $ref: "#/components/schemas/InsuranceAuthorizationDetails"
        - $ref: "#/components/schemas/ServiceInitiationAuthorizationDetails"

    DataSharingAuthorizationDetails:
      type: object
      properties:
        Type:
          type: string
        Consent:
          $ref: "#/components/schemas/AuthorizationDetailsDataSharingConsent"
        Subscription:
          $ref: '#/components/schemas/EventNotification'

    InsuranceAuthorizationDetails:
      type: object
      properties:
        Type:
          type: string
        Consent:
          $ref: "#/components/schemas/AuthorizationDetailsInsuranceConsent"
        Subscription:
          $ref: '#/components/schemas/EventNotification'

    ServiceInitiationAuthorizationDetails:
      type: object
      properties:
        Type:
          type: string
        Consent:
          $ref: "#/components/schemas/AEServiceInitiationAuthorizationDetailProperties"
        Subscription:
          $ref: '#/components/schemas/EventNotification'

    AEServiceInitiationAuthorizationDetailProperties:
      type: object
      required:
        - ConsentId
        - PersonalIdentifiableInformation
        - ControlParameters
        - PaymentPurposeCode
      properties:
        ConsentId:
          $ref: '#/components/schemas/AEConsentId'
        BaseConsentId:
          $ref: '#/components/schemas/AEBaseConsentId'
        IsSingleAuthorization:
          $ref: '#/components/schemas/IsSingleAuthorization'
        AuthorizationExpirationDateTime:
          type: string
          format: date-time
          description: |2-
                A time by which a Consent (in AwaitingAuthorization status) must be Authorized by the User.
                The time window starts from the actual CreationDateTime (when the Consent is staged with the LFI).
                If the current time window exceeds the Authorization Expiration Time Window (and the Consent status is AwaitingAuthorization) then the Consent Status must be set to Rejected.
                The time window is based on a custom time format hhh:mm:ss. e.g. 720:00:00 represents a time window of 720 hours, 00 minutes, 00 seconds (30 days) after the CreationDateTime to Authorize the Consent.
        ExpirationDateTime:
          allOf:
            - $ref: '#/components/schemas/ARConsentExpirationDateTime'
          description: |2-
                Specified date and time the consent will expire.
                If this is not populated, the consent will remain active as a long lived consent until the maximum consent validity period as per section 4.1.1 Consent Elements in the API User Guide.
                All dates in the JSON payloads are represented in ISO 8601 date-time format.
                All date-time fields in responses must include the timezone. An example is :2023-04-05T10:43:07+00:00

                * For Payment Consents, the maximum expiration time limit should be 23:59:59 (1 second before 00:00:00)
        Permissions:
          type: array
          items:
            $ref: '#/components/schemas/AEServiceInitiationConsentPermissionCodes'
          description: |2-
              Specifies the permitted Account Access data types.
              This is a list of the data groups being consented by the User, and requested for authorization with the LFI.

              This allows a TPP to request a balance check permission.
        ReadRefundAccount:
          type: boolean
          description: Allows the LFI to share the refund account details with TPP
        CurrencyRequest:
          $ref: '#/components/schemas/AECurrencyRequest'
        PersonalIdentifiableInformation:
          $ref: '#/components/schemas/AEJWEPaymentPII'
        ControlParameters:
          $ref: '#/components/schemas/AEServiceInitiationConsentControlParameters'
        DebtorReference:
          $ref: '#/components/schemas/AEServiceInitiationStructuredDebtorReference'
        CreditorReference:
          $ref: '#/components/schemas/AEServiceInitiationStructuredCreditorReference'
        PaymentPurposeCode:
          $ref: '#/components/schemas/AEServiceInitiationPaymentPurposeCode'
        SponsoredTPPInformation:
          $ref: '#/components/schemas/AEServiceInitiationSponsoredTPPInformation'
      additionalProperties: false

    ARConsentExpirationDateTime:
      type: string
      format: date-time

    AEServiceInitiationSponsoredTPPInformation:
      type: object
      required:
        - Name
        - Identification
      properties:
        Name:
          type: string
          minLength: 1
          maxLength: 50
          description: The Sponsored TPP Name
        Identification:
          type: string
          minLength: 1
          maxLength: 50
          description: The Sponsored TPP Identification
      description: |2-
            The Sponsored TPP is:
            * A TPP that itself has no direct Open Banking API integrations.
            * A TPP that is using the integration of another TPP that does have direct Open Banking API integrations.
      additionalProperties: false

    AEServiceInitiationPaymentPurposeCode:
      type: string
      minLength: 1
      maxLength: 4
      pattern: ^[A-Z]{4}$
      description: |2-
            A Category code, related to the type of services or goods that corresponds to the underlying purpose of the Payment.
            * The ISO20022 External code sets

    AEServiceInitiationStructuredCreditorReference:
      description: |
        A reason or reference in relation to a payment, set to facilitate a structured Creditor reference consisting of:

        * TPP ID and BIC for the Debtor Account, followed by freeform text to a maximum of 120 characters.

        The TPP ID value will match the organization ID value from the Trust Framework, and therefore will be a v4 UUID.

        A BIC is specific according to the standard format for ISO 20022, and can therefore be either 8 or 11 characters in length.

        If the value of the concatenated string exceeds 120 characters, the TPP must first omit or truncate the freeform element of the reference.
      type: "string"
      minLength: 1
      maxLength: 120
      pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12},BIC=[A-Z0-9]{4}[A-Z0-9]{2}[A-Z0-9]{2}([A-Z0-9]{3}){0,1}($|,.+$)"

    AEServiceInitiationStructuredDebtorReference:
      description: |
        A reason or reference in relation to a payment, set to facilitate a structured Debtor reference consisting of:

        * For payments to Merchants: TPP ID, Merchant ID, BIC for the Creditor Account, followed by freeform text to a maximum of 120 characters.

        * For other payments: TPP ID and BIC for the Creditor Account, followed by freeform text to a maximum of 120 characters.

        The TPP ID value will match the organization ID value from the Trust Framework, and therefore will be a v4 UUID.

        The Merchant ID wil be as per the existing IPP rules for the Merchant identification, and will incorporate the Trade License number for the Merchant.

        A BIC is specific according to the standard format for ISO 20022, and can therefore be either 8 or 11 characters in length.

        If the value of the concatenated string exceeds 120 characters, the TPP must omit or truncate the freeform element of the reference.
      oneOf:
        - type: "string"
          minLength: 1
          maxLength: 120
          pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12},Merchant=[A-Z0-9]{3}-[A-Z]{4}-TL.+-[0-9]{4},BIC=[A-Z0-9]{4}[A-Z0-9]{2}[A-Z0-9]{2}([A-Z0-9]{3}){0,1}($|,.+$)"
        - type: "string"
          minLength: 1
          maxLength: 120
          pattern: "^TPP=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12},BIC=[A-Z0-9]{4}[A-Z0-9]{2}[A-Z0-9]{2}([A-Z0-9]{3}){0,1}($|,.+$)"

    AEServiceInitiationConsentControlParameters:
      type: object
      properties:
        IsPayByAccount:
          type: boolean
          description: A flag to denote if the Payment is an E-Commerce transaction
        ConsentSchedule:
          $ref: '#/components/schemas/AEServiceInitiationConsentSchedule'
      description: Control Parameters set the overall rules for the Payment Schedule
      additionalProperties: false

    AEServiceInitiationConsentSchedule:
      type: object
      properties:
        SinglePayment:
          $ref: '#/components/schemas/AEServiceInitiationSinglePayment'
        MultiPayment:
          $ref: '#/components/schemas/AEServiceInitiationLongLivedPaymentConsent'
        FilePayment:
          $ref: '#/components/schemas/AEServiceInitiationFilePaymentConsent'
      description: |2-
            The various payment types that can be initiated:
            * A Single Payment
            * A Multi-Payment
            * A Combined Payment (one SinglePayment and one MultiPayment)
      additionalProperties: false

    AEServiceInitiationFilePaymentConsent:
      type: object
      required:
        - FileType
        - FileHash
        - NumberOfTransactions
        - ControlSum
      properties:
        FileType:
          type: string
          minLength: 1
          maxLength: 40
          description: Specifies the payment file type
        FileHash:
          type: string
          minLength: 1
          maxLength: 44
          description: A base64 encoding of a SHA256 hash of the file to be uploaded.
        FileReference:
          $ref: '#/components/schemas/AEServiceInitiationReference'
        NumberOfTransactions:
          type: integer
          description: >-
            Number of individual transactions contained in the payment
            information group.
        ControlSum:
          type: string
          pattern: ^\d{1,16}\.\d{2}$
          description: >-
            Total of all individual amounts included in the group, irrespective
            of currencies.
        RequestedExecutionDateTime:
          $ref: '#/components/schemas/AERequestedExecutionDate'
      description: A Consent definition for defining Bulk/Batch Payments
      additionalProperties: false

    AEServiceInitiationReference:
      type: string
      minLength: 1
      maxLength: 120
      description: A reason or reference in relation to a payment.

    AEServiceInitiationLongLivedPaymentConsent:
      type: object
      required:
        - Amount
        - MaximumIndividualPaymentAmount
        - PeriodicSchedule
      properties:
        Amount:
          $ref: '#/components/schemas/AEAmountAndCurrency'
        MaximumIndividualPaymentAmount:
          allOf:
            - $ref: '#/components/schemas/AEAmountAndCurrency'
          description: |2-
                This is the Maximum amount a variable payment related to the Consent can take.
                All payment amounts must be smaller or equal to this value.
        MaximumCumulativeValueOfPayments:
          allOf:
            - $ref: '#/components/schemas/AEAmountAndCurrency'
          description: |2-
                The maximum cumulative value of all successful payment rails executions under the Consent.
                Each successful payment rails execution amount (related to the Consent) is added to the total cumulative value of the Consent which cannot exceed the maximum value agreed with the User at the point of consent.
        MaximumCumulativeNumberOfPayments:
          type: integer
          description: |2-
                The maximum cumulative number of all successful payment rails executions under the Consent.
                Each successful payment rails execution (related to the Consent) is added to the total cumulative number of payments for the Consent which cannot exceed the maximum value agreed with the User at the point of consent.
        PeriodicSchedule:
          $ref: >-
            #/components/schemas/AEServiceInitiationLongLivedPaymentConsentPeriodicSchedule
      description: A Consent definition for defining Multi Payments
      additionalProperties: false

    AEServiceInitiationLongLivedPaymentConsentPeriodicSchedule:
      type: object
      required:
        - DefinedSchedule
        - FixedPeriodicSchedule
        - VariablePeriodicSchedule
      properties:
        DefinedSchedule:
          $ref: '#/components/schemas/AEServiceInitiationDefinedSchedule'
        FixedPeriodicSchedule:
          $ref: '#/components/schemas/AEServiceInitiationFixedPeriodicSchedule'
        VariablePeriodicSchedule:
          $ref: '#/components/schemas/AEServiceInitiationVariablePeriodicSchedule'
        Type:
          type: string
          description: >-
            Discriminator property for
            AEServiceInitiationLongLivedPaymentConsentPeriodicSchedule.
      discriminator:
        propertyName: Type
      description: The definition for a schedule
      additionalProperties: false

    AEServiceInitiationVariablePeriodicSchedule:
      type: object
      required:
        - Type
        - PeriodType
        - MaximumCumulativeValueOfPaymentsPerPeriodType
        - MaximumCumulativeNumberOfPaymentsPerPeriodType
      properties:
        Type:
          type: string
          enum:
            - VariablePeriodicSchedule
        PeriodType:
          $ref: '#/components/schemas/AEPeriodType'
        PeriodStartDate:
          $ref: '#/components/schemas/AEPeriodStartDate'
        MaximumCumulativeValueOfPaymentsPerPeriodType:
          allOf:
            - $ref: '#/components/schemas/AEAmountAndCurrency'
          description: >-
            The maximum cumulative payment value of all payment initiations per
            Period Type.
        MaximumCumulativeNumberOfPaymentsPerPeriodType:
          type: integer
          description: The maximum frequency of payment initiations per Period Type.
      description: >-
        Payment Controls that apply to all payment instructions in a given
        period under this payment consent.
      additionalProperties: false

    AEServiceInitiationSchedule:
      type: object
      required:
        - PaymentExecutionDate
        - Amount
      properties:
        PaymentExecutionDate:
          type: string
          format: date
          description: |2-
                Used to specify the expected payment execution date/time.
                All dates in the JSON payloads are represented in ISO 8601 date format.
                An example is: 2023-04-05
        Amount:
          $ref: '#/components/schemas/AEAmountAndCurrency'
      additionalProperties: false

    AEServiceInitiationFixedPeriodicSchedule:
      type: object
      required:
        - Type
        - PeriodType
        - PeriodStartDate
        - Amount
      properties:
        Type:
          type: string
          enum:
            - FixedPeriodicSchedule
        PeriodType:
          $ref: '#/components/schemas/AEPeriodType'
        PeriodStartDate:
          $ref: '#/components/schemas/AEPeriodStartDate'
        Amount:
          $ref: '#/components/schemas/AEAmountAndCurrency'
      description: >-
        Payment Controls that apply to all payment instructions in a given
        period under this payment consent.
      additionalProperties: false

    AEServiceInitiationDefinedSchedule:
      type: object
      required:
        - Type
        - Schedule
      properties:
        Type:
          type: string
          enum:
            - DefinedSchedule
          description: The Periodic Schedule Type
        Schedule:
          type: array
          items:
            $ref: '#/components/schemas/AEServiceInitiationSchedule'
          minItems: 1
      description: >-
        Payment Schedule denoting a list of pre-defined future dated payments
        all with fixed amounts and dates.
      additionalProperties: false

    AEServiceInitiationSinglePayment:
      anyOf:
        - $ref: '#/components/schemas/AEServiceInitiationSingleInstantPayment'
        - $ref: '#/components/schemas/AEServiceInitiationFutureDatedPayment'
      discriminator:
        propertyName: Type
        mapping:
          SingleInstantPayment: '#/components/schemas/AEServiceInitiationSingleInstantPayment'
          SingleFutureDatedPayment: '#/components/schemas/AEServiceInitiationFutureDatedPayment'
      description: A Consent definition for defining Single Payments

    AEServiceInitiationFutureDatedPayment:
      type: object
      required:
        - Type
        - Amount
        - RequestedExecutionDate
      properties:
        Type:
          type: string
          enum:
            - SingleFutureDatedPayment
        Amount:
          $ref: '#/components/schemas/AEAmountAndCurrency'
        RequestedExecutionDate:
          $ref: '#/components/schemas/AERequestedExecutionDate'
      description: >-
        A long-lived consent that MUST be used for a single payment which will
        be authorized by the User during the payment journey, but the payment
        will be initiated by the TPP in the future.
      additionalProperties: false

    AEServiceInitiationSingleInstantPayment:
      type: object
      required:
        - Type
        - Amount
      properties:
        Type:
          type: string
          enum:
            - SingleInstantPayment
          description: The Payment Type
        Amount:
          $ref: '#/components/schemas/AEAmountAndCurrency'
        ExpectedInitiationTimeWindow:
          $ref: '#/components/schemas/AEExpectedInitiationTimeWindow'
      description: >-
        A single immediate payment consent that MUST be be used for a single
        payment which will be initiated immediately after User authorization at
        the LFI.
      additionalProperties: false

    AEAmountAndCurrency:
      type: object
      required:
        - Currency
        - Amount
      properties:
        Currency:
          $ref: '#/components/schemas/CurrencyCode'
        Amount:
          $ref: '#/components/schemas/Amount'
      description: >-
        The Currency and Amount relating to the Payment, Refund or Request to
        Pay
      additionalProperties: false

    Amount:
      type: number

    CurrencyCode:
      type: string
      pattern: ^[A-Z]{3}$

    IsSingleAuthorization:
      description: |
        Specifies to the LFI that the consent authorization must be completed in a single authorization Step
        with the LFI
      type: "boolean"

    AEServiceInitiationConsentPermissionCodes:
      type: string
      enum:
        - ReadAccountsBasic
        - ReadAccountsDetail
        - ReadBalances

    AEJWEPaymentPII:
      type: string
      description: |2-
            A JSON Web Encryption (JWE) object, which encapsulates a JWS. The value is a compact serialization
            of a JWE, which is a string consisting of five base64url-encoded parts joined by dots. It encapsulates encrypted content using JSON data structures.

            The decrypted JWS content has the structure of the AEPaymentPII schema.

    AuthorizationDetailsDataSharingConsent:
      type: object
      required:
        - ConsentId
        - Permissions
      properties:
        ConsentId:
          $ref: '#/components/schemas/AEConsentId'
        Permissions:
          type: array
          items:
            $ref: '#/components/schemas/AEAccountAccesssConsentPermissionCodes'
          minItems: 1
      allOf:
        - $ref: '#/components/schemas/AEAccountAccessAuthorizationDetailsProperties'
      additionalProperties: false

    AuthorizationDetailsInsuranceConsent:
      type: object
      required:
        - ConsentId
        - Permissions
      properties:
        BaseConsentId:
          type: string
        ExpirationDateTime:
          type: string
          format: date-time
        OnBehalfOf:
          $ref: '#/components/schemas/OnBehalfOf'
        Purpose:
          type: array
          items:
            $ref: '#/components/schemas/OBConsentPurpose'
        ConsentId:
          $ref: '#/components/schemas/AEConsentId'
        Permissions:
          $ref: '#/components/schemas/AEInsuranceConsentPermissions'

    OBConsentPurpose:
      type: string
      enum:
        - InsurancePolicyAggregation
        - PersonalFinanceManager
        - CreditAssessment
        - MotorInsuranceQuote
        - EnterpriseFinancialManagement
        - Other

    AEAccountAccessAuthorizationDetailsProperties:
      type: object
      properties:
        BaseConsentId:
          $ref: '#/components/schemas/AEBaseConsentId'
        ExpirationDateTime:
          type: string
          format: date-time
          description: |>-
            AnSpecified arraydate ofand accounttime idsthe associatedpermissions withwill the consentexpire.
The
array must be populated once consent has been authorised.    If this is not populated, the permissions will be Foropen serviceended.All
initiation, the array must always have one element - the debtor account fromdates whichin the paymentJSON willpayloads beare maderepresented in ISO 8601 date-time
        For data sharing requests, the array may contain multiple values, representing each of the payment accounts for which an AIS service will be provided.

        supplementaryInformation: format.

            All date-time fields in responses must include the timezone. An
            example is descriptionbelow:

           Contains additional information at the discretion of the financial institution.
 2017-04-05T10:43:07+00:00
        TransactionFromDateTime:
          type: objectstring
          additionalPropertiesformat: truedate-time
          statusdescription: |2-
         description: |      Specified start date and time for the The current status of the consent for the consent.transaction query period.

                If this is •••TODO•••not Specifypopulated, the start date consentwill statusesbe supportedopen forended, CBUAEand
          type: string     data will be returned  consentBody.Meta.MultipleAuthorizers:
 from the earliest available
        $ref: "#/components/schemas/AEMetaMultiAuthorization"      AEMetaMultiAuthorization: transaction.All dates in the JSON payloads type: "object"
are represented in
     description: |         Meta DataISO with8601 Multi-Authorization relevant to the payload.date-time format.

           For a payment, it represents anyAll Authorizersdate-time withinfields thein financialresponses institutionmust domaininclude thatthe aretimezone. involvedAn
in approving the payment request.       properties:     example is below:

TotalRequired:           description: |    2017-04-05T10:43:07+00:00
        TheTransactionToDateTime:
total number of Authorizers required to process the request  type: string
       type: "number"  format: date-time
     Authorizations:     description: |2-
    type: "array"           items:Specified end date and time for the transaction query period.

  description: |             If this Authorizeris not populated, the end date will be open ended, and
  type: "object"             properties:data will be returned to the latest available transaction.All
      AuthorizerId:          dates in the JSON payloads are represented description:in |ISO 8601 date-time
                Theformat.
Authorizer's
Identifier                All type: "string"
      date-time fields in responses must include the timezone. An
       AuthorizerType:         example is below:

    description: |           2017-04-05T10:43:07+00:00
       The TypeAccountType:
of Authorizer. For example, Financial, Management, etc.    type: array
          items:
type: "string"           $ref: '#/components/schemas/AEExternalAccountTypeCode'
  AuthorizationDate:      AccountSubType:
          descriptiontype: |array
          items:
       The DateTime of when the Authorization occurred. All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2023-04-05T10:43:07+00:00$ref: '#/components/schemas/AEAccountSubTypeCode'
        OnBehalfOf:
          $ref: '#/components/schemas/AEOnBehalfOf'
        Purpose:
          type: "string"array
          items:
     format: "date-time"      $ref: '#/components/schemas/AEAccountAccessConsentPurpose'
       AuthorizationStatusadditionalProperties: false

       AEExternalAccountTypeCode:
      description: |Specifies the type of account (Retail, SME or Corporate).
      type: string
  The Status reflecting the Authorizer'senum:
final decision regarding the request    - Retail
        - SME
 type: "string"      - Corporate

    OnBehalfOf:
   enum:   type: object
      description: On Behalf Of
    - "Pending" properties:
        TradingName:
        - "Approved" type: string
          description: Trading Name
   - "Rejected"      example: Acme Accounting Trading Name
  additionalProperties: false        LegalName:
  additionalProperties: false       additionalPropertiestype: string
false      consent:    description: Legal Name
description: |         example: AAcme consentAccounting inLegal itsName
current state.       IdentifierType:
  If the consent has been authorised, then it cantype: bestring
expected that the financial institution would have patched in `accountIds` anddescription: `psuIdentifier`Identifier fields.Type
         Additionally, theenum:
financial institution may also patch in an arbitrary set of fields along with- consentOther
in the `supplementaryInformation` field.     Identifier:
    •••TODO••• Import the schemas for the consenttype: fromstring
the CBUAE specification        allOfdescription: Identifier
       - $ref: "#/components/schemas/newConsent"
  example: abcd1234
      - $refadditionalProperties: "#/components/schemas/patchedConsent"false

    multiConsentResponseAEInsuranceConsentPermissions:
      type: objectstring
      requiredenum:
        - dataReadMotorInsurancePolicies
        - meta ReadMotorInsuranceCustomerBasic
        - ReadMotorInsuranceCustomerDetail
   properties:     - ReadMotorInsuranceCustomerPaymentDetails
  data:      - ReadMotorInsuranceProduct
   type: array    - ReadMotorInsuranceTransactions

    itemsEventNotification:
      type: object
      $ref: "#/components/schemas/consent"
description: |
       meta: A Webhook Subscription Schema
      $refrequired: "#/components/schemas/meta"
        - ConsentPostResponse:Webhook
      typeproperties:
object        requiredWebhook:
          -description: data|
        - meta   A Webhook Schema
 properties:         datatype: object
          $refproperties:
"#/components/schemas/newConsent"          meta:  Url:
        $ref: "#/components/schemas/meta"      RevokeConsentdescription: |
     type: object       required:   The TPP Callback URL being registered -with revokedBythe LFI
     properties:         revokedBytype: string
         type: string    example: https://api.tpp.com/webhook/callbackUrl
     enum:       IsActive:
     - ADR        description: >
   - CONSUMER            The -TPP COLLEAGUEspecifying whether the LFI should send (IsActive true)
     - REGISTER          or not send -(IsActive EXPIRATIONfalse) Webhook Notifications to the TPP's
       - AMENDMENT        Webhook revokedByPsu:URL
          type: object   type: boolean
      properties:        example: false
   userId:       additionalProperties: false
      typeadditionalProperties: stringfalse

  parameters:
    consentId:
      name: consentId
      in: path
      schema:
        type: string
      required: true
      description: |
        Identifies the consent by an id
    id:
      name: id
      in: path
      schema:
        type: string
      required: true
      description: |
        Identifies the payment by an id

    userId:
      name: userId
      in: path
      schema:
        type: string
      required: true
      description: |
        Identifies the PSU associated with a consent.

        This should match up with the `psuIdentifier.userId` field.

    page:
      name: page
      in: query
      schema:
        type: string
        format: int32
        minimum: 1
      required: false
      description: |
        The page number to retrieve in a paginated response

    pageSize:
      name: pageSize
      in: query
      schema:
        type: string
        format: int32
        minimum: 1
      required: false
      description: |
        The maximum rows to retrieve in a given page. Defaults to 25 if not specified.

    consentType:
      name: consentType
      in: query
      schema:
        type: string
      description: Consents of particular accountId
      required: false

    status:
      name: status
      in: query
      schema:
        type: string
      description: Status of the consent
      required: false

  securitySchemes:
    api_key:
      type: apiKey
      name: api_key
      in: header
      description: TLS-MA and Jws in authorization header

...