ConsumerWalletPayment:
  description: |
    A representation of a payment made using Transpayrent's Consumer Wallet.  
    Authentication of the payment is enabled using Single Sign-On towards the merchant's systems.  
    Please note that authorizations using a payment card from the consumer's wallet is set to `card holder initiated`.
  type: object
  required:
    - valuable_id
    - access_token
  properties:
    valuable_id:
      description: |
        The unique ID for the valuable stored in the consumer's wallet that will be used to authorize the payment for the payment transaction.  
        Please note that this id is returned in the callback from Transpayrent upon successful authorization of the original payment transaction
        where the consumer elected to save the payment instrument.
      $ref: '../../common/record-entity-id/record-entity-id_v1.yaml#/RecordEntityId'
    access_token:
      description: |
        The access token used to authenticate the consumer's payment using the specified payment instrument from the consumer's wallet.  
        Authentication of the payment is enabled using Single Sign-On towards the merchant's systems.
      type: string
      minLength: 1
      example: |
        eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEwMDAsI
        mlzcyI6Imh0dHBzOi8vYXV0aG9yaXphdGlvbi1zZXJ2ZXIuY29tIiw
        iY2lkIjoiaHR0cHM6Ly9leGFtcGxlLWFwcC5jb20iLCJpYXQiOjE0N
        zAwMDI3MDMsImV4cCI6MTUyOTE3NDg1MSwic2NvcGUiOiJyZWFkIHd
        yaXRlIn0.QiIrnmaC4VrbAYAsu0YPeuJ992p20fSxrXWPLw-gkFA
    cvv:
      description: |
        The payment card's Card Verification Code (CVC) / Card Verification Value (CVV).
        This is generally a 3-digits number except for American Express cards which use a 4-digits number.
      type: integer
      format: int32
      minimum: 1
      maximum: 9999
      example: 123
    cryptogram:
      description: |
        The cryptogram that was returned by Strong Consumer Authentication (SCA) using 3D Secure.
        Providing a cryptogram as part of the payment authorization for a payment transaction is required to obtain liability shift
        and comply with EU's PSD2 directive.
      type: string
      format: byte
      minLength: 1
      example: eyJhY3NPcGVyYXRvcklEIjoiM2RzZWN1cmVpby1zdGFuZGluLWFjcyIsImFjc1JlZmVyZW5jZU51bWJlciI6IjNkc2VjdXJlaW8tc3RhbmRpbi1hY3MiLCJhY3NUcmFuc0lEIjoiOGIwMWE1NmEtNTZlMS00MzAyLThhNzQtNzNkNGFjYzVhOTlkIiwiYXV0aGVudGljYXRpb25WYWx1ZSI6ImtqaUp1TXkyTGJzamRWU1RQODdzMGxZOFBPcz0iLCJkc1JlZmVyZW5jZU51bWJlciI6IjNkc2VjdXJlaW8tc3RhbmRpbi1kcyIsImRzVHJhbnNJRCI6ImM2YmEwZGE3LTgyNzQtNDMyMS1iZjAwLTZkNzhkNzVmNTdlNiIsImVjaSI6IjA1IiwibWVzc2FnZVR5cGUiOiJBUmVzIiwibWVzc2FnZVZlcnNpb24iOiIyLjIuMCIsInRocmVlRFNTZXJ2ZXJUcmFuc0lEIjoiMDUzMTUwMDItZTgzYi00OGRlLTllN2ItMDM5ZThlYmJkYjUwIiwidHJhbnNTdGF0dXMiOiJZIn0=
  allOf:
    - $ref: './payment-details_v1.yaml#/PaymentDetails'

ConsumerWalletMaskedCard:
  description: |
    A representation of a masked payment card that has been saved into Transpayrent's consumer wallet when the consumer authorized the payment for a payment transaction.  
    The payment card may be of any card type, such as a MasterCard credit card or a VISA debit card.
  type: object
  required:
    - valuable_id
  properties:
    valuable_id:
      description: |
        The unique ID for the payment card in the consumer's wallet.  
        This id must be passed in the `Authorize Payment` request when authorizing the payment for a payment transaction using the payment instrument from the consumer's wallet.
      $ref: '../../common/record-entity-id/record-entity-id_v1.yaml#/RecordEntityId'
    name:
      description: |
        The consumer assigned name for the valuable in the wallet.
      type: string
      minLength: 2
      maxLength: 100
      example: SAS Eurobonus
  allOf:
    - $ref: './payment-card_v1.yaml#/MaskedPaymentCard'
  discriminator:
    propertyName: payment_method_id
    mapping:
      101: '#/ConsumerWalletMaskedCard'  # AMEX
      102: '#/ConsumerWalletMaskedCard'  # DANKORT
      103: '#/ConsumerWalletMaskedCard'  # VISA_DANKORT
      104: '#/ConsumerWalletMaskedCard'  # DINERS_CLUB
      105: '#/ConsumerWalletMaskedCard'  # DISCOVER
      106: '#/ConsumerWalletMaskedCard'  # JCB
      107: '#/ConsumerWalletMaskedCard'  # MAESTRO
      108: '#/ConsumerWalletMaskedCard'  # MASTERCARD
      109: '#/ConsumerWalletMaskedCard'  # VISA
      110: '#/ConsumerWalletMaskedCard'  # VISA_ELECTRON
      111: '#/ConsumerWalletMaskedCard'  # ELO
      112: '#/ConsumerWalletMaskedCard'  # HIPERCARD
      201: '#/ConsumerWalletMaskedCard'  # CONSUMER_WALLET

ConsumerWalletSavedCard:
  description: |
    A representation of a payment card that has been retrieved from Transpayrent's Secure Vault using a token retrieved from Transpayrent's Consumer Wallet.  
    The payment card may be of any card type, such as a MasterCard credit card or a VISA debit card.
  type: object
  required:
    - valuable_id
  properties:
    valuable_id:
      description: The unique ID for the valuable in the consumer's wallet.
      $ref: '../../common/record-entity-id/record-entity-id_v1.yaml#/RecordEntityId'
    token:
      $ref: '../payment-token/payment-token_v1.yaml#/PaymentToken'
    global_fingerprint:
      $ref: '../../common/payment-method-fingerprint/payment-method-fingerprint_v1.yaml#/PaymentMethodFingerprint'
  allOf:
    - $ref: './tokenized-payment-card_v1.yaml#/TokenizedPaymentCard'