AUTHENTICATION_RESULT:
  description: Represents the result of the strong consumer authentication for the payment transaction
  type: string
  enum:
    - Y # AUTHENTICATION_SUCCESSFUL
    - N # AUTHENTICATION_FAILED
    - U # AUTHENTICATION_UNAVAILABLE
    - A # AUTHENTICATION_ATTEMPTED
    - C # CHALLENGE_REQUIRED
    - R # AUTHENTICATION_REJECTED
  x-enum-varnames:
    - AUTHENTICATION_SUCCESSFUL   # Y
    - AUTHENTICATION_FAILED       # N
    - AUTHENTICATION_UNAVAILABLE  # U
    - AUTHENTICATION_ATTEMPTED    # A
    - CHALLENGE_REQUIRED          # C
    - AUTHENTICATION_REJECTED     # R
  x-enum-descriptions:
    - Authentication / Account Verification Successful
    - Not Authenticated / Account Not Verified; Transaction denied
    - Authentication / Account Verification Could Not Be Performed; Technical or other problem
    - Attempts Processing Performed; Not Authenticated / Verified, but a proof of attempted authentication / verification is provided
    - Challenge Required; Additional authentication of the consumer is required
    - Authentication/ Account Verification Rejected; Issuer is rejecting authentication / verification and request that authorisation not be attempted.
  example: Y

AbstractAuthenticationResult:
  description: |
    A representation of an abstract result of strong consumer authentication (SCA) using 3D Secure.
    An instance of this entity will never be returned directly, instead one of its sub-entities will be returned.
  type: object
  required:
    - result
    - type
  properties:
    result:
      description: The result of the strong consumer authentication performed by the Access Control Server (ACS)
      $ref: 'authentication-result_v1.yaml#/AUTHENTICATION_RESULT'
      example: Y
    type:
      description: The authentication result type
      type: string
      enum:
        - SUCCESS
        - FAILURE
        - CHALLENGE
      example: SUCCESS
    authentication_type:
      description: The type of authentication method the Issuer will or did use to challenge the consumer to complete the strong authentication process using 3D Secure v2
      $ref: 'authentication-type_v1.yaml#/AUTHENTICATION_TYPE'
      example: 2
  discriminator:
    propertyName: type
    mapping:
      SUCCESS: '#/AuthenticationSuccessResult'
      FAILURE: '#/AuthenticationFailureResult'
      CHALLENGE: '#/AuthenticationChallengeResult'

AuthenticationSuccessResult:
  description: |
    A representation of the successful authentication of the consumer for a payment transaction using 3D Secure.
    The payment for the payment transaction should be authorized upon receiving a successful authentication result
  type: object
  required:
    - cryptogram
  properties:
    cryptogram:
      description: |
        Payment System-specific value provided as part of the Access Control Server (ACS) registration for each supported Director Server (DS).
        The cryptogram should be included in the authorization request as proof of authentication.
      type: string
      format: byte
      minLength: 1
      example: eyJhY3NPcGVyYXRvcklEIjoiM2RzZWN1cmVpby1zdGFuZGluLWFjcyIsImFjc1JlZmVyZW5jZU51bWJlciI6IjNkc2VjdXJlaW8tc3RhbmRpbi1hY3MiLCJhY3NUcmFuc0lEIjoiOGIwMWE1NmEtNTZlMS00MzAyLThhNzQtNzNkNGFjYzVhOTlkIiwiYXV0aGVudGljYXRpb25WYWx1ZSI6ImtqaUp1TXkyTGJzamRWU1RQODdzMGxZOFBPcz0iLCJkc1JlZmVyZW5jZU51bWJlciI6IjNkc2VjdXJlaW8tc3RhbmRpbi1kcyIsImRzVHJhbnNJRCI6ImM2YmEwZGE3LTgyNzQtNDMyMS1iZjAwLTZkNzhkNzVmNTdlNiIsImVjaSI6IjA1IiwibWVzc2FnZVR5cGUiOiJBUmVzIiwibWVzc2FnZVZlcnNpb24iOiIyLjIuMCIsInRocmVlRFNTZXJ2ZXJUcmFuc0lEIjoiMDUzMTUwMDItZTgzYi00OGRlLTllN2ItMDM5ZThlYmJkYjUwIiwidHJhbnNTdGF0dXMiOiJZIn0=
  allOf:
    - $ref: '#/AbstractAuthenticationResult'

AuthenticationFailureResult:
    description: |
      A representation of a failed authentication of the consumer for a payment transaction using 3D Secure.
      The consumer should be informed of the authentication failure and asked to enter the details of another card upon
      receiving a failure authentication result or the payment transaction should be abandoned so no authorization is attempted.
    type: object
    required:
    - status_code
    properties:
      status_code:
        description: The detailed status code indicating why the authentication failed
        $ref: '../../common/status-message/status-code_v1.yaml#/STATUS_CODE'
        example: 660511
    allOf:
    - $ref: '#/AbstractAuthenticationResult'

AuthenticationChallengeResult:
    description: |
      A representation of an attempted authentication of the consumer for a payment transaction,
      which requires the consumer to complete an additional challenge as part of the strong consumer authentication process using 3D Secure.
    type: object
    required:
      - challenge_mandated
      - authentication_id
      - acs_url
      - request_data
    properties:
      challenge_mandated:
        description: Indicates whether a challenge is required for the transaction to be authorised due to local/regional mandates or other variable.
        type: boolean
        example: false
      authentication_id:
        description: The universally unique transaction identifier assigned by the 3DS Server or MPI to identify a single transaction.
        type: string
        minLength: 1
        maxLength: 40
        example: d8df6e3b-f012-4417-a1de-3e038b72c551
      acs_url:
        description: The URL to the Access Control Server (ACS), which will be used for the authentication challenge during the strong consumer authentication (SCA) process.
        type: string
        format: uri
        minLength: 1
        maxLength: 2048
        example: https://secure5.arcot.com/acspage/cap?RID=35325&VAA=B
      request_data:
        description: |-
          The base64 encoded request data that must be sent to the Access Control Server (ACS).
          This needs to be sent to the ACS in the `creq` field.
        type: string
        example: eNpdU8tymzAU3ecrvMumYz1AgD2yZnDsTpMZx06TRdudLK5skhiIgNjust/Tr+qXVMIm4DDDoHvuOdKZexB/2hqA2SOo2oC4Ggz4AspSbmCQJpPrSELAZKApSOyFkWYaY+brJAq0pzTQa6ewmlX8Hd4aRZDoKMIs8WXiK2/NvIAFDPwwoRrCkV6fFVbzDqZM80yQIR5SjtqybRcyE4xFPmUhoZiGhPkRRw5tGQswaiuzqgUsJNXb9PZeMBpYFUfnsuvvwNzOBKa4fTg6QR0lkzsQ84PcFa/AUVN1TZXXWWWOgmLrpS26dm1exbaqijFC+/1+CKddhrnZII5cs7WOPnvnq9oBZf+wQ5qIxSzed+/8uPj9QO6flb98iiccOUbHT2QF1hlhmODRgARj6o0Z46jBezPaOd/i35+/hH7x7ATOQMconJf4hBLqKH2kN43aGMjUUYxCN4626ghwKPIMrMbm+7HuGYZSCevPfT4m83kQ/ObbRcCqsnHls7V++fVAHoPlnb/9eVMuVz+m8fzrNN5MXOwN6cJHaoMiETkZSbvUOGr3t0e7v7i5A+h8CcQVR5cX5D/FxN2u
    allOf:
    - $ref: '#/AbstractAuthenticationResult'