AuthorizePaymentRequest:
  description: A representation of the payment details provided by the consumer to authorize the payment of a payment transaction
  type: object
  required:
    - payment_details
  properties:
    contact:
      description: The consumer's contact details such as email address, mobile phone etc.
      $ref: '../../common/contact-details/contact-details_v1.yaml#/ContactDetails'
    national_identification_number:
      $ref: '../../common/national-identification-number/national-identification-number_v1.yaml#/NationalIdentificationNumber'
    installments:
      $ref: '../../common/installments/installments_v1.yaml#/Installments'
    payment_details:
      oneOf:
        - $ref: '../../common/payment-details/payment-card_v1.yaml#/PaymentCard'
        - $ref: '../../common/payment-details/saved-payment-card_v1.yaml#/SavedCardPayment'
        - $ref: '../../common/payment-details/consumer-wallet_v1.yaml#/ConsumerWalletPayment'
        - $ref: '../../common/payment-details/mobilepay-online_v1.yaml#/MobilePayOnlinePayment'
        - $ref: '../../common/payment-details/google-pay_v1.yaml#/GooglePayPayment'
        - $ref: '../../common/payment-details/apple-pay_v1.yaml#/ApplePayPayment'
        - $ref: '../../common/payment-details/click-to-pay_v1.yaml#/ClickToPayPayment'
        - $ref: '../../common/payment-details/payment-details_v1.yaml#/PaymentDetails'
      discriminator:
        propertyName: payment_method_id
        mapping:
          100: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # PAYMENT_CARD
          101: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # AMEX
          102: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # DANKORT
          103: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # VISA_DANKORT
          104: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # DINERS_CLUB
          105: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # DISCOVER
          106: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # JCB
          107: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # MAESTRO
          108: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # MASTERCARD
          109: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # VISA
          110: '../../model/common/payment-details/payment-card_v1.yaml#/PaymentCard'  # VISA_ELECTRON
          200: '../../model/common/payment-details/saved-payment-card_v1.yaml#/SavedCardPayment'
          201: '../../model/common/payment-details/consumer-wallet_v1.yaml#/ConsumerWalletPayment'
          202: '../../model/common/payment-details/mobilepay-online_v1.yaml#/MobilePayOnlinePayment'
          203: '../../model/common/payment-details/google-pay_v1.yaml#/GooglePayPayment'
          204: '../../model/common/payment-details/apple-pay_v1.yaml#/ApplePayPayment'
          205: '../../model/common/payment-details/click-to-pay_v1.yaml#/ClickToPayPayment'
          301: '../../model/common/payment-details/payment-details_v1.yaml#/PaymentDetails' # PIX
          400: '../../model/common/payment-details/payment-details_v1.yaml#/PaymentDetails' # PAYMENT_TERMINAL

AuthorizePaymentResponse:
  description: A representation of the details for the successful authorization of a payment transaction
  type: object
  required:
    - transaction_id
    - status_code
  properties:
    transaction_id:
      description: The payment gateway's unique ID for the payment transaction for which the payment was successfully authorized
      $ref: '../../common/record-entity-id/record-entity-id_v1.yaml#/RecordEntityId'
      example: 123456
    status_code:
      description: The payment status code for the authorization of the payment transaction
      $ref: '../../common/status-message/status-code_v1.yaml#/STATUS_CODE'
      example: 620021
    payment_method_id:
      description: The unique id for the payment method that the consumer selected to create the payment transaction
      $ref: '../../payment-gateway/payment-method/payment-method-id_v1.yaml#/PAYMENT_METHOD_ID'
      example: 201
    payment_instrument_id:
      description: |
        The unique id for the payment instrument that was used to authorize the payment for the payment transaction.  
        The value will be the same as `payment_method_id` for most payment methods except for wallets where it will reflect the payment method selected from Transpayrent's Secure Vault or a 3rd Party Consumer Wallet when authorizing the payment.
      $ref: '../../payment-gateway/payment-method/payment-method-id_v1.yaml#/PAYMENT_METHOD_ID'
      example: 103
    trace_id:
      description: |
        The Trace ID returned by by the card scheme (VISA / MasterCard) for a payment with a stored card.  
        * For MasterCard the id is the concatenation of values Data element 63 subfield 1 (Financial Network Code) (position 1-3), Data element 63 subfield 2 (Banknet Reference Number) (position 4-9), Data element 15 (Date, Settlement, in MMDD format) (position 10-13), and two spaces; to be used in Data Element 48, Subfield 63.  
        * For VISA the id is from Field 62.2 of the first-in-series or previous-in-series authorization; to be used in Field 125, Usage 2, Dataset ID 03.  
        Please note that this is an optional field that will only be populated for the select acquirers that returns the `trace id` from the card schemes.
      type: string
      minLength: 15
      maxLength: 15
      example: 485008455782860