@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 CHANGED
@@ -37,12 +37,15 @@ __export(index_exports, {
37
37
  CategoriesService: () => CategoriesService,
38
38
  ConflictError: () => ConflictError,
39
39
  DEFAULT_MODULES: () => DEFAULT_MODULES,
40
+ DistributionService: () => DistributionService,
41
+ FinanceService: () => FinanceService,
40
42
  ForbiddenError: () => ForbiddenError,
41
43
  GuestsService: () => GuestsService,
42
44
  HttpClient: () => HttpClient,
43
45
  NotFoundError: () => NotFoundError,
44
46
  PROPERTY_MODULES: () => PROPERTY_MODULES,
45
47
  PaymentError: () => PaymentError,
48
+ PaymentsService: () => PaymentsService,
46
49
  PropertiesService: () => PropertiesService,
47
50
  RateLimitError: () => RateLimitError,
48
51
  SPACE_STATUSES: () => SPACE_STATUSES,
@@ -1092,6 +1095,239 @@ var CategoriesService = class extends BaseService {
1092
1095
  }
1093
1096
  };
1094
1097
 
1098
+ // src/services/distribution.ts
1099
+ var DistributionService = class extends BaseService {
1100
+ constructor() {
1101
+ super(...arguments);
1102
+ this.basePath = "/distribution/v1";
1103
+ }
1104
+ // ---------------------------------------------------------------------------
1105
+ // Channel CRUD
1106
+ // ---------------------------------------------------------------------------
1107
+ /** Create a new distribution channel */
1108
+ createChannel(input) {
1109
+ return this._post(this._buildPath("channels"), input);
1110
+ }
1111
+ /** Get a channel by ID */
1112
+ getChannel(channelId) {
1113
+ return this._get(this._buildPath("channels", channelId));
1114
+ }
1115
+ /** List channels with optional filters */
1116
+ listChannels(params) {
1117
+ if (!params) return this._get(this._buildPath("channels"));
1118
+ const query = {};
1119
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1120
+ if (params.type !== void 0) query.type = params.type;
1121
+ if (params.status !== void 0) query.status = params.status;
1122
+ if (params.enabled !== void 0) query.enabled = params.enabled;
1123
+ if (params.limit !== void 0) query.limit = params.limit;
1124
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1125
+ return this._get(this._buildPath("channels"), query);
1126
+ }
1127
+ /** Update a channel */
1128
+ updateChannel(channelId, input) {
1129
+ return this._patch(this._buildPath("channels", channelId), input);
1130
+ }
1131
+ /** Delete a channel */
1132
+ deleteChannel(channelId) {
1133
+ return this._delete(this._buildPath("channels", channelId));
1134
+ }
1135
+ // ---------------------------------------------------------------------------
1136
+ // Mapping management
1137
+ // ---------------------------------------------------------------------------
1138
+ /** Create a mapping between a local category and OTA room type/rate plan */
1139
+ createMapping(channelId, input) {
1140
+ return this._post(this._buildPath("channels", channelId, "mappings"), input);
1141
+ }
1142
+ /** List mappings for a channel */
1143
+ listMappings(channelId, params) {
1144
+ if (!params) {
1145
+ return this._get(this._buildPath("channels", channelId, "mappings"));
1146
+ }
1147
+ const query = {};
1148
+ if (params.localCategoryId !== void 0) query.localCategoryId = params.localCategoryId;
1149
+ if (params.limit !== void 0) query.limit = params.limit;
1150
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1151
+ return this._get(this._buildPath("channels", channelId, "mappings"), query);
1152
+ }
1153
+ /** Delete a mapping */
1154
+ deleteMapping(channelId, mappingId) {
1155
+ return this._delete(this._buildPath("channels", channelId, "mappings", mappingId));
1156
+ }
1157
+ // ---------------------------------------------------------------------------
1158
+ // Push/pull sync
1159
+ // ---------------------------------------------------------------------------
1160
+ /** Push availability and rates to a channel */
1161
+ push(channelId, input) {
1162
+ return this._post(this._buildPath("channels", channelId, "push"), input ?? {});
1163
+ }
1164
+ /** Pull reservations from a channel */
1165
+ pull(channelId, input) {
1166
+ return this._post(this._buildPath("channels", channelId, "pull"), input ?? {});
1167
+ }
1168
+ /** Get sync operation log for a channel */
1169
+ getSyncLog(channelId, params) {
1170
+ if (!params) {
1171
+ return this._get(this._buildPath("channels", channelId, "sync-log"));
1172
+ }
1173
+ const query = {};
1174
+ if (params.type !== void 0) query.type = params.type;
1175
+ if (params.status !== void 0) query.status = params.status;
1176
+ if (params.from !== void 0) query.from = params.from;
1177
+ if (params.to !== void 0) query.to = params.to;
1178
+ if (params.limit !== void 0) query.limit = params.limit;
1179
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1180
+ return this._get(this._buildPath("channels", channelId, "sync-log"), query);
1181
+ }
1182
+ // ---------------------------------------------------------------------------
1183
+ // iCal import/export
1184
+ // ---------------------------------------------------------------------------
1185
+ /** Import availability from an external iCal feed */
1186
+ icalImport(input) {
1187
+ return this._post(this._buildPath("ical", "import"), input);
1188
+ }
1189
+ /** Get iCal export URL for a space */
1190
+ icalExport(spaceId) {
1191
+ return this._get(this._buildPath("ical", "export", spaceId));
1192
+ }
1193
+ };
1194
+
1195
+ // src/services/finance.ts
1196
+ var FinanceService = class extends BaseService {
1197
+ constructor() {
1198
+ super(...arguments);
1199
+ this.basePath = "/finance/v1";
1200
+ }
1201
+ // ---------------------------------------------------------------------------
1202
+ // Folio CRUD and lifecycle
1203
+ // ---------------------------------------------------------------------------
1204
+ /** Create a new folio for a booking */
1205
+ createFolio(input) {
1206
+ return this._post(this._buildPath("folios"), input);
1207
+ }
1208
+ /** Get a folio by ID */
1209
+ getFolio(folioId) {
1210
+ return this._get(this._buildPath("folios", folioId));
1211
+ }
1212
+ /** List folios with optional filters */
1213
+ listFolios(params) {
1214
+ if (!params) return this._get(this._buildPath("folios"));
1215
+ const query = {};
1216
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1217
+ if (params.guestId !== void 0) query.guestId = params.guestId;
1218
+ if (params.status !== void 0) query.status = params.status;
1219
+ if (params.limit !== void 0) query.limit = params.limit;
1220
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1221
+ return this._get(this._buildPath("folios"), query);
1222
+ }
1223
+ /** Update a folio */
1224
+ updateFolio(folioId, input) {
1225
+ return this._patch(this._buildPath("folios", folioId), input);
1226
+ }
1227
+ /** Close a folio (no more charges can be added) */
1228
+ closeFolio(folioId) {
1229
+ return this._post(this._buildPath("folios", folioId, "close"), {});
1230
+ }
1231
+ /** Settle a folio (mark as fully paid) */
1232
+ settleFolio(folioId) {
1233
+ return this._post(this._buildPath("folios", folioId, "settle"), {});
1234
+ }
1235
+ // ---------------------------------------------------------------------------
1236
+ // Charge operations
1237
+ // ---------------------------------------------------------------------------
1238
+ /** Create a charge on a folio */
1239
+ createCharge(folioId, input) {
1240
+ return this._post(this._buildPath("folios", folioId, "charges"), input);
1241
+ }
1242
+ /** List charges on a folio */
1243
+ listCharges(folioId, params) {
1244
+ if (!params) {
1245
+ return this._get(this._buildPath("folios", folioId, "charges"));
1246
+ }
1247
+ const query = {};
1248
+ if (params.type !== void 0) query.type = params.type;
1249
+ if (params.limit !== void 0) query.limit = params.limit;
1250
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1251
+ return this._get(this._buildPath("folios", folioId, "charges"), query);
1252
+ }
1253
+ /** Create a transitory (non-billable) charge on a folio */
1254
+ createTransitoryCharge(folioId, input) {
1255
+ return this._post(
1256
+ this._buildPath("folios", folioId, "charges", "transitory"),
1257
+ input
1258
+ );
1259
+ }
1260
+ /** Move charges from one folio to another */
1261
+ moveCharges(folioId, input) {
1262
+ return this._post(
1263
+ this._buildPath("folios", folioId, "charges", "move"),
1264
+ input
1265
+ );
1266
+ }
1267
+ // ---------------------------------------------------------------------------
1268
+ // Folio payment operations
1269
+ // ---------------------------------------------------------------------------
1270
+ /** Record a payment on a folio */
1271
+ createFolioPayment(folioId, input) {
1272
+ return this._post(this._buildPath("folios", folioId, "payments"), input);
1273
+ }
1274
+ /** List payments on a folio */
1275
+ listFolioPayments(folioId, params) {
1276
+ if (!params) {
1277
+ return this._get(this._buildPath("folios", folioId, "payments"));
1278
+ }
1279
+ const query = {};
1280
+ if (params.limit !== void 0) query.limit = params.limit;
1281
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1282
+ return this._get(this._buildPath("folios", folioId, "payments"), query);
1283
+ }
1284
+ // ---------------------------------------------------------------------------
1285
+ // Invoice operations
1286
+ // ---------------------------------------------------------------------------
1287
+ /** Generate an invoice for a folio */
1288
+ generateInvoice(folioId, input) {
1289
+ return this._post(this._buildPath("folios", folioId, "invoice"), input ?? {});
1290
+ }
1291
+ /** Get an invoice by ID */
1292
+ getInvoice(invoiceId) {
1293
+ return this._get(this._buildPath("invoices", invoiceId));
1294
+ }
1295
+ /** Get invoice as PDF binary data */
1296
+ getInvoicePdf(invoiceId) {
1297
+ return this._get(this._buildPath("invoices", invoiceId, "pdf"));
1298
+ }
1299
+ // ---------------------------------------------------------------------------
1300
+ // Accounting reports
1301
+ // ---------------------------------------------------------------------------
1302
+ /** Get daily accounting report */
1303
+ getDailyReport(params) {
1304
+ if (!params) return this._get(this._buildPath("accounting", "daily"));
1305
+ const query = {};
1306
+ if (params.date !== void 0) query.date = params.date;
1307
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1308
+ return this._get(this._buildPath("accounting", "daily"), query);
1309
+ }
1310
+ /** Get revenue report by charge type */
1311
+ getRevenueReport(params) {
1312
+ if (!params)
1313
+ return this._get(this._buildPath("accounting", "revenue"));
1314
+ const query = {};
1315
+ if (params.from !== void 0) query.from = params.from;
1316
+ if (params.to !== void 0) query.to = params.to;
1317
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1318
+ return this._get(this._buildPath("accounting", "revenue"), query);
1319
+ }
1320
+ /** Get VAT accounting report */
1321
+ getVatReport(params) {
1322
+ if (!params) return this._get(this._buildPath("accounting", "vat"));
1323
+ const query = {};
1324
+ if (params.from !== void 0) query.from = params.from;
1325
+ if (params.to !== void 0) query.to = params.to;
1326
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1327
+ return this._get(this._buildPath("accounting", "vat"), query);
1328
+ }
1329
+ };
1330
+
1095
1331
  // src/services/guests.ts
1096
1332
  var GuestsService = class extends BaseService {
1097
1333
  constructor() {
@@ -1371,6 +1607,101 @@ var GuestsService = class extends BaseService {
1371
1607
  }
1372
1608
  };
1373
1609
 
1610
+ // src/services/payments.ts
1611
+ var PaymentsService = class extends BaseService {
1612
+ constructor() {
1613
+ super(...arguments);
1614
+ this.basePath = "/payment/v1";
1615
+ }
1616
+ // ---------------------------------------------------------------------------
1617
+ // Process and refund
1618
+ // ---------------------------------------------------------------------------
1619
+ /** Process a payment for a booking */
1620
+ process(input) {
1621
+ return this._post(this._buildPath("payments"), input);
1622
+ }
1623
+ /** Refund a payment (full or partial) */
1624
+ refund(paymentId, input) {
1625
+ return this._post(this._buildPath("payments", paymentId, "refund"), input ?? {});
1626
+ }
1627
+ // ---------------------------------------------------------------------------
1628
+ // Transactions
1629
+ // ---------------------------------------------------------------------------
1630
+ /** Get a transaction by ID */
1631
+ getTransaction(transactionId) {
1632
+ return this._get(this._buildPath("transactions", transactionId));
1633
+ }
1634
+ /** List transactions with optional filters */
1635
+ listTransactions(params) {
1636
+ if (!params) return this._get(this._buildPath("transactions"));
1637
+ const query = {};
1638
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1639
+ if (params.status !== void 0) query.status = params.status;
1640
+ if (params.provider !== void 0) query.provider = params.provider;
1641
+ if (params.type !== void 0) query.type = params.type;
1642
+ if (params.from !== void 0) query.from = params.from;
1643
+ if (params.to !== void 0) query.to = params.to;
1644
+ if (params.limit !== void 0) query.limit = params.limit;
1645
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1646
+ return this._get(this._buildPath("transactions"), query);
1647
+ }
1648
+ // ---------------------------------------------------------------------------
1649
+ // Payment accounts (stored cards)
1650
+ // ---------------------------------------------------------------------------
1651
+ /** Create a payment account (store a card on file) */
1652
+ createAccount(input) {
1653
+ return this._post(this._buildPath("accounts"), input);
1654
+ }
1655
+ /** Get a payment account by ID */
1656
+ getAccount(accountId) {
1657
+ return this._get(this._buildPath("accounts", accountId));
1658
+ }
1659
+ /** List payment accounts with optional filters */
1660
+ listAccounts(params) {
1661
+ if (!params) return this._get(this._buildPath("accounts"));
1662
+ const query = {};
1663
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1664
+ if (params.guestId !== void 0) query.guestId = params.guestId;
1665
+ if (params.status !== void 0) query.status = params.status;
1666
+ if (params.limit !== void 0) query.limit = params.limit;
1667
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1668
+ return this._get(this._buildPath("accounts"), query);
1669
+ }
1670
+ /** Delete a payment account */
1671
+ deleteAccount(accountId) {
1672
+ return this._delete(this._buildPath("accounts", accountId));
1673
+ }
1674
+ // ---------------------------------------------------------------------------
1675
+ // Authorize and capture
1676
+ // ---------------------------------------------------------------------------
1677
+ /** Authorize a hold on a stored card */
1678
+ authorize(accountId, input) {
1679
+ return this._post(this._buildPath("accounts", accountId, "authorize"), input);
1680
+ }
1681
+ /** Capture a previously authorized hold */
1682
+ capture(accountId, input) {
1683
+ return this._post(this._buildPath("accounts", accountId, "capture"), input);
1684
+ }
1685
+ // ---------------------------------------------------------------------------
1686
+ // Terminal operations
1687
+ // ---------------------------------------------------------------------------
1688
+ /** Initiate a POS terminal payment authorization */
1689
+ terminalAuthorize(input) {
1690
+ return this._post(this._buildPath("terminal", "authorize"), input);
1691
+ }
1692
+ // ---------------------------------------------------------------------------
1693
+ // IRIS operations
1694
+ // ---------------------------------------------------------------------------
1695
+ /** Initiate an IRIS instant bank transfer */
1696
+ irisInitiate(input) {
1697
+ return this._post(this._buildPath("iris", "initiate"), input);
1698
+ }
1699
+ /** Get the status of an IRIS transfer */
1700
+ irisStatus(transferId) {
1701
+ return this._get(this._buildPath("iris", transferId));
1702
+ }
1703
+ };
1704
+
1374
1705
  // src/services/properties.ts
1375
1706
  var PropertiesService = class extends BaseService {
1376
1707
  constructor() {
@@ -1600,11 +1931,26 @@ var BookingClient = class {
1600
1931
  this._bookings ?? (this._bookings = new BookingsService(this.httpClient));
1601
1932
  return this._bookings;
1602
1933
  }
1934
+ /** Distribution service — lazy-initialized on first access */
1935
+ get distribution() {
1936
+ this._distribution ?? (this._distribution = new DistributionService(this.httpClient));
1937
+ return this._distribution;
1938
+ }
1939
+ /** Finance service — lazy-initialized on first access */
1940
+ get finance() {
1941
+ this._finance ?? (this._finance = new FinanceService(this.httpClient));
1942
+ return this._finance;
1943
+ }
1603
1944
  /** Guests service — lazy-initialized on first access */
1604
1945
  get guests() {
1605
1946
  this._guests ?? (this._guests = new GuestsService(this.httpClient));
1606
1947
  return this._guests;
1607
1948
  }
1949
+ /** Payments service — lazy-initialized on first access */
1950
+ get payments() {
1951
+ this._payments ?? (this._payments = new PaymentsService(this.httpClient));
1952
+ return this._payments;
1953
+ }
1608
1954
  /** Properties service — lazy-initialized on first access */
1609
1955
  get properties() {
1610
1956
  this._properties ?? (this._properties = new PropertiesService(this.httpClient));
@@ -1738,12 +2084,15 @@ var VERSION = "0.1.0";
1738
2084
  CategoriesService,
1739
2085
  ConflictError,
1740
2086
  DEFAULT_MODULES,
2087
+ DistributionService,
2088
+ FinanceService,
1741
2089
  ForbiddenError,
1742
2090
  GuestsService,
1743
2091
  HttpClient,
1744
2092
  NotFoundError,
1745
2093
  PROPERTY_MODULES,
1746
2094
  PaymentError,
2095
+ PaymentsService,
1747
2096
  PropertiesService,
1748
2097
  RateLimitError,
1749
2098
  SPACE_STATUSES,