@atzentis/booking-sdk 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +349 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +695 -1
- package/dist/index.d.ts +695 -1
- package/dist/index.js +346 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1197,6 +1197,447 @@ declare class CategoriesService extends BaseService {
|
|
|
1197
1197
|
delete(categoryId: string): Promise<void>;
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
+
/** Supported distribution channel types */
|
|
1201
|
+
type ChannelType = "channex" | "ical" | "direct";
|
|
1202
|
+
/** Channel connection status */
|
|
1203
|
+
type ChannelStatus = "active" | "inactive" | "error" | "pending";
|
|
1204
|
+
/** Credentials for channel authentication (redacted in responses) */
|
|
1205
|
+
type ChannelCredentials = Record<string, unknown>;
|
|
1206
|
+
/** Channel sync configuration */
|
|
1207
|
+
interface ChannelSettings {
|
|
1208
|
+
autoSync?: boolean;
|
|
1209
|
+
syncInterval?: number;
|
|
1210
|
+
pushAvailability?: boolean;
|
|
1211
|
+
pushRates?: boolean;
|
|
1212
|
+
pullReservations?: boolean;
|
|
1213
|
+
}
|
|
1214
|
+
/** A distribution channel connection */
|
|
1215
|
+
interface Channel {
|
|
1216
|
+
id: string;
|
|
1217
|
+
propertyId: string;
|
|
1218
|
+
type: ChannelType;
|
|
1219
|
+
name: string;
|
|
1220
|
+
status: ChannelStatus;
|
|
1221
|
+
enabled: boolean;
|
|
1222
|
+
credentials: ChannelCredentials;
|
|
1223
|
+
settings: ChannelSettings;
|
|
1224
|
+
lastSyncAt: string | null;
|
|
1225
|
+
metadata: Record<string, unknown> | null;
|
|
1226
|
+
createdAt: string;
|
|
1227
|
+
updatedAt: string;
|
|
1228
|
+
}
|
|
1229
|
+
/** Input for creating a new channel */
|
|
1230
|
+
interface CreateChannelInput {
|
|
1231
|
+
propertyId: string;
|
|
1232
|
+
type: ChannelType;
|
|
1233
|
+
name?: string;
|
|
1234
|
+
enabled?: boolean;
|
|
1235
|
+
credentials?: ChannelCredentials;
|
|
1236
|
+
settings?: ChannelSettings;
|
|
1237
|
+
metadata?: Record<string, unknown>;
|
|
1238
|
+
}
|
|
1239
|
+
/** Input for updating an existing channel */
|
|
1240
|
+
interface UpdateChannelInput {
|
|
1241
|
+
name?: string;
|
|
1242
|
+
enabled?: boolean;
|
|
1243
|
+
credentials?: ChannelCredentials;
|
|
1244
|
+
settings?: ChannelSettings;
|
|
1245
|
+
metadata?: Record<string, unknown>;
|
|
1246
|
+
}
|
|
1247
|
+
/** Parameters for listing channels */
|
|
1248
|
+
interface ListChannelsParams {
|
|
1249
|
+
propertyId?: string;
|
|
1250
|
+
type?: ChannelType;
|
|
1251
|
+
status?: ChannelStatus;
|
|
1252
|
+
enabled?: boolean;
|
|
1253
|
+
limit?: number;
|
|
1254
|
+
cursor?: string;
|
|
1255
|
+
}
|
|
1256
|
+
/** Paginated list of channels */
|
|
1257
|
+
type PaginatedChannels = Paginated<Channel>;
|
|
1258
|
+
/** Mapping between local category and OTA room type/rate plan */
|
|
1259
|
+
interface ChannelMapping {
|
|
1260
|
+
id: string;
|
|
1261
|
+
channelId: string;
|
|
1262
|
+
localCategoryId: string;
|
|
1263
|
+
channelRoomTypeId: string | null;
|
|
1264
|
+
channelRatePlanId: string | null;
|
|
1265
|
+
settings: Record<string, unknown> | null;
|
|
1266
|
+
metadata: Record<string, unknown> | null;
|
|
1267
|
+
createdAt: string;
|
|
1268
|
+
}
|
|
1269
|
+
/** Input for creating a channel mapping */
|
|
1270
|
+
interface CreateMappingInput {
|
|
1271
|
+
localCategoryId: string;
|
|
1272
|
+
channelRoomTypeId?: string;
|
|
1273
|
+
channelRatePlanId?: string;
|
|
1274
|
+
settings?: Record<string, unknown>;
|
|
1275
|
+
metadata?: Record<string, unknown>;
|
|
1276
|
+
}
|
|
1277
|
+
/** Parameters for listing mappings */
|
|
1278
|
+
interface ListMappingsParams {
|
|
1279
|
+
localCategoryId?: string;
|
|
1280
|
+
limit?: number;
|
|
1281
|
+
cursor?: string;
|
|
1282
|
+
}
|
|
1283
|
+
/** Paginated list of channel mappings */
|
|
1284
|
+
type PaginatedMappings = Paginated<ChannelMapping>;
|
|
1285
|
+
/** Type of sync operation */
|
|
1286
|
+
type SyncOperationType = "push" | "pull";
|
|
1287
|
+
/** Status of a sync operation */
|
|
1288
|
+
type SyncOperationStatus = "pending" | "running" | "completed" | "failed";
|
|
1289
|
+
/** Statistics from a sync operation */
|
|
1290
|
+
interface SyncStats {
|
|
1291
|
+
itemsSynced: number;
|
|
1292
|
+
itemsFailed: number;
|
|
1293
|
+
warnings: string[];
|
|
1294
|
+
}
|
|
1295
|
+
/** Error encountered during sync */
|
|
1296
|
+
interface SyncError {
|
|
1297
|
+
code: string;
|
|
1298
|
+
message: string;
|
|
1299
|
+
details: Record<string, unknown> | null;
|
|
1300
|
+
}
|
|
1301
|
+
/** A sync operation record */
|
|
1302
|
+
interface SyncOperation {
|
|
1303
|
+
id: string;
|
|
1304
|
+
channelId: string;
|
|
1305
|
+
type: SyncOperationType;
|
|
1306
|
+
status: SyncOperationStatus;
|
|
1307
|
+
startedAt: string | null;
|
|
1308
|
+
completedAt: string | null;
|
|
1309
|
+
stats: SyncStats | null;
|
|
1310
|
+
errors: SyncError[];
|
|
1311
|
+
createdAt: string;
|
|
1312
|
+
}
|
|
1313
|
+
/** Input for push sync */
|
|
1314
|
+
interface PushSyncInput {
|
|
1315
|
+
dateFrom?: string;
|
|
1316
|
+
dateTo?: string;
|
|
1317
|
+
fullSync?: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
/** Input for pull sync */
|
|
1320
|
+
interface PullSyncInput {
|
|
1321
|
+
dateFrom?: string;
|
|
1322
|
+
dateTo?: string;
|
|
1323
|
+
}
|
|
1324
|
+
/** Parameters for querying sync log */
|
|
1325
|
+
interface SyncLogParams {
|
|
1326
|
+
type?: SyncOperationType;
|
|
1327
|
+
status?: SyncOperationStatus;
|
|
1328
|
+
from?: string;
|
|
1329
|
+
to?: string;
|
|
1330
|
+
limit?: number;
|
|
1331
|
+
cursor?: string;
|
|
1332
|
+
}
|
|
1333
|
+
/** Paginated sync operation log */
|
|
1334
|
+
type PaginatedSyncLog = Paginated<SyncOperation>;
|
|
1335
|
+
/** Input for iCal import */
|
|
1336
|
+
interface ICalImportInput {
|
|
1337
|
+
spaceId: string;
|
|
1338
|
+
importUrl: string;
|
|
1339
|
+
name?: string;
|
|
1340
|
+
autoSync?: boolean;
|
|
1341
|
+
}
|
|
1342
|
+
/** Result of an iCal import operation */
|
|
1343
|
+
interface ICalImportResult {
|
|
1344
|
+
id: string;
|
|
1345
|
+
spaceId: string;
|
|
1346
|
+
importUrl: string;
|
|
1347
|
+
eventsImported: number;
|
|
1348
|
+
lastImportedAt: string | null;
|
|
1349
|
+
status: string;
|
|
1350
|
+
}
|
|
1351
|
+
/** Result of an iCal export operation */
|
|
1352
|
+
interface ICalExportResult {
|
|
1353
|
+
spaceId: string;
|
|
1354
|
+
exportUrl: string;
|
|
1355
|
+
lastExportedAt: string | null;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Service for managing distribution channels in the Atzentis Booking API.
|
|
1360
|
+
*
|
|
1361
|
+
* Provides channel CRUD, mapping management, push/pull sync operations,
|
|
1362
|
+
* sync log retrieval, and iCal import/export.
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* ```typescript
|
|
1366
|
+
* const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
|
|
1367
|
+
*
|
|
1368
|
+
* // Create a Channex connection
|
|
1369
|
+
* const channel = await booking.distribution.createChannel({
|
|
1370
|
+
* propertyId: "prop_abc123",
|
|
1371
|
+
* type: "channex",
|
|
1372
|
+
* name: "Booking.com via Channex",
|
|
1373
|
+
* });
|
|
1374
|
+
*
|
|
1375
|
+
* // Push availability to channel
|
|
1376
|
+
* await booking.distribution.push(channel.id, {
|
|
1377
|
+
* dateFrom: "2025-07-01",
|
|
1378
|
+
* dateTo: "2025-12-31",
|
|
1379
|
+
* });
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
declare class DistributionService extends BaseService {
|
|
1383
|
+
protected readonly basePath = "/distribution/v1";
|
|
1384
|
+
/** Create a new distribution channel */
|
|
1385
|
+
createChannel(input: CreateChannelInput): Promise<Channel>;
|
|
1386
|
+
/** Get a channel by ID */
|
|
1387
|
+
getChannel(channelId: string): Promise<Channel>;
|
|
1388
|
+
/** List channels with optional filters */
|
|
1389
|
+
listChannels(params?: ListChannelsParams): Promise<PaginatedChannels>;
|
|
1390
|
+
/** Update a channel */
|
|
1391
|
+
updateChannel(channelId: string, input: UpdateChannelInput): Promise<Channel>;
|
|
1392
|
+
/** Delete a channel */
|
|
1393
|
+
deleteChannel(channelId: string): Promise<void>;
|
|
1394
|
+
/** Create a mapping between a local category and OTA room type/rate plan */
|
|
1395
|
+
createMapping(channelId: string, input: CreateMappingInput): Promise<ChannelMapping>;
|
|
1396
|
+
/** List mappings for a channel */
|
|
1397
|
+
listMappings(channelId: string, params?: ListMappingsParams): Promise<PaginatedMappings>;
|
|
1398
|
+
/** Delete a mapping */
|
|
1399
|
+
deleteMapping(channelId: string, mappingId: string): Promise<void>;
|
|
1400
|
+
/** Push availability and rates to a channel */
|
|
1401
|
+
push(channelId: string, input?: PushSyncInput): Promise<SyncOperation>;
|
|
1402
|
+
/** Pull reservations from a channel */
|
|
1403
|
+
pull(channelId: string, input?: PullSyncInput): Promise<SyncOperation>;
|
|
1404
|
+
/** Get sync operation log for a channel */
|
|
1405
|
+
getSyncLog(channelId: string, params?: SyncLogParams): Promise<PaginatedSyncLog>;
|
|
1406
|
+
/** Import availability from an external iCal feed */
|
|
1407
|
+
icalImport(input: ICalImportInput): Promise<ICalImportResult>;
|
|
1408
|
+
/** Get iCal export URL for a space */
|
|
1409
|
+
icalExport(spaceId: string): Promise<ICalExportResult>;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/** Status of a folio */
|
|
1413
|
+
type FolioStatus = "open" | "closed" | "settled";
|
|
1414
|
+
/** A guest folio (accounting record) */
|
|
1415
|
+
interface Folio {
|
|
1416
|
+
id: string;
|
|
1417
|
+
bookingId: string;
|
|
1418
|
+
guestId: string | null;
|
|
1419
|
+
status: FolioStatus;
|
|
1420
|
+
balance: number;
|
|
1421
|
+
totalCharges: number;
|
|
1422
|
+
totalPayments: number;
|
|
1423
|
+
currency: string;
|
|
1424
|
+
metadata: Record<string, unknown> | null;
|
|
1425
|
+
createdAt: string;
|
|
1426
|
+
updatedAt: string;
|
|
1427
|
+
closedAt: string | null;
|
|
1428
|
+
settledAt: string | null;
|
|
1429
|
+
}
|
|
1430
|
+
/** Input for creating a folio */
|
|
1431
|
+
interface CreateFolioInput {
|
|
1432
|
+
bookingId: string;
|
|
1433
|
+
guestId?: string;
|
|
1434
|
+
currency?: string;
|
|
1435
|
+
metadata?: Record<string, unknown>;
|
|
1436
|
+
}
|
|
1437
|
+
/** Input for updating a folio */
|
|
1438
|
+
interface UpdateFolioInput {
|
|
1439
|
+
guestId?: string;
|
|
1440
|
+
metadata?: Record<string, unknown>;
|
|
1441
|
+
}
|
|
1442
|
+
/** Parameters for listing folios */
|
|
1443
|
+
interface ListFoliosParams {
|
|
1444
|
+
bookingId?: string;
|
|
1445
|
+
guestId?: string;
|
|
1446
|
+
status?: FolioStatus;
|
|
1447
|
+
limit?: number;
|
|
1448
|
+
cursor?: string;
|
|
1449
|
+
}
|
|
1450
|
+
/** Paginated list of folios */
|
|
1451
|
+
type PaginatedFolios = Paginated<Folio>;
|
|
1452
|
+
/** Type of charge applied to a folio */
|
|
1453
|
+
type ChargeType = "room" | "minibar" | "restaurant" | "spa" | "parking" | "telephone" | "laundry" | "other";
|
|
1454
|
+
/** A charge on a folio */
|
|
1455
|
+
interface FolioCharge {
|
|
1456
|
+
id: string;
|
|
1457
|
+
folioId: string;
|
|
1458
|
+
type: ChargeType;
|
|
1459
|
+
description: string | null;
|
|
1460
|
+
amount: number;
|
|
1461
|
+
currency: string;
|
|
1462
|
+
transitory: boolean;
|
|
1463
|
+
metadata: Record<string, unknown> | null;
|
|
1464
|
+
createdAt: string;
|
|
1465
|
+
}
|
|
1466
|
+
/** Input for creating a charge */
|
|
1467
|
+
interface CreateChargeInput {
|
|
1468
|
+
type: ChargeType;
|
|
1469
|
+
amount: number;
|
|
1470
|
+
description?: string;
|
|
1471
|
+
currency?: string;
|
|
1472
|
+
metadata?: Record<string, unknown>;
|
|
1473
|
+
}
|
|
1474
|
+
/** Parameters for listing charges */
|
|
1475
|
+
interface ListChargesParams {
|
|
1476
|
+
type?: ChargeType;
|
|
1477
|
+
limit?: number;
|
|
1478
|
+
cursor?: string;
|
|
1479
|
+
}
|
|
1480
|
+
/** Paginated list of charges */
|
|
1481
|
+
type PaginatedCharges = Paginated<FolioCharge>;
|
|
1482
|
+
/** Input for moving charges between folios */
|
|
1483
|
+
interface MoveChargesInput {
|
|
1484
|
+
chargeIds: string[];
|
|
1485
|
+
toFolioId: string;
|
|
1486
|
+
}
|
|
1487
|
+
/** A payment applied to a folio */
|
|
1488
|
+
interface FolioPayment {
|
|
1489
|
+
id: string;
|
|
1490
|
+
folioId: string;
|
|
1491
|
+
amount: number;
|
|
1492
|
+
currency: string;
|
|
1493
|
+
method: string;
|
|
1494
|
+
reference: string | null;
|
|
1495
|
+
metadata: Record<string, unknown> | null;
|
|
1496
|
+
createdAt: string;
|
|
1497
|
+
}
|
|
1498
|
+
/** Input for creating a folio payment */
|
|
1499
|
+
interface CreateFolioPaymentInput {
|
|
1500
|
+
amount: number;
|
|
1501
|
+
method: string;
|
|
1502
|
+
reference?: string;
|
|
1503
|
+
currency?: string;
|
|
1504
|
+
metadata?: Record<string, unknown>;
|
|
1505
|
+
}
|
|
1506
|
+
/** Parameters for listing folio payments */
|
|
1507
|
+
interface ListFolioPaymentsParams {
|
|
1508
|
+
limit?: number;
|
|
1509
|
+
cursor?: string;
|
|
1510
|
+
}
|
|
1511
|
+
/** Paginated list of folio payments */
|
|
1512
|
+
type PaginatedFolioPayments = Paginated<FolioPayment>;
|
|
1513
|
+
/** Status of an invoice */
|
|
1514
|
+
type InvoiceStatus = "draft" | "finalized" | "voided";
|
|
1515
|
+
/** A fiscal invoice */
|
|
1516
|
+
interface Invoice {
|
|
1517
|
+
id: string;
|
|
1518
|
+
folioId: string;
|
|
1519
|
+
number: string;
|
|
1520
|
+
status: InvoiceStatus;
|
|
1521
|
+
amount: number;
|
|
1522
|
+
currency: string;
|
|
1523
|
+
language: string;
|
|
1524
|
+
fiscalId: string | null;
|
|
1525
|
+
metadata: Record<string, unknown> | null;
|
|
1526
|
+
createdAt: string;
|
|
1527
|
+
finalizedAt: string | null;
|
|
1528
|
+
}
|
|
1529
|
+
/** Input for generating an invoice */
|
|
1530
|
+
interface CreateInvoiceInput {
|
|
1531
|
+
language?: string;
|
|
1532
|
+
metadata?: Record<string, unknown>;
|
|
1533
|
+
}
|
|
1534
|
+
/** Daily accounting report */
|
|
1535
|
+
interface AccountingDailyReport {
|
|
1536
|
+
date: string;
|
|
1537
|
+
totalRevenue: number;
|
|
1538
|
+
totalCharges: number;
|
|
1539
|
+
totalPayments: number;
|
|
1540
|
+
breakdown: Record<string, number>;
|
|
1541
|
+
}
|
|
1542
|
+
/** Revenue report by charge type */
|
|
1543
|
+
interface AccountingRevenueReport {
|
|
1544
|
+
period: {
|
|
1545
|
+
from: string;
|
|
1546
|
+
to: string;
|
|
1547
|
+
};
|
|
1548
|
+
breakdown: Record<string, number>;
|
|
1549
|
+
}
|
|
1550
|
+
/** VAT breakdown entry */
|
|
1551
|
+
interface VatBreakdownEntry {
|
|
1552
|
+
net: number;
|
|
1553
|
+
vat: number;
|
|
1554
|
+
gross: number;
|
|
1555
|
+
}
|
|
1556
|
+
/** VAT accounting report */
|
|
1557
|
+
interface AccountingVatReport {
|
|
1558
|
+
period: {
|
|
1559
|
+
from: string;
|
|
1560
|
+
to: string;
|
|
1561
|
+
};
|
|
1562
|
+
breakdown: Record<string, VatBreakdownEntry>;
|
|
1563
|
+
}
|
|
1564
|
+
/** Parameters for accounting reports */
|
|
1565
|
+
interface AccountingReportParams {
|
|
1566
|
+
date?: string;
|
|
1567
|
+
from?: string;
|
|
1568
|
+
to?: string;
|
|
1569
|
+
propertyId?: string;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Service for financial operations in the Atzentis Booking API.
|
|
1574
|
+
*
|
|
1575
|
+
* Manages the full folio lifecycle (open → close → settle), charges,
|
|
1576
|
+
* folio payments, invoices (including PDF export), and accounting reports.
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* ```typescript
|
|
1580
|
+
* const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
|
|
1581
|
+
*
|
|
1582
|
+
* // Create a folio for a booking
|
|
1583
|
+
* const folio = await booking.finance.createFolio({
|
|
1584
|
+
* bookingId: "bk_abc123",
|
|
1585
|
+
* currency: "EUR",
|
|
1586
|
+
* });
|
|
1587
|
+
*
|
|
1588
|
+
* // Add a room charge
|
|
1589
|
+
* await booking.finance.createCharge(folio.id, {
|
|
1590
|
+
* type: "room",
|
|
1591
|
+
* amount: 10000,
|
|
1592
|
+
* });
|
|
1593
|
+
*
|
|
1594
|
+
* // Close and settle
|
|
1595
|
+
* await booking.finance.closeFolio(folio.id);
|
|
1596
|
+
* await booking.finance.settleFolio(folio.id);
|
|
1597
|
+
* ```
|
|
1598
|
+
*/
|
|
1599
|
+
declare class FinanceService extends BaseService {
|
|
1600
|
+
protected readonly basePath = "/finance/v1";
|
|
1601
|
+
/** Create a new folio for a booking */
|
|
1602
|
+
createFolio(input: CreateFolioInput): Promise<Folio>;
|
|
1603
|
+
/** Get a folio by ID */
|
|
1604
|
+
getFolio(folioId: string): Promise<Folio>;
|
|
1605
|
+
/** List folios with optional filters */
|
|
1606
|
+
listFolios(params?: ListFoliosParams): Promise<PaginatedFolios>;
|
|
1607
|
+
/** Update a folio */
|
|
1608
|
+
updateFolio(folioId: string, input: UpdateFolioInput): Promise<Folio>;
|
|
1609
|
+
/** Close a folio (no more charges can be added) */
|
|
1610
|
+
closeFolio(folioId: string): Promise<Folio>;
|
|
1611
|
+
/** Settle a folio (mark as fully paid) */
|
|
1612
|
+
settleFolio(folioId: string): Promise<Folio>;
|
|
1613
|
+
/** Create a charge on a folio */
|
|
1614
|
+
createCharge(folioId: string, input: CreateChargeInput): Promise<FolioCharge>;
|
|
1615
|
+
/** List charges on a folio */
|
|
1616
|
+
listCharges(folioId: string, params?: ListChargesParams): Promise<PaginatedCharges>;
|
|
1617
|
+
/** Create a transitory (non-billable) charge on a folio */
|
|
1618
|
+
createTransitoryCharge(folioId: string, input: CreateChargeInput): Promise<FolioCharge>;
|
|
1619
|
+
/** Move charges from one folio to another */
|
|
1620
|
+
moveCharges(folioId: string, input: MoveChargesInput): Promise<{
|
|
1621
|
+
moved: number;
|
|
1622
|
+
}>;
|
|
1623
|
+
/** Record a payment on a folio */
|
|
1624
|
+
createFolioPayment(folioId: string, input: CreateFolioPaymentInput): Promise<FolioPayment>;
|
|
1625
|
+
/** List payments on a folio */
|
|
1626
|
+
listFolioPayments(folioId: string, params?: ListFolioPaymentsParams): Promise<PaginatedFolioPayments>;
|
|
1627
|
+
/** Generate an invoice for a folio */
|
|
1628
|
+
generateInvoice(folioId: string, input?: CreateInvoiceInput): Promise<Invoice>;
|
|
1629
|
+
/** Get an invoice by ID */
|
|
1630
|
+
getInvoice(invoiceId: string): Promise<Invoice>;
|
|
1631
|
+
/** Get invoice as PDF binary data */
|
|
1632
|
+
getInvoicePdf(invoiceId: string): Promise<ArrayBuffer>;
|
|
1633
|
+
/** Get daily accounting report */
|
|
1634
|
+
getDailyReport(params?: AccountingReportParams): Promise<AccountingDailyReport>;
|
|
1635
|
+
/** Get revenue report by charge type */
|
|
1636
|
+
getRevenueReport(params?: AccountingReportParams): Promise<AccountingRevenueReport>;
|
|
1637
|
+
/** Get VAT accounting report */
|
|
1638
|
+
getVatReport(params?: AccountingReportParams): Promise<AccountingVatReport>;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1200
1641
|
/** Guest address */
|
|
1201
1642
|
interface GuestAddress {
|
|
1202
1643
|
/** Street address */
|
|
@@ -1772,6 +2213,250 @@ declare class GuestsService extends BaseService {
|
|
|
1772
2213
|
private _buildHistoryQuery;
|
|
1773
2214
|
}
|
|
1774
2215
|
|
|
2216
|
+
/** Supported payment providers */
|
|
2217
|
+
type PaymentProvider = "stripe" | "viva_wallet";
|
|
2218
|
+
/** Status of a payment */
|
|
2219
|
+
type PaymentStatus = "succeeded" | "pending" | "failed" | "requires_action";
|
|
2220
|
+
/** A processed payment */
|
|
2221
|
+
interface Payment {
|
|
2222
|
+
id: string;
|
|
2223
|
+
bookingId: string;
|
|
2224
|
+
amount: number;
|
|
2225
|
+
currency: string;
|
|
2226
|
+
status: PaymentStatus;
|
|
2227
|
+
provider: PaymentProvider;
|
|
2228
|
+
providerTransactionId: string | null;
|
|
2229
|
+
paymentMethodId: string | null;
|
|
2230
|
+
description: string | null;
|
|
2231
|
+
metadata: Record<string, unknown> | null;
|
|
2232
|
+
createdAt: string;
|
|
2233
|
+
updatedAt: string;
|
|
2234
|
+
}
|
|
2235
|
+
/** Input for processing a payment */
|
|
2236
|
+
interface ProcessPaymentInput {
|
|
2237
|
+
bookingId: string;
|
|
2238
|
+
amount: number;
|
|
2239
|
+
currency: string;
|
|
2240
|
+
paymentMethodId?: string;
|
|
2241
|
+
description?: string;
|
|
2242
|
+
metadata?: Record<string, unknown>;
|
|
2243
|
+
}
|
|
2244
|
+
/** Status of a refund */
|
|
2245
|
+
type RefundStatus = "succeeded" | "pending" | "failed";
|
|
2246
|
+
/** A refund applied to a payment */
|
|
2247
|
+
interface Refund {
|
|
2248
|
+
id: string;
|
|
2249
|
+
paymentId: string;
|
|
2250
|
+
amount: number;
|
|
2251
|
+
status: RefundStatus;
|
|
2252
|
+
reason: string | null;
|
|
2253
|
+
createdAt: string;
|
|
2254
|
+
}
|
|
2255
|
+
/** Input for refunding a payment */
|
|
2256
|
+
interface RefundInput {
|
|
2257
|
+
amount?: number;
|
|
2258
|
+
reason?: string;
|
|
2259
|
+
}
|
|
2260
|
+
/** Type of transaction */
|
|
2261
|
+
type TransactionType = "payment" | "refund" | "authorization" | "capture";
|
|
2262
|
+
/** A financial transaction record */
|
|
2263
|
+
interface Transaction {
|
|
2264
|
+
id: string;
|
|
2265
|
+
type: TransactionType;
|
|
2266
|
+
bookingId: string | null;
|
|
2267
|
+
amount: number;
|
|
2268
|
+
currency: string;
|
|
2269
|
+
status: string;
|
|
2270
|
+
provider: PaymentProvider;
|
|
2271
|
+
providerTransactionId: string | null;
|
|
2272
|
+
metadata: Record<string, unknown> | null;
|
|
2273
|
+
createdAt: string;
|
|
2274
|
+
}
|
|
2275
|
+
/** Parameters for listing transactions */
|
|
2276
|
+
interface ListTransactionsParams {
|
|
2277
|
+
bookingId?: string;
|
|
2278
|
+
status?: string;
|
|
2279
|
+
provider?: PaymentProvider;
|
|
2280
|
+
type?: TransactionType;
|
|
2281
|
+
from?: string;
|
|
2282
|
+
to?: string;
|
|
2283
|
+
limit?: number;
|
|
2284
|
+
cursor?: string;
|
|
2285
|
+
}
|
|
2286
|
+
/** Paginated list of transactions */
|
|
2287
|
+
type PaginatedTransactions = Paginated<Transaction>;
|
|
2288
|
+
/** Card details for a stored payment method */
|
|
2289
|
+
interface CardDetails {
|
|
2290
|
+
last4: string;
|
|
2291
|
+
brand: string;
|
|
2292
|
+
expMonth: number;
|
|
2293
|
+
expYear: number;
|
|
2294
|
+
}
|
|
2295
|
+
/** Status of a payment account (stored card) */
|
|
2296
|
+
type PaymentAccountStatus = "active" | "expired" | "revoked";
|
|
2297
|
+
/** A stored payment method (card on file) */
|
|
2298
|
+
interface PaymentAccount {
|
|
2299
|
+
id: string;
|
|
2300
|
+
paymentMethodId: string;
|
|
2301
|
+
bookingId: string | null;
|
|
2302
|
+
guestId: string | null;
|
|
2303
|
+
card: CardDetails;
|
|
2304
|
+
label: string | null;
|
|
2305
|
+
status: PaymentAccountStatus;
|
|
2306
|
+
metadata: Record<string, unknown> | null;
|
|
2307
|
+
createdAt: string;
|
|
2308
|
+
}
|
|
2309
|
+
/** Input for creating a payment account */
|
|
2310
|
+
interface CreatePaymentAccountInput {
|
|
2311
|
+
paymentMethodId: string;
|
|
2312
|
+
bookingId?: string;
|
|
2313
|
+
guestId?: string;
|
|
2314
|
+
label?: string;
|
|
2315
|
+
metadata?: Record<string, unknown>;
|
|
2316
|
+
}
|
|
2317
|
+
/** Parameters for listing payment accounts */
|
|
2318
|
+
interface ListPaymentAccountsParams {
|
|
2319
|
+
bookingId?: string;
|
|
2320
|
+
guestId?: string;
|
|
2321
|
+
status?: PaymentAccountStatus;
|
|
2322
|
+
limit?: number;
|
|
2323
|
+
cursor?: string;
|
|
2324
|
+
}
|
|
2325
|
+
/** Paginated list of payment accounts */
|
|
2326
|
+
type PaginatedPaymentAccounts = Paginated<PaymentAccount>;
|
|
2327
|
+
/** Status of a pre-authorization */
|
|
2328
|
+
type AuthorizationStatus = "authorized" | "expired" | "captured" | "voided";
|
|
2329
|
+
/** A pre-authorization hold on a stored card */
|
|
2330
|
+
interface Authorization {
|
|
2331
|
+
id: string;
|
|
2332
|
+
accountId: string;
|
|
2333
|
+
amount: number;
|
|
2334
|
+
currency: string;
|
|
2335
|
+
status: AuthorizationStatus;
|
|
2336
|
+
expiresAt: string;
|
|
2337
|
+
description: string | null;
|
|
2338
|
+
metadata: Record<string, unknown> | null;
|
|
2339
|
+
createdAt: string;
|
|
2340
|
+
}
|
|
2341
|
+
/** Input for authorizing a hold */
|
|
2342
|
+
interface AuthorizeInput {
|
|
2343
|
+
amount: number;
|
|
2344
|
+
currency?: string;
|
|
2345
|
+
description?: string;
|
|
2346
|
+
metadata?: Record<string, unknown>;
|
|
2347
|
+
}
|
|
2348
|
+
/** Input for capturing an authorized hold */
|
|
2349
|
+
interface CaptureInput {
|
|
2350
|
+
amount: number;
|
|
2351
|
+
description?: string;
|
|
2352
|
+
metadata?: Record<string, unknown>;
|
|
2353
|
+
}
|
|
2354
|
+
/** Status of a terminal POS transaction */
|
|
2355
|
+
type TerminalTransactionStatus = "pending" | "authorized" | "declined" | "timeout";
|
|
2356
|
+
/** A POS terminal transaction */
|
|
2357
|
+
interface TerminalTransaction {
|
|
2358
|
+
id: string;
|
|
2359
|
+
terminalId: string;
|
|
2360
|
+
amount: number;
|
|
2361
|
+
currency: string;
|
|
2362
|
+
status: TerminalTransactionStatus;
|
|
2363
|
+
cardPresent: boolean;
|
|
2364
|
+
bookingId: string | null;
|
|
2365
|
+
description: string | null;
|
|
2366
|
+
metadata: Record<string, unknown> | null;
|
|
2367
|
+
createdAt: string;
|
|
2368
|
+
}
|
|
2369
|
+
/** Input for terminal authorization */
|
|
2370
|
+
interface TerminalAuthorizeInput {
|
|
2371
|
+
amount: number;
|
|
2372
|
+
terminalId: string;
|
|
2373
|
+
bookingId?: string;
|
|
2374
|
+
description?: string;
|
|
2375
|
+
currency?: string;
|
|
2376
|
+
metadata?: Record<string, unknown>;
|
|
2377
|
+
}
|
|
2378
|
+
/** Status of an IRIS bank transfer */
|
|
2379
|
+
type IrisTransferStatus = "initiated" | "completed" | "failed" | "expired";
|
|
2380
|
+
/** An IRIS instant bank transfer */
|
|
2381
|
+
interface IrisTransfer {
|
|
2382
|
+
id: string;
|
|
2383
|
+
amount: number;
|
|
2384
|
+
currency: string;
|
|
2385
|
+
guestId: string;
|
|
2386
|
+
bookingId: string | null;
|
|
2387
|
+
status: IrisTransferStatus;
|
|
2388
|
+
paymentUrl: string;
|
|
2389
|
+
expiresAt: string;
|
|
2390
|
+
description: string | null;
|
|
2391
|
+
metadata: Record<string, unknown> | null;
|
|
2392
|
+
createdAt: string;
|
|
2393
|
+
completedAt: string | null;
|
|
2394
|
+
}
|
|
2395
|
+
/** Input for initiating an IRIS transfer */
|
|
2396
|
+
interface IrisInitiateInput {
|
|
2397
|
+
amount: number;
|
|
2398
|
+
guestId: string;
|
|
2399
|
+
bookingId?: string;
|
|
2400
|
+
description?: string;
|
|
2401
|
+
returnUrl?: string;
|
|
2402
|
+
metadata?: Record<string, unknown>;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Service for payment operations in the Atzentis Booking API.
|
|
2407
|
+
*
|
|
2408
|
+
* Supports Stripe and Viva Wallet providers with payment processing,
|
|
2409
|
+
* refunds, stored card management (authorize/capture), POS terminal
|
|
2410
|
+
* operations, and IRIS Greek bank transfers.
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* ```typescript
|
|
2414
|
+
* const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
|
|
2415
|
+
*
|
|
2416
|
+
* // Process a payment
|
|
2417
|
+
* const payment = await booking.payments.process({
|
|
2418
|
+
* bookingId: "bk_abc123",
|
|
2419
|
+
* amount: 15000,
|
|
2420
|
+
* currency: "EUR",
|
|
2421
|
+
* });
|
|
2422
|
+
*
|
|
2423
|
+
* // Partial refund
|
|
2424
|
+
* const refund = await booking.payments.refund(payment.id, {
|
|
2425
|
+
* amount: 5000,
|
|
2426
|
+
* reason: "Early checkout",
|
|
2427
|
+
* });
|
|
2428
|
+
* ```
|
|
2429
|
+
*/
|
|
2430
|
+
declare class PaymentsService extends BaseService {
|
|
2431
|
+
protected readonly basePath = "/payment/v1";
|
|
2432
|
+
/** Process a payment for a booking */
|
|
2433
|
+
process(input: ProcessPaymentInput): Promise<Payment>;
|
|
2434
|
+
/** Refund a payment (full or partial) */
|
|
2435
|
+
refund(paymentId: string, input?: RefundInput): Promise<Refund>;
|
|
2436
|
+
/** Get a transaction by ID */
|
|
2437
|
+
getTransaction(transactionId: string): Promise<Transaction>;
|
|
2438
|
+
/** List transactions with optional filters */
|
|
2439
|
+
listTransactions(params?: ListTransactionsParams): Promise<PaginatedTransactions>;
|
|
2440
|
+
/** Create a payment account (store a card on file) */
|
|
2441
|
+
createAccount(input: CreatePaymentAccountInput): Promise<PaymentAccount>;
|
|
2442
|
+
/** Get a payment account by ID */
|
|
2443
|
+
getAccount(accountId: string): Promise<PaymentAccount>;
|
|
2444
|
+
/** List payment accounts with optional filters */
|
|
2445
|
+
listAccounts(params?: ListPaymentAccountsParams): Promise<PaginatedPaymentAccounts>;
|
|
2446
|
+
/** Delete a payment account */
|
|
2447
|
+
deleteAccount(accountId: string): Promise<void>;
|
|
2448
|
+
/** Authorize a hold on a stored card */
|
|
2449
|
+
authorize(accountId: string, input: AuthorizeInput): Promise<Authorization>;
|
|
2450
|
+
/** Capture a previously authorized hold */
|
|
2451
|
+
capture(accountId: string, input: CaptureInput): Promise<Payment>;
|
|
2452
|
+
/** Initiate a POS terminal payment authorization */
|
|
2453
|
+
terminalAuthorize(input: TerminalAuthorizeInput): Promise<TerminalTransaction>;
|
|
2454
|
+
/** Initiate an IRIS instant bank transfer */
|
|
2455
|
+
irisInitiate(input: IrisInitiateInput): Promise<IrisTransfer>;
|
|
2456
|
+
/** Get the status of an IRIS transfer */
|
|
2457
|
+
irisStatus(transferId: string): Promise<IrisTransfer>;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
1775
2460
|
/**
|
|
1776
2461
|
* Service for managing properties in the Atzentis Booking API.
|
|
1777
2462
|
*
|
|
@@ -1993,7 +2678,10 @@ declare class BookingClient {
|
|
|
1993
2678
|
readonly httpClient: HttpClient;
|
|
1994
2679
|
private _availability?;
|
|
1995
2680
|
private _bookings?;
|
|
2681
|
+
private _distribution?;
|
|
2682
|
+
private _finance?;
|
|
1996
2683
|
private _guests?;
|
|
2684
|
+
private _payments?;
|
|
1997
2685
|
private _properties?;
|
|
1998
2686
|
private _categories?;
|
|
1999
2687
|
private _spaces?;
|
|
@@ -2002,8 +2690,14 @@ declare class BookingClient {
|
|
|
2002
2690
|
get availability(): AvailabilityService;
|
|
2003
2691
|
/** Bookings service — lazy-initialized on first access */
|
|
2004
2692
|
get bookings(): BookingsService;
|
|
2693
|
+
/** Distribution service — lazy-initialized on first access */
|
|
2694
|
+
get distribution(): DistributionService;
|
|
2695
|
+
/** Finance service — lazy-initialized on first access */
|
|
2696
|
+
get finance(): FinanceService;
|
|
2005
2697
|
/** Guests service — lazy-initialized on first access */
|
|
2006
2698
|
get guests(): GuestsService;
|
|
2699
|
+
/** Payments service — lazy-initialized on first access */
|
|
2700
|
+
get payments(): PaymentsService;
|
|
2007
2701
|
/** Properties service — lazy-initialized on first access */
|
|
2008
2702
|
get properties(): PropertiesService;
|
|
2009
2703
|
/** Categories service — lazy-initialized on first access */
|
|
@@ -2092,4 +2786,4 @@ declare function firstPage<T>(fetcher: PageFetcher<T>, options?: PaginationOptio
|
|
|
2092
2786
|
|
|
2093
2787
|
declare const VERSION = "0.1.0";
|
|
2094
2788
|
|
|
2095
|
-
export { type AssignSpaceInput, AuthenticationError, type AvailabilityCheckParams, type AvailabilityPricing, type AvailabilityRestrictions, type AvailabilityResult, type AvailabilitySearchParams, type AvailabilitySearchResult, type AvailabilitySearchResultEntry, AvailabilityService, type AvailableSpace, BOOKING_STATUSES, BOOKING_TYPES, type Booking, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BookingGuest, type BookingPricing, type BookingSort, type BookingSpace, type BookingStatus, type BookingType, BookingsService, type BulkUpdateSpaceInput, type CalendarDay, type CalendarParams, type CancelBookingInput, CategoriesService, type CheckInInput, type CheckOutInput, ConflictError, type Coordinates, type CreateBookingInput, type CreateCategoryInput, type CreateGuestInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, type DuplicateCandidate, ForbiddenError, type Guest, type GuestAddress, type GuestBookingSummary, type GuestDuplicateResult, type GuestFolioSummary, type GuestHistoryParams, type GuestMatch, type GuestOrderSummary, type GuestPreferences, type GuestSearchResult, type GuestSort, GuestsService, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type LinkPosTableInput, type ListBookingsParams, type ListCategoriesParams, type ListGuestsParams, type ListPropertiesParams, type ListSpacesParams, type Logger, type MergeGuestsInput, type NoShowInput, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginatedBookings, type PaginatedGuestBookings, type PaginatedGuestFolios, type PaginatedGuestOrders, type PaginatedGuests, type PaginationOptions, PaymentError, type PriceRange, type PricingParams, type PricingResult, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, RateLimitError, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, type SearchGuestsParams, ServerError, type ServiceSlotParams, type ServiceTimeSlot, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, type TableSlotParams, type TimeSlot, TimeoutError, type UpdateBookingInput, type UpdateCategoryInput, type UpdateGuestInput, type UpdateGuestPreferences, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };
|
|
2789
|
+
export { type AccountingDailyReport, type AccountingReportParams, type AccountingRevenueReport, type AccountingVatReport, type AssignSpaceInput, AuthenticationError, type Authorization, type AuthorizationStatus, type AuthorizeInput, type AvailabilityCheckParams, type AvailabilityPricing, type AvailabilityRestrictions, type AvailabilityResult, type AvailabilitySearchParams, type AvailabilitySearchResult, type AvailabilitySearchResultEntry, AvailabilityService, type AvailableSpace, BOOKING_STATUSES, BOOKING_TYPES, type Booking, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BookingGuest, type BookingPricing, type BookingSort, type BookingSpace, type BookingStatus, type BookingType, BookingsService, type BulkUpdateSpaceInput, type CalendarDay, type CalendarParams, type CancelBookingInput, type CaptureInput, type CardDetails, CategoriesService, type Channel, type ChannelCredentials, type ChannelMapping, type ChannelSettings, type ChannelStatus, type ChannelType, type ChargeType, type CheckInInput, type CheckOutInput, ConflictError, type Coordinates, type CreateBookingInput, type CreateCategoryInput, type CreateChannelInput, type CreateChargeInput, type CreateFolioInput, type CreateFolioPaymentInput, type CreateGuestInput, type CreateInvoiceInput, type CreateMappingInput, type CreatePaymentAccountInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, DistributionService, type DuplicateCandidate, FinanceService, type Folio, type FolioCharge, type FolioPayment, type FolioStatus, ForbiddenError, type Guest, type GuestAddress, type GuestBookingSummary, type GuestDuplicateResult, type GuestFolioSummary, type GuestHistoryParams, type GuestMatch, type GuestOrderSummary, type GuestPreferences, type GuestSearchResult, type GuestSort, GuestsService, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type ICalExportResult, type ICalImportInput, type ICalImportResult, type Invoice, type InvoiceStatus, type IrisInitiateInput, type IrisTransfer, type IrisTransferStatus, type LinkPosTableInput, type ListBookingsParams, type ListCategoriesParams, type ListChannelsParams, type ListChargesParams, type ListFolioPaymentsParams, type ListFoliosParams, type ListGuestsParams, type ListMappingsParams, type ListPaymentAccountsParams, type ListPropertiesParams, type ListSpacesParams, type ListTransactionsParams, type Logger, type MergeGuestsInput, type MoveChargesInput, type NoShowInput, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginatedBookings, type PaginatedChannels, type PaginatedCharges, type PaginatedFolioPayments, type PaginatedFolios, type PaginatedGuestBookings, type PaginatedGuestFolios, type PaginatedGuestOrders, type PaginatedGuests, type PaginatedMappings, type PaginatedPaymentAccounts, type PaginatedSyncLog, type PaginatedTransactions, type PaginationOptions, type Payment, type PaymentAccount, type PaymentAccountStatus, PaymentError, type PaymentProvider, type PaymentStatus, PaymentsService, type PriceRange, type PricingParams, type PricingResult, type ProcessPaymentInput, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, type PullSyncInput, type PushSyncInput, RateLimitError, type Refund, type RefundInput, type RefundStatus, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, type SearchGuestsParams, ServerError, type ServiceSlotParams, type ServiceTimeSlot, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, type SyncError, type SyncLogParams, type SyncOperation, type SyncOperationStatus, type SyncOperationType, type SyncStats, type TableSlotParams, type TerminalAuthorizeInput, type TerminalTransaction, type TerminalTransactionStatus, type TimeSlot, TimeoutError, type Transaction, type TransactionType, type UpdateBookingInput, type UpdateCategoryInput, type UpdateChannelInput, type UpdateFolioInput, type UpdateGuestInput, type UpdateGuestPreferences, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, type VatBreakdownEntry, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };
|