openapi: 3.1.0
info:
  title: Tango AR Outbound — File
  version: "1.1"
  description: |
    SFTP file-based outbound. Tango writes approved receivables (billings) as a
    pipe-delimited file to its SFTP server; client reads and processes. After
    export, billings flagged `Exported to AR`. LEASE_BILLING_ID round-trips
    through AR Inbound 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: "{ClientName}_arout_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: outbound/ar/
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: outbound/ar/
tags:
  - name: AR Outbound File
paths:
  /outbound/ar:
    post:
      summary: Drop approved AR file at SFTP path
      operationId: deliverAROutboundFile
      tags: [AR Outbound File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/AROutboundRow"
      responses:
        "200":
          description: File delivered.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
  schemas:
    AROutboundRow:
      type: object
      description: One pipe-delimited row from the AR Outbound file.
      required:
        - LEASE_NUMBER
        - LEASE_STATUS
        - TERM_STATUS
        - PAYMENT_TYPE
        - EFFECTIVE_DATE
        - APPLIES_FROM_DATE
        - TO_DATE
        - DUE_DATE
        - GROSS_AMOUNT
        - LEASE_BILLING_ID
      properties:
        LEASE_NUMBER: { type: string }
        LEASE_STATUS: { type: string }
        TERM_STATUS: { type: string }
        LOCATION_NUMBER: { type: string }
        LEGAL_ENTITY: { type: string }
        CUSTOMER_NUMBER:
          type: string
          description: Supplier site number assigned to the customer.
        INVOICE_DESC: { type: string }
        PAYMENT_TYPE: { type: string }
        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." }
        GROSS_AMOUNT: { type: number }
        TAX_AMOUNT1: { type: number }
        TAX_AMOUNT2: { type: number }
        TAX_AMOUNT: { type: number }
        NET_AMOUNT: { type: number }
        CHARGE_STATUS: { type: string, description: "Billing status." }
        TAX_RATE: { type: number }
        CURRENCY: { type: string }
        PAYMENT_CURRENCY: { 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_BILLING_ID:
          type: number
          description: Unique billing identifier; reconciliation key for AR 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 }
security:
  - sftpUserPassword: []
