Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

The hotel industry runs on closed-source, legacy PMS platforms that charge per-room fees, lock data behind proprietary APIs, and treat integrations as an afterthought. Hotels pay $5–15/room/month just for the privilege of managing their own operations.

HAIP is a **complete, production-grade hotel Property Management System** built from scratch with modern architecture. Reservation lifecycle, folio & billing, rate plans, housekeeping with digital checklists, night audit, groups & commercial (allotment + rooming lists), accounting & cashiering (A/R, deposits, cash drawers, GL codes), channel distribution to 450+ OTAs, a **full commission-free direct booking engine** (guest-facing widget + public booking API) so hotels take reservations straight from their own website, **pluggable payment gateways** (Stripe and other PSPs), Keycloak authentication, local user & role administration, media management for property and room photos, tax calculation, fiscal invoicing & guest-registration providers, an **integration registry** for adapters and providers, door-lock credential hooks, revenue management — and **12 built-in AI agents** that orchestrate revenue strategy, optimize pricing, predict cancellations, detect audit anomalies, prioritize receivables collections, forecast group pickup, schedule housekeeping, automate guest communications, and draft review responses. It even ships a **ChatGPT gateway** so guests can search and book a room by chatting. Dashboard locales include English, German, and Portuguese (BR). All open source under Apache 2.0.
HAIP is a **complete, production-grade hotel Property Management System** built from scratch with modern architecture. Reservation lifecycle, folio & billing, rate plans, housekeeping with digital checklists, night audit, groups & commercial (allotment + rooming lists), accounting & cashiering (A/R, deposits, cash drawers, GL codes), channel distribution to 450+ OTAs, a **full commission-free direct booking engine** (guest-facing widget + public booking API) so hotels take reservations straight from their own website, **pluggable payment gateways** (Stripe and other PSPs), Keycloak authentication, local user & role administration, media management for property and room photos, tax calculation, fiscal invoicing & guest-registration providers, an **integration registry** for adapters and providers, door-lock credential hooks, revenue management — and **12 built-in AI agents** that orchestrate revenue strategy, optimize pricing, predict cancellations, detect audit anomalies, prioritize receivables collections, forecast group pickup, schedule housekeeping, automate guest communications, and draft review responses. External AI assistants book through the **Connect API**. Dashboard locales include English, German, and Portuguese (BR). All open source under Apache 2.0.

