@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.js CHANGED
@@ -1039,6 +1039,239 @@ var CategoriesService = class extends BaseService {
1039
1039
  }
1040
1040
  };
1041
1041
 
1042
+ // src/services/distribution.ts
1043
+ var DistributionService = class extends BaseService {
1044
+ constructor() {
1045
+ super(...arguments);
1046
+ this.basePath = "/distribution/v1";
1047
+ }
1048
+ // ---------------------------------------------------------------------------
1049
+ // Channel CRUD
1050
+ // ---------------------------------------------------------------------------
1051
+ /** Create a new distribution channel */
1052
+ createChannel(input) {
1053
+ return this._post(this._buildPath("channels"), input);
1054
+ }
1055
+ /** Get a channel by ID */
1056
+ getChannel(channelId) {
1057
+ return this._get(this._buildPath("channels", channelId));
1058
+ }
1059
+ /** List channels with optional filters */
1060
+ listChannels(params) {
1061
+ if (!params) return this._get(this._buildPath("channels"));
1062
+ const query = {};
1063
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1064
+ if (params.type !== void 0) query.type = params.type;
1065
+ if (params.status !== void 0) query.status = params.status;
1066
+ if (params.enabled !== void 0) query.enabled = params.enabled;
1067
+ if (params.limit !== void 0) query.limit = params.limit;
1068
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1069
+ return this._get(this._buildPath("channels"), query);
1070
+ }
1071
+ /** Update a channel */
1072
+ updateChannel(channelId, input) {
1073
+ return this._patch(this._buildPath("channels", channelId), input);
1074
+ }
1075
+ /** Delete a channel */
1076
+ deleteChannel(channelId) {
1077
+ return this._delete(this._buildPath("channels", channelId));
1078
+ }
1079
+ // ---------------------------------------------------------------------------
1080
+ // Mapping management
1081
+ // ---------------------------------------------------------------------------
1082
+ /** Create a mapping between a local category and OTA room type/rate plan */
1083
+ createMapping(channelId, input) {
1084
+ return this._post(this._buildPath("channels", channelId, "mappings"), input);
1085
+ }
1086
+ /** List mappings for a channel */
1087
+ listMappings(channelId, params) {
1088
+ if (!params) {
1089
+ return this._get(this._buildPath("channels", channelId, "mappings"));
1090
+ }
1091
+ const query = {};
1092
+ if (params.localCategoryId !== void 0) query.localCategoryId = params.localCategoryId;
1093
+ if (params.limit !== void 0) query.limit = params.limit;
1094
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1095
+ return this._get(this._buildPath("channels", channelId, "mappings"), query);
1096
+ }
1097
+ /** Delete a mapping */
1098
+ deleteMapping(channelId, mappingId) {
1099
+ return this._delete(this._buildPath("channels", channelId, "mappings", mappingId));
1100
+ }
1101
+ // ---------------------------------------------------------------------------
1102
+ // Push/pull sync
1103
+ // ---------------------------------------------------------------------------
1104
+ /** Push availability and rates to a channel */
1105
+ push(channelId, input) {
1106
+ return this._post(this._buildPath("channels", channelId, "push"), input ?? {});
1107
+ }
1108
+ /** Pull reservations from a channel */
1109
+ pull(channelId, input) {
1110
+ return this._post(this._buildPath("channels", channelId, "pull"), input ?? {});
1111
+ }
1112
+ /** Get sync operation log for a channel */
1113
+ getSyncLog(channelId, params) {
1114
+ if (!params) {
1115
+ return this._get(this._buildPath("channels", channelId, "sync-log"));
1116
+ }
1117
+ const query = {};
1118
+ if (params.type !== void 0) query.type = params.type;
1119
+ if (params.status !== void 0) query.status = params.status;
1120
+ if (params.from !== void 0) query.from = params.from;
1121
+ if (params.to !== void 0) query.to = params.to;
1122
+ if (params.limit !== void 0) query.limit = params.limit;
1123
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1124
+ return this._get(this._buildPath("channels", channelId, "sync-log"), query);
1125
+ }
1126
+ // ---------------------------------------------------------------------------
1127
+ // iCal import/export
1128
+ // ---------------------------------------------------------------------------
1129
+ /** Import availability from an external iCal feed */
1130
+ icalImport(input) {
1131
+ return this._post(this._buildPath("ical", "import"), input);
1132
+ }
1133
+ /** Get iCal export URL for a space */
1134
+ icalExport(spaceId) {
1135
+ return this._get(this._buildPath("ical", "export", spaceId));
1136
+ }
1137
+ };
1138
+
1139
+ // src/services/finance.ts
1140
+ var FinanceService = class extends BaseService {
1141
+ constructor() {
1142
+ super(...arguments);
1143
+ this.basePath = "/finance/v1";
1144
+ }
1145
+ // ---------------------------------------------------------------------------
1146
+ // Folio CRUD and lifecycle
1147
+ // ---------------------------------------------------------------------------
1148
+ /** Create a new folio for a booking */
1149
+ createFolio(input) {
1150
+ return this._post(this._buildPath("folios"), input);
1151
+ }
1152
+ /** Get a folio by ID */
1153
+ getFolio(folioId) {
1154
+ return this._get(this._buildPath("folios", folioId));
1155
+ }
1156
+ /** List folios with optional filters */
1157
+ listFolios(params) {
1158
+ if (!params) return this._get(this._buildPath("folios"));
1159
+ const query = {};
1160
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1161
+ if (params.guestId !== void 0) query.guestId = params.guestId;
1162
+ if (params.status !== void 0) query.status = params.status;
1163
+ if (params.limit !== void 0) query.limit = params.limit;
1164
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1165
+ return this._get(this._buildPath("folios"), query);
1166
+ }
1167
+ /** Update a folio */
1168
+ updateFolio(folioId, input) {
1169
+ return this._patch(this._buildPath("folios", folioId), input);
1170
+ }
1171
+ /** Close a folio (no more charges can be added) */
1172
+ closeFolio(folioId) {
1173
+ return this._post(this._buildPath("folios", folioId, "close"), {});
1174
+ }
1175
+ /** Settle a folio (mark as fully paid) */
1176
+ settleFolio(folioId) {
1177
+ return this._post(this._buildPath("folios", folioId, "settle"), {});
1178
+ }
1179
+ // ---------------------------------------------------------------------------
1180
+ // Charge operations
1181
+ // ---------------------------------------------------------------------------
1182
+ /** Create a charge on a folio */
1183
+ createCharge(folioId, input) {
1184
+ return this._post(this._buildPath("folios", folioId, "charges"), input);
1185
+ }
1186
+ /** List charges on a folio */
1187
+ listCharges(folioId, params) {
1188
+ if (!params) {
1189
+ return this._get(this._buildPath("folios", folioId, "charges"));
1190
+ }
1191
+ const query = {};
1192
+ if (params.type !== void 0) query.type = params.type;
1193
+ if (params.limit !== void 0) query.limit = params.limit;
1194
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1195
+ return this._get(this._buildPath("folios", folioId, "charges"), query);
1196
+ }
1197
+ /** Create a transitory (non-billable) charge on a folio */
1198
+ createTransitoryCharge(folioId, input) {
1199
+ return this._post(
1200
+ this._buildPath("folios", folioId, "charges", "transitory"),
1201
+ input
1202
+ );
1203
+ }
1204
+ /** Move charges from one folio to another */
1205
+ moveCharges(folioId, input) {
1206
+ return this._post(
1207
+ this._buildPath("folios", folioId, "charges", "move"),
1208
+ input
1209
+ );
1210
+ }
1211
+ // ---------------------------------------------------------------------------
1212
+ // Folio payment operations
1213
+ // ---------------------------------------------------------------------------
1214
+ /** Record a payment on a folio */
1215
+ createFolioPayment(folioId, input) {
1216
+ return this._post(this._buildPath("folios", folioId, "payments"), input);
1217
+ }
1218
+ /** List payments on a folio */
1219
+ listFolioPayments(folioId, params) {
1220
+ if (!params) {
1221
+ return this._get(this._buildPath("folios", folioId, "payments"));
1222
+ }
1223
+ const query = {};
1224
+ if (params.limit !== void 0) query.limit = params.limit;
1225
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1226
+ return this._get(this._buildPath("folios", folioId, "payments"), query);
1227
+ }
1228
+ // ---------------------------------------------------------------------------
1229
+ // Invoice operations
1230
+ // ---------------------------------------------------------------------------
1231
+ /** Generate an invoice for a folio */
1232
+ generateInvoice(folioId, input) {
1233
+ return this._post(this._buildPath("folios", folioId, "invoice"), input ?? {});
1234
+ }
1235
+ /** Get an invoice by ID */
1236
+ getInvoice(invoiceId) {
1237
+ return this._get(this._buildPath("invoices", invoiceId));
1238
+ }
1239
+ /** Get invoice as PDF binary data */
1240
+ getInvoicePdf(invoiceId) {
1241
+ return this._get(this._buildPath("invoices", invoiceId, "pdf"));
1242
+ }
1243
+ // ---------------------------------------------------------------------------
1244
+ // Accounting reports
1245
+ // ---------------------------------------------------------------------------
1246
+ /** Get daily accounting report */
1247
+ getDailyReport(params) {
1248
+ if (!params) return this._get(this._buildPath("accounting", "daily"));
1249
+ const query = {};
1250
+ if (params.date !== void 0) query.date = params.date;
1251
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1252
+ return this._get(this._buildPath("accounting", "daily"), query);
1253
+ }
1254
+ /** Get revenue report by charge type */
1255
+ getRevenueReport(params) {
1256
+ if (!params)
1257
+ return this._get(this._buildPath("accounting", "revenue"));
1258
+ const query = {};
1259
+ if (params.from !== void 0) query.from = params.from;
1260
+ if (params.to !== void 0) query.to = params.to;
1261
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1262
+ return this._get(this._buildPath("accounting", "revenue"), query);
1263
+ }
1264
+ /** Get VAT accounting report */
1265
+ getVatReport(params) {
1266
+ if (!params) return this._get(this._buildPath("accounting", "vat"));
1267
+ const query = {};
1268
+ if (params.from !== void 0) query.from = params.from;
1269
+ if (params.to !== void 0) query.to = params.to;
1270
+ if (params.propertyId !== void 0) query.propertyId = params.propertyId;
1271
+ return this._get(this._buildPath("accounting", "vat"), query);
1272
+ }
1273
+ };
1274
+
1042
1275
  // src/services/guests.ts
