openapi: 3.1.0
info:
  title: Tango AP Inbound (Payment Confirmation) — File
  version: "0.8"
  description: |
    SFTP file-based inbound: client drops a pipe-delimited file of AP check
    confirmations to Tango's SFTP server. Tango picks up the file, updates the
    Payments tab, and moves the source file to Processed/. Lease Payment ID
    must match the value Tango previously sent in the AP Outbound file.
  x-direction: inbound
  x-source: Client System
  x-destination: Tango
  x-transport: sftp
  x-file-format: pipe-delimited text (.txt)
  x-file-naming-convention: "{ClientName}_apin_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: /inbound/ap
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: /inbound/ap
tags:
  - name: AP Inbound File
paths:
  /inbound/ap:
    post:
      summary: Drop AP payment confirmation file at SFTP path
      description: |
        Virtual operation. Tango picks up the file, processes each row, updates
        payment statuses, then moves the file to /inbound/ap/Processed/<timestamp>.
        Multiple files queued at once are processed FIFO.
      operationId: deliverAPInboundFile
      tags: [AP Inbound File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/APInboundRow"
      responses:
        "200":
          description: File received and queued for processing.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
      description: SFTP user/password — values <TBD> in source.
  schemas:
    APInboundRow:
      type: object
      description: One pipe-delimited row from the AP Inbound file.
      required:
        - CLIENT_ID
        - LEASE_PAYMENT_ID
        - PAYMENT_STATUS
      properties:
        CLIENT_ID:
          type: number
          description: Tango-provided client identifier.
          example: 74
        INVOICE_ID:
          type: string
          example: "770501"
        LEASE_PAYMENT_ID:
          type: number
          description: Unique payment identifier (must match the AP Outbound file).
          example: 770567
        INVOICE_NUMBER:
          type: string
        CHECK_DATE:
          type: string
          description: "MM/DD/YYYY."
          example: "11/10/2017"
        CHECK_NUMBER:
          type: string
        CHECK_AMOUNT:
          type: number
          example: 76542.33
        APPLIED_AMOUNT:
          type: number
        PAYMENT_STATUS:
          type: string
          description: "Sample shows `PAID`. Doc lists `PAID` / `VOID` as the valid set."
          enum: [PAID, VOID]
        RECONCILE_DATE:
          type: string
          description: "MM/DD/YYYY."
security:
  - sftpUserPassword: []