What makes HAIP different is that **AI agents are built into the architecture from day one** — not as a bolt-on, but as first-class citizens with their own lifecycle, decision logging, and per-property calibration (deterministic engines that learn each hotel's own rates from its history — not LLMs pretending to be agents). HAIP is the sister project to [OTAIP](https://github.com/telivity-otaip/otaip) (Open Travel AI Platform). Together they form **Telivity's open-source travel infrastructure**. OTAIP agents connect to HAIP via the Connect API — the PMS works without AI, but the AI makes it extraordinary.

Expand All @@ -58,7 +58,6 @@ graph TB
subgraph Clients
Dashboard["React Dashboard<br/>(Vite + TanStack Query)"]
BookingWidget["Booking Widget<br/>(Direct Booking Engine)"]
ChatGPT["ChatGPT Gateway<br/>(Connect GPT Actions)"]
OTAIP["OTAIP Agents<br/>(Hotel Search · Rate Compare · Booking)"]
ThirdParty["Third-Party Systems<br/>(Webhooks · Adapters)"]
end
Expand Down Expand Up @@ -121,7 +120,6 @@ graph TB
Dashboard -->|HTTP + WebSocket| REST
Dashboard -->|Real-time| WS
BookingWidget -->|HTTP| BookingEngine
ChatGPT -->|REST| Connect
OTAIP -->|REST| Connect
ThirdParty -->|REST| REST
ThirdParty -->|REST| Integrations
Expand Down Expand Up @@ -464,13 +462,6 @@ Operator notes for activating existing adapters, metasearch landings on the dire
- HMAC-signed deliveries with retries; permanent failures raise a critical staff notification
- See **[`docs/webhooks.md`](./docs/webhooks.md)** for the integration guide (signature verification, payload conventions, fiscal documents, regional compliance examples)

### ChatGPT Gateway (Connect GPT)
- A standalone, deployable **gateway that exposes HAIP hotel search & booking as a ChatGPT Custom GPT Action** (`tools/haip-connect-gpt`) — guests search availability and create/modify/cancel reservations by chatting
- A thin, typed client over HAIP's existing **Connect API** (`/api/v1/connect/*`) — no hotel logic is reimplemented; it builds a ChatGPT-importable **OpenAPI 3.1** spec for 6 operations (`searchHotels`, `getProperty`, `create`/`get`/`modify`/`cancelReservation`)
- **Secure by design** — the gateway injects HAIP's API key server-side (the GPT never sees it), and response guards ensure **only selling prices** reach the model (net/wholesale/cost stripped)
- **PII-scrubbed tool-call logging** for training, with an optional Supabase/Postgres sink
- Host-agnostic — ships as a **Vercel** serverless function, a plain Node server, or a Docker container

### Admin Dashboard
- React SPA including Dashboard, Front Desk, Reservations, Guests, Rooms, Housekeeping, Folios, Groups, **Commercial**, Cashier, House Accounts, Accounting, Tax, Rate Plans, Night Audit, Reports, Channel Manager, Revenue Management, Communications, Reviews, Settings
- Revenue Management page: KPI cards, pending AI recommendations with approve/reject, agent performance metrics, per-agent configuration
Expand Down Expand Up @@ -752,8 +743,7 @@ haip/
│ │ └── src/schema/ # Table files (property, room, guest, agent, etc.)
│ ├── shared/ # Shared types, enums, webhook events
│ └── booking-requests/ # Optional request-first booking (flag-gated)
├── tools/
│ └── haip-connect-gpt/ # ChatGPT Custom GPT gateway over the Connect API (Vercel)
├── tools/ # Repo-control and operator tooling
├── docker-compose.yml # PostgreSQL + Redis + Keycloak + API
├── CLAUDE.md # AI agent constitution
└── .env.example # Environment template
Expand Down Expand Up @@ -1096,9 +1086,7 @@ OTAIP's `packages/connect` will have a HAIP adapter (like `AmadeusAdapter`, `Duf
OTAIP Agent → ConnectAdapter (HAIP) → Connect API → HAIP PMS → PostgreSQL
```

The PMS is the product. OTAIP agents are the intelligence on top.

> **ChatGPT too** — `tools/haip-connect-gpt` wraps this same Connect API as a ChatGPT Custom GPT Action (OpenAPI 3.1, server-side key injection, selling-price-only responses), so a guest can search and book straight from ChatGPT. See [`tools/haip-connect-gpt/README.md`](./tools/haip-connect-gpt/README.md).
The PMS is the product. OTAIP agents are the intelligence on top. External platforms (assistants, aggregators) use the same Connect API with a scoped API key — see [`docs/connect-external-booking.md`](./docs/connect-external-booking.md).

---

Expand Down
4 changes: 3 additions & 1 deletion apps/api/src/modules/connect/connect-booking.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export class ConnectBookingService {
// the confirmation number is itself a bearer credential for the booking.
const confirmationNumber = `HAIP-${generateConfirmationToken()}`;

const channelCode = dto.agentId ?? (hosted ? 'LIGARE' : 'otaip');
// Prefer explicit agentId from the client (external gateways send their own
// channel codes). Neutral default for hosted checkout when omitted.
const channelCode = dto.agentId ?? (hosted ? 'connect' : 'otaip');
const externalRef = dto.externalReference
?? (dto.clientPlatform ? `${dto.clientPlatform}:${confirmationNumber}` : undefined);

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/modules/connect/connect.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class ConnectController {
}

@Get('bookings/:confirmationNumber/payment-status')
@ApiOperation({ summary: 'Payment status for hosted Connect / Ligare bookings (PSP-reconciled)' })
@ApiOperation({ summary: 'Payment status for hosted Connect bookings (PSP-reconciled)' })
async paymentStatus(@Param('confirmationNumber') confirmationNumber: string) {
return this.paymentService.getPaymentStatus(confirmationNumber);
}
Expand Down
14 changes: 9 additions & 5 deletions apps/api/src/modules/connect/dto/agent-book.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@ export class AgentBookDto {
@IsOptional()
idempotencyKey?: string;

/** chatgpt | claude | gemini — stored for attribution UI */
@ApiPropertyOptional({ enum: ['chatgpt', 'claude', 'gemini', 'ligare'] })
/** Free-text client/platform tag for attribution (no fixed product enum). */
@ApiPropertyOptional({
description: 'Client platform identifier (free-text; e.g. assistant or integrator name)',
})
@IsOptional()
@IsIn(['chatgpt', 'claude', 'gemini', 'ligare'])
clientPlatform?: 'chatgpt' | 'claude' | 'gemini' | 'ligare';
@IsString()
clientPlatform?: string;

// Agent metadata
@ApiPropertyOptional({ description: 'Agent / channel id (use LIGARE for Ligare Hotels)' })
@ApiPropertyOptional({
description: 'Agent / channel id written to booking.channelCode when provided',
})
@IsOptional()
@IsString()
agentId?: string;
Expand Down
65 changes: 65 additions & 0 deletions docs/connect-external-booking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Connect API — external booking platforms

HAIP’s Connect module lets external platforms (AI assistants, aggregators, partner apps) search and book inventory with a **scoped API key**. This document covers the booking surface only. Pricing and commercial terms for any particular distribution product are out of scope here.

## Auth

Send the platform key on every request:

```http
x-api-key: <CONNECT_API_KEY>
```

Keys are validated by `ApiKeyGuard` and scoped by `ConnectScopeGuard`. Do not embed property admin JWTs in client platforms.

Base path: `/api/v1/connect`.

## Book

```http
POST /api/v1/connect/book
Content-Type: application/json
x-api-key: <CONNECT_API_KEY>
```

Body (selected fields):

| Field | Notes |
|-------|--------|
| `propertyId`, `roomTypeId`, `ratePlanId` | UUIDs |
| `checkIn`, `checkOut` | ISO dates |
| `guestFirstName`, `guestLastName` | Required |
| `guestEmail` | Required for `hosted_checkout` |
| `adults`, `children` | Occupancy |
| `paymentMethod` | `pay_at_property` \| `hosted_checkout` (preferred for assistants); `prepaid` / `virtual_card` accepted for compatibility |
| `idempotencyKey` | Required for `hosted_checkout` |
| `clientPlatform` | Optional free-text attribution tag |
| `agentId` | Optional channel code written to the booking when provided |
| `externalReference` | Optional partner reference |

Hosted checkout returns a payment session / redirect URL; complete payment via the payment-status / confirm-payment (or PSP webhook) flow before the stay is fully confirmed.

## Verify

```http
GET /api/v1/connect/bookings/:confirmationNumber/verify
x-api-key: <CONNECT_API_KEY>
```

Returns booking status and guest-safe details for the confirmation number. Possession of the confirmation number plus a valid API key is the access model.

## Cancel

```http
DELETE /api/v1/connect/bookings/:confirmationNumber
Content-Type: application/json
x-api-key: <CONNECT_API_KEY>
```

Optional JSON body may include a `reason`. Penalties follow the property’s cancellation policy.

## Related

- Modify: `PATCH /api/v1/connect/bookings/:confirmationNumber`
- Hosted payment helpers: `…/payment-status`, `…/confirm-payment`, `…/mock-pay` (non-production), `…/payment-return`
- OpenAPI: served by the Nest API Swagger UI at `/docs`
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Connect LLM / agent hosted payment sessions (Ligare Hotels).
-- Connect LLM / agent hosted payment sessions.
-- Tracks pending → paid/failed/expired with idempotency and PSP event dedupe.

CREATE TABLE IF NOT EXISTS connect_payment_sessions (
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/schema/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const connectCredentials = pgTable('connect_credentials', {
revokedAt: timestamp('revoked_at', { withTimezone: true }),
});

/** Hosted payment session for Connect / Ligare LLM bookings. */
/** Hosted payment session for Connect agent / LLM bookings. */
export type ConnectPaymentMode = 'charge' | 'authorize' | 'guarantee';
export type ConnectPaymentSessionStatus =
| 'pending'
Expand Down
25 changes: 0 additions & 25 deletions tools/haip-connect-gpt/.env.example

This file was deleted.

6 changes: 0 additions & 6 deletions tools/haip-connect-gpt/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions tools/haip-connect-gpt/CHATGPT-GPT.md

This file was deleted.

17 changes: 0 additions & 17 deletions tools/haip-connect-gpt/Dockerfile

This file was deleted.

93 changes: 0 additions & 93 deletions tools/haip-connect-gpt/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions tools/haip-connect-gpt/api/index.ts

This file was deleted.

Loading
Loading