1043
1276
  var GuestsService = class extends BaseService {
1044
1277
  constructor() {
@@ -1318,6 +1551,101 @@ var GuestsService = class extends BaseService {
1318
1551
  }
1319
1552
  };
1320
1553
 
1554
+ // src/services/payments.ts
1555
+ var PaymentsService = class extends BaseService {
1556
+ constructor() {
1557
+ super(...arguments);
1558
+ this.basePath = "/payment/v1";
1559
+ }
1560
+ // ---------------------------------------------------------------------------
1561
+ // Process and refund
1562
+ // ---------------------------------------------------------------------------
1563
+ /** Process a payment for a booking */
1564
+ process(input) {
1565
+ return this._post(this._buildPath("payments"), input);
1566
+ }
1567
+ /** Refund a payment (full or partial) */
1568
+ refund(paymentId, input) {
1569
+ return this._post(this._buildPath("payments", paymentId, "refund"), input ?? {});
1570
+ }
1571
+ // ---------------------------------------------------------------------------
1572
+ // Transactions
1573
+ // ---------------------------------------------------------------------------
1574
+ /** Get a transaction by ID */
1575
+ getTransaction(transactionId) {
1576
+ return this._get(this._buildPath("transactions", transactionId));
1577
+ }
1578
+ /** List transactions with optional filters */
1579
+ listTransactions(params) {
1580
+ if (!params) return this._get(this._buildPath("transactions"));
1581
+ const query = {};
1582
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1583
+ if (params.status !== void 0) query.status = params.status;
1584
+ if (params.provider !== void 0) query.provider = params.provider;
1585
+ if (params.type !== void 0) query.type = params.type;
1586
+ if (params.from !== void 0) query.from = params.from;
1587
+ if (params.to !== void 0) query.to = params.to;
1588
+ if (params.limit !== void 0) query.limit = params.limit;
1589
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1590
+ return this._get(this._buildPath("transactions"), query);
1591
+ }
1592
+ // ---------------------------------------------------------------------------
1593
+ // Payment accounts (stored cards)
1594
+ // ---------------------------------------------------------------------------
1595
+ /** Create a payment account (store a card on file) */
1596
+ createAccount(input) {
1597
+ return this._post(this._buildPath("accounts"), input);
1598
+ }
1599
+ /** Get a payment account by ID */
1600
+ getAccount(accountId) {
1601
+ return this._get(this._buildPath("accounts", accountId));
1602
+ }
1603
+ /** List payment accounts with optional filters */
1604
+ listAccounts(params) {
1605
+ if (!params) return this._get(this._buildPath("accounts"));
1606
+ const query = {};
1607
+ if (params.bookingId !== void 0) query.bookingId = params.bookingId;
1608
+ if (params.guestId !== void 0) query.guestId = params.guestId;
1609
+ if (params.status !== void 0) query.status = params.status;
1610
+ if (params.limit !== void 0) query.limit = params.limit;
1611
+ if (params.cursor !== void 0) query.cursor = params.cursor;
1612
+ return this._get(this._buildPath("accounts"), query);
1613
+ }
1614
+ /** Delete a payment account */
1615
+ deleteAccount(accountId) {
1616
+ return this._delete(this._buildPath("accounts", accountId));
1617
+ }
1618
+ // ---------------------------------------------------------------------------
1619
+ // Authorize and capture
1620
+ // ---------------------------------------------------------------------------
1621
+ /** Authorize a hold on a stored card */
1622
+ authorize(accountId, input) {
1623
+ return this._post(this._buildPath("accounts", accountId, "authorize"), input);
1624
+ }
1625
+ /** Capture a previously authorized hold */
1626
+ capture(accountId, input) {
1627
+ return this._post(this._buildPath("accounts", accountId, "capture"), input);
1628
+ }
1629
+ // ---------------------------------------------------------------------------
1630
+ // Terminal operations
1631
+ // ---------------------------------------------------------------------------
1632
+ /** Initiate a POS terminal payment authorization */
1633
+ terminalAuthorize(input) {
1634
+ return this._post(this._buildPath("terminal", "authorize"), input);
1635
+ }
1636
+ // ---------------------------------------------------------------------------
1637
+ // IRIS operations
1638
+ // ---------------------------------------------------------------------------
1639
+ /** Initiate an IRIS instant bank transfer */
1640
+ irisInitiate(input) {
1641
+ return this._post(this._buildPath("iris", "initiate"), input);
1642
+ }
1643
+ /** Get the status of an IRIS transfer */
1644
+ irisStatus(transferId) {
1645
+ return this._get(this._buildPath("iris", transferId));
1646
+ }
1647
+ };
1648
+
1321
1649
  // src/services/properties.ts
1322
1650
  var PropertiesService = class extends BaseService {
1323
1651
  constructor() {
@@ -1547,11 +1875,26 @@ var BookingClient = class {
1547
1875
  this._bookings ?? (this._bookings = new BookingsService(this.httpClient));
1548
1876
  return this._bookings;
1549
1877
  }
1878
+ /** Distribution service — lazy-initialized on first access */
1879
+ get distribution() {
1880
+ this._distribution ?? (this._distribution = new DistributionService(this.httpClient));
1881
+ return this._distribution;
1882
+ }
1883
+ /** Finance service — lazy-initialized on first access */
1884
+ get finance() {
1885
+ this._finance ?? (this._finance = new FinanceService(this.httpClient));
1886
+ return this._finance;
1887
+ }
1550
1888
  /** Guests service — lazy-initialized on first access */
1551
1889
  get guests() {
1552
1890
  this._guests ?? (this._guests = new GuestsService(this.httpClient));
1553
1891
  return this._guests;
1554
1892
  }
1893
+ /** Payments service — lazy-initialized on first access */
1894
+ get payments() {
1895
+ this._payments ?? (this._payments = new PaymentsService(this.httpClient));
1896
+ return this._payments;
1897
+ }
1555
1898
  /** Properties service — lazy-initialized on first access */
1556
1899
  get properties() {
1557
1900
  this._properties ?? (this._properties = new PropertiesService(this.httpClient));
@@ -1684,12 +2027,15 @@ export {
1684
2027
  CategoriesService,
1685
2028
  ConflictError,
1686
2029
  DEFAULT_MODULES,
2030
+ DistributionService,
2031
+ FinanceService,
1687
2032
  ForbiddenError,
1688
2033
  GuestsService,
1689
2034
  HttpClient,
1690
2035
  NotFoundError,
1691
2036
  PROPERTY_MODULES,
1692
2037
  PaymentError,
2038
+ PaymentsService,
1693
2039
  PropertiesService,
1694
2040
  RateLimitError,
1695
2041
  SPACE_STATUSES,