openapi: 3.1.0
info:
  title: Tango AR Inbound (Cash Receipts) — File
  version: "0.7"
  description: |
    SFTP file-based inbound. Client drops a pipe-delimited file of cash receipts
    to Tango's SFTP server. Tango picks up the file, updates billing status, and
    moves the file to Processed/. LEASE_BILLING_ID must already exist in Tango
    (it's the same ID Tango sent in AR Outbound).
  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}_arin_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: inbound/ar/
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: inbound/ar/
tags:
  - name: AR Inbound File
paths:
  /inbound/ar:
    post:
      summary: Drop AR cash receipts file at SFTP path
      operationId: deliverARInboundFile
      tags: [AR Inbound File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/ARInboundRow"
      responses:
        "200":
          description: File received and queued.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
  schemas:
    ARInboundRow:
      type: object
      required:
        - CLIENT_ID
        - LEASE_BILLING_ID
        - CHECK_DATE
        - CHECK_NUMBER
        - CHECK_AMOUNT
        - APPLIED_AMOUNT
        - CHARGE_STATUS
      properties:
        CLIENT_ID:
          type: number
          description: Tango-provided client identifier.
          example: 74
        INVOICE_ID:
          type: string
          example: "770501"
        LEASE_BILLING_ID:
          type: number
          description: Unique billing identifier; must match the AR Outbound file.
          example: 770567
        INVOICE_NUMBER:
          type: string
        CHECK_DATE:
          type: string
          description: "MM/DD/YYYY."
          example: "11/10/2017"
        CHECK_NUMBER:
          type: string
          example: "889559"
        CHECK_AMOUNT:
          type: number
          example: 76542.33
        APPLIED_AMOUNT:
          type: number
          example: 76542.33
        CHARGE_STATUS:
          type: string
          description: Allowed `PAID` / `VOID` (per validation).
          enum: [PAID, VOID]
security:
  - sftpUserPassword: []
