> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tangoanalytics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ap-inbound-file

# Tango AP Inbound (Payment Confirmation) — File

> Generated from `Tango AP Inbound Integration Design Specification V0.8.docx` in SharePoint folder `02 Lease Integrations`.
> OAS spec: [`ap-inbound-file.yaml`](./ap-inbound-file.yaml)

## Overview

SFTP file-based inbound integration. Client drops a pipe-delimited file with AP check confirmation rows; Tango picks up the file, updates the Payments tab, and moves the file to `Processed/`.

**Owner:** Tango Analytics
**Spec version:** 0.8
**Status:** Draft (auto-generated — needs review)

## Transport

| Attribute | Value | |
| - | - | - |
| Direction | Inbound (Client → Tango) | |
| Mechanism | SFTP file drop | |
| File format | Pipe-delimited (\` | `) text, `.txt\` |
| File naming | `{ClientName}_apin_MMDDYYYYHHMMSS.txt` | |
| Production host | `sftp.tangoanalytics.com` | |
| Test host | `sftpdev.tangoanalytics.com` | |
| Path | `/inbound/ap` | |
| Auth | SFTP user/password (TBD) | |
| Frequency | TBD | |

## Integration logic

* `LEASE_PAYMENT_ID` is the unique key; must match the value Tango previously sent in the AP Outbound file.
* A payment marked `PAID` may be reverted to `VOID` by re-sending with `VOID` status.
* No update for the day → client sends no file (Tango won't error).
* Empty file or header-only → service log message: `Empty file, no records to process`.
* Multiple concurrent files are processed FIFO.

## Data fields

| Field | Type | Required | Sample | Description |
| - | - | - | - | - |
| `CLIENT_ID` | NUMBER | ✅ | `74` | Provided by Tango |
| `INVOICE_ID` | VARCHAR | – | `770501` | |
| `LEASE_PAYMENT_ID` | NUMBER | ✅ | `770567` | Unique payment identifier |
| `INVOICE_NUMBER` | VARCHAR | – | `A1234` | |
| `CHECK_DATE` | DATE `MM/DD/YYYY` | – | `11/10/2017` | |
| `CHECK_NUMBER` | VARCHAR | – | `889559` | |
| `CHECK_AMOUNT` | NUMBER | – | `76542.33` | |
| `APPLIED_AMOUNT` | NUMBER | – | `76542.33` | |
| `PAYMENT_STATUS` | VARCHAR ⚠ | ✅ | `PAID` | Doc types as NUMBER but sample is VARCHAR `PAID`/`VOID` |
| `RECONCILE_DATE` | DATE | – | `11/10/2017` | |

## Validations

| Condition | Error message |
| - | - |
| Client ID invalid/missing | `Client id is not present or invalid` |
| Lease Payment ID not present/invalid | `Lease Payment ID is not present or invalid` |
| Status not present/invalid | `Status Is not present or invalid` |
| No data in file | `Empty file, no records to process` |
| Header-only | `Empty file, no records to process` |
| Data with no header | `No header present, file cannot be processed` |

## Open Questions / Assumptions

* [ ] **`PAYMENT_STATUS` typed as NUMBER in mapping** but sample is `PAID` (a string). Schema uses string with enum `PAID` / `VOID`; confirm.
* [ ] **SFTP credentials** are `<TBD>`.
* [ ] **Timing/frequency** is `<TBD>`.
* [ ] **Email notification recipient** is `<email id>` placeholder.

## Changelog

| Ver | Date | Description | Author |
| - | - | - | - |
| 0.1 | — | Initial Draft | Alpna Bansal |
| 0.2 | — | Updated Data Mappings | Alpna Bansal |
| 0.3 | 05/19/2020 | Lease Payment ID; VOID payment logic | Alpna Bansal |
| 0.4 | 07/30/2020 | Updated mandatory fields | Alpna Bansal |
| 0.5 | 09/20/2021 | Inbound file structure & Data Mapping | Alpna Bansal |
| 0.6 | 06/15/2022 | Error Handling & Appendix | Olivia Aneye |
| 0.7 | 09/13/2022 | Updated formatting | Jasmin Thasleem |
| 0.8 | 09/19/2023 | Reformatted | Jasmin Thasleem |
