openapi: 3.1.0
info:
  title: Tango AP Outbound — File
  version: "1.6"
  description: |
    SFTP file-based outbound. Tango writes approved lease payments as a
    pipe-delimited file to its SFTP server; client reads and processes the
    file. After successful generation, payments are marked `Exported to AP`.
    LEASE_PAYMENT_ID round-trips back through the AP Inbound file for
    reconciliation.
  x-direction: outbound
  x-source: Tango
  x-destination: Client System
  x-transport: sftp
  x-file-format: pipe-delimited text (.txt)
  x-file-naming-convention: "{ClientCode}_apout_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: /outbound/ap
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: /outbound/ap
tags:
  - name: AP Outbound File
paths:
  /outbound/ap:
    post:
      summary: Drop approved AP file at SFTP path
      operationId: deliverAPOutboundFile
      tags: [AP Outbound File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/APOutboundRow"
      responses:
        "200":
          description: File delivered.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
  schemas:
    APOutboundRow:
      type: object
      description: One pipe-delimited row from the AP Outbound file.
      required:
        - LEASE_NUMBER
        - LEASE_STATUS
        - TERM_STATUS
        - VENDOR_NUMBER
        - PAYMENT_TYPE
        - EFFECTIVE_DATE
        - APPLIES_FROM_DATE
        - TO_DATE
        - DUE_DATE
        - LEASE_PAYMENT_ID
      properties:
        LEASE_NUMBER: { type: string }
        LEASE_STATUS: { type: string, description: "e.g., Active, Draft." }
        TERM_STATUS: { type: string }
        LOCATION_NUMBER: { type: string }
        VENDOR_NUMBER: { type: string }
        INVOICE_DESC: { type: string, description: "Category, e.g., Rent." }
        PAYMENT_TYPE: { type: string, description: "e.g., CAM, Base Rent, Insurance." }
        EFFECTIVE_DATE: { type: string, description: "MM/DD/YYYY." }
        APPLIES_FROM_DATE: { type: string, description: "MM/DD/YYYY." }
        TO_DATE: { type: string, description: "MM/DD/YYYY." }
        DUE_DATE: { type: string, description: "MM/DD/YYYY." }
        CREATION_DATE: { type: string, description: "MM/DD/YYYY." }
        GROSS_AMOUNT: { type: number, description: "Net amount plus tax." }
        TAX_AMOUNT1: { type: number }
        TAX_AMOUNT2: { type: number }
        TAX_AMOUNT: { type: number }
        NET_AMOUNT: { type: number, description: "Gross minus taxes." }
        PAYMENT_STATUS: { type: string }
        TAX_RATE: { type: string, example: "AZ-Maricopa(1.75%)" }
        CURRENCY: { type: string }
        PAYMENT_CURRENCY:
          type: string
          description: |
            If PAYMENT_CURRENCY is null, the file emits whatever is in CURRENCY.
            Else uses PAYMENT_CURRENCY's value.
        CONSUMPTION: { type: string }
        CONSUMPTION_UOM: { type: string }
        ACCOUNTING_STRING: { type: string }
        GL_ACCOUNT: { type: string }
        INVOICE_NUMBER: { type: string }
        INVOICE_DATE: { type: string, description: "MM/DD/YYYY." }
        INVOICE_ID: { type: string }
        LEASE_PAYMENT_ID:
          type: number
          description: Unique payment identifier; reconciliation key for AP Inbound.
        REMIT_MESSAGE: { type: string }
        SEGMENT1: { type: string }
        SEGMENT2: { type: string }
        SEGMENT3: { type: string }
        SEGMENT4: { type: string }
        SEGMENT5: { type: string }
        SEGMENT6: { type: string }
        SEGMENT1_GL: { type: string }
        SEGMENT2_GL: { type: string }
        SEGMENT3_GL: { type: string }
        SEGMENT4_GL: { type: string }
        SEGMENT5_GL: { type: string }
        SEGMENT6_GL: { type: string }
        EXTATTRIBUTE1: { type: string }
        EXTATTRIBUTE2: { type: string }
        EXTATTRIBUTE3: { type: string }
        EXTATTRIBUTE4: { type: string }
        EXTATTRIBUTE5: { type: string }
        EXTATTRIBUTE6: { type: string }
        EXTATTRIBUTE7: { type: string }
        EXTATTRIBUTE8: { type: string }
        EXTATTRIBUTE9: { type: string }
        EXTATTRIBUTE10: { type: string }
security:
  - sftpUserPassword: []
