asyncapi: 2.0.0
info:
  title: eBay Order Confirmation Notifications
  version: 1.0.0
  description: 'An ORDER_CONFIRMATION notification is sent when a buyer completes the checkout process for an auction or fixed-price item. Usually, an ORDER_CONFIRMATION notification occurs only once per listing. However, if the payment for checkout fails, the checkout status will change from "complete" to "incomplete." If the buyer then successfully pays for the item via checkout, the checkout status will change back to "complete" again. When the checkout status changes back to "complete," another ORDER_CONFIRMATION notification will be sent. An ORDER_CONFIRMATION notification is generated for each line item in the order. The seller looks up the orderId from the notification and then issues a GetOrders call (using the orderId as an input filter) to retrieve complete order information.'
channels:
  ORDER_CONFIRMATION:
    subscribe:
      message:
        $ref: '#/components/messages/message'
      bindings:
        http:
          type: request
          method: POST
          headers:
            type: object
            properties:
              Content-Type:
                type: string
                enum: ['application/json']
components:
  messages:
    message:
      headers:
        type: object
        properties:
          X-EBAY-SIGNATURE:
            description: 'The ECC message signature. This signature is used to process and validate the message payload.'
            type: string
      payload:
        type: object
        properties:
          metadata:
            $ref: '#/components/schemas/Metadata'
          notification:
            $ref: '#/components/schemas/Notification'
            
  schemas:
    Metadata:
      type: object
      properties:
        topic:
          type: string
          description: 'The notification topic to which the user or application is subscribed.'
        schemaVersion:
          type: string
          description: 'The schema version for the notification topic.'
        deprecated:
          type: boolean
          description: 'An indication regarding whether the schema version or topic is deprecated.'
          default: 'false'

    Notification:
      type: object
      properties:
        notificationId:
          type: string
          description: 'The unique identifier for the notification topic.'
        eventDate:
          type: string
          description: 'The event date associated with the notification. This date is returned as a UTC-formatted timestamp.'
        publishDate:
          type: string
          description: 'The publish date for the notification message. This date is returned as a UTC-formatted timestamp.'
        publishAttemptCount:
          type: integer
          description: 'The number of attempts that have been made to publish this notification message.'
        data:
         $ref: '#/components/schemas/OrderConfirmationData'

    OrderConfirmationData:
      type: object
      description: 'The payload for the Order Confirmation notification.'
      properties:
        order:
          type: object
          description: 'The order details for the notification subscriber.'  
          $ref: '#/components/schemas/Order' 
        

    Order:
      type: object
      description: 'The order details for the notification subscriber.'
      properties:
        orderId:
          type: string
          description: 'The unique identifier for the order.'
        orderLineItems:
          type: array
          description: 'Order line item information for the order.'
          items:
            $ref: '#/components/schemas/OrderLineItem' 

    OrderLineItem:
      type: object
      description: 'Order line item information.'
      properties:
        orderLineItemId:
          type: string
          description: 'The unique identifier for the line item.'
        listingId:
          type: string
          description: 'The unique identifier for the listing.'
        quantity:
          type: integer
          description: 'Quantity of the item.'
