# OCRVA Project

## About This Project

This PHP project handles order file processing and SFTP transfers securely.  

---

## `send-ocrva-order-to-priority.php`

- Scans the local `ocrva/Incomingorders/` directory for `.txt` order files.
- Uploads unique `.txt` order files to the SFTP server.
- SFTP server: `files.us.priority-connect.online`
- SFTP username: `PE61D`
- Prevents duplicate uploads by comparing file content.
- Organizes files into:
  - `completed/` → successfully uploaded files.
  - `duplicated/` → detected duplicates.
- **Cron Schedule:** `* * * * *` (runs every minute)
---

## `place-ocrva-order-to-priority.php`
This PHP script automates the processing of incoming OCRVA orders by interacting with the Orthofeet API. It also manages retries and file categorization.
- Scans the local `ocrva/Incomingorders/` directory for `.txt` order files.
- place order into **Orthofeet** by using API.
- Moves each file based on result:
  - **Success**         → moved to `completed/`
  - **Failure**         → moved to `pending/` for retry- start try again order to place after one hour to 3 hour.
  - **Incomplete Data** → moved to `failed/`
- Retries pending files between **1 and 3 hours** from creation.
- If an order file remains unprocessed for more than 3 hours after its creation, and the order has not been placed successfully, mark the order as failed and trigger an email notification.
- **Cron Schedule:** `* * * * *` (runs at every minute)
