@chift/chift-nodejs 1.0.14 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chift/chift-nodejs",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -2,6 +2,7 @@ import { operations, components } from '../types/public-api/schema';
2
2
  import { InternalAPI } from './internalApi';
3
3
  import { chiftOperations } from '../types/public-api/mappings';
4
4
  import { posFactory } from './pos';
5
+ import { pmsFactory } from './pms';
5
6
  import { createApiFor } from '../helpers/openapi';
6
7
  import { accountingFactory } from './accounting';
7
8
  import { invoicingFactory } from './invoicing';
@@ -21,6 +22,7 @@ const Consumer = (
21
22
  const redirect_url = data.redirect_url;
22
23
  const email = data.email;
23
24
  const pos = createApiFor(posFactory, _internalApi, data.name, consumerId);
25
+ const pms = createApiFor(pmsFactory, _internalApi, data.name, consumerId);
24
26
  const accounting = createApiFor(accountingFactory, _internalApi, data.name, consumerId);
25
27
  const invoicing = createApiFor(invoicingFactory, _internalApi, data.name, consumerId);
26
28
  const ecommerce = createApiFor(ecommerceFactory, _internalApi, data.name, consumerId);
@@ -188,6 +190,7 @@ const Consumer = (
188
190
  redirect_url,
189
191
  email,
190
192
  pos,
193
+ pms,
191
194
  accounting,
192
195
  invoicing,
193
196
  ecommerce,
@@ -0,0 +1,67 @@
1
+ import { operations, components } from '../types/public-api/schema';
2
+ import { AutoPaginatedParams, RequestData } from '../types/api';
3
+
4
+ type GetPaymentsParams = AutoPaginatedParams<operations['pms_get_payments']['parameters']['query']>;
5
+
6
+ type GetPaymentMethodsParams = AutoPaginatedParams<
7
+ operations['pms_get_payments_methods']['parameters']['query']
8
+ >;
9
+
10
+ type GetAccountingCategoriesParams = AutoPaginatedParams<
11
+ operations['pms_get_accounting_categories']['parameters']['query']
12
+ >;
13
+
14
+ type GetOrdersParams = AutoPaginatedParams<operations['pms_get_orders']['parameters']['query']>;
15
+
16
+ const pmsFactory = {
17
+ getLocations(): RequestData<components['schemas']['PMSLocationItem'][]> {
18
+ return {
19
+ method: 'get',
20
+ url: '/consumers/{consumer_id}/pms/locations',
21
+ };
22
+ },
23
+ getOrders(params: GetOrdersParams): RequestData<components['schemas']['PMSOrderItem'][]> {
24
+ return {
25
+ params,
26
+ method: 'get',
27
+ url: '/consumers/{consumer_id}/pms/orders',
28
+ };
29
+ },
30
+ getPaymentMethods(
31
+ params?: GetPaymentMethodsParams
32
+ ): RequestData<components['schemas']['PMSPaymentMethods'][]> {
33
+ return {
34
+ params,
35
+ method: 'get',
36
+ url: `/consumers/{consumer_id}/pms/payment-methods`,
37
+ };
38
+ },
39
+ getClosure(
40
+ date: string,
41
+ params?: operations['pms_get_closure']['parameters']['query']
42
+ ): RequestData<components['schemas']['PMSClosureItem']> {
43
+ return {
44
+ params,
45
+ method: 'get',
46
+ url: `/consumers/{consumer_id}/pms/closures/${date}`,
47
+ };
48
+ },
49
+ getPayments(params: GetPaymentsParams): RequestData<components['schemas']['PMSPaymentItem'][]> {
50
+ return {
51
+ params,
52
+ method: 'get',
53
+ url: `/consumers/{consumer_id}/pms/payments`,
54
+ };
55
+ },
56
+ getAccountingCategories(
57
+ params?: GetAccountingCategoriesParams
58
+ ): RequestData<components['schemas']['PMSAccountingCategoryItem'][]> {
59
+ return {
60
+ params,
61
+ method: 'get',
62
+ url: `/consumers/{consumer_id}/pms/accounting-categories`,
63
+ };
64
+ },
65
+ };
66
+
67
+ export { pmsFactory };
@@ -30,7 +30,7 @@ const posFactory = {
30
30
  url: '/consumers/{consumer_id}/pos/locations',
31
31
  };
32
32
  },
33
- getOrders(params: GetOrdersParams): RequestData<components['schemas']['OrderItem'][]> {
33
+ getOrders(params: GetOrdersParams): RequestData<components['schemas']['POSOrderItem'][]> {
34
34
  return {
35
35
  params,
36
36
  method: 'get',
@@ -46,7 +46,7 @@ const posFactory = {
46
46
  url: '/consumers/{consumer_id}/pos/customers',
47
47
  };
48
48
  },
49
- getOrder(orderId: string): RequestData<components['schemas']['OrderItem']> {
49
+ getOrder(orderId: string): RequestData<components['schemas']['POSOrderItem']> {
50
50
  return {
51
51
  method: 'get',
52
52
  url: `/consumers/{consumer_id}/pos/orders/${orderId}`,
@@ -113,7 +113,7 @@ const posFactory = {
113
113
  url: `/consumers/{consumer_id}/pos/closures/${date}`,
114
114
  };
115
115
  },
116
- getPayments(params: GetPaymentsParams): RequestData<components['schemas']['PaymentItem'][]> {
116
+ getPayments(params: GetPaymentsParams): RequestData<components['schemas']['POSPaymentItem'][]> {
117
117
  return {
118
118
  params,
119
119
  method: 'get',
@@ -123,7 +123,7 @@ const posFactory = {
123
123
  updateOrder(
124
124
  orderId: string,
125
125
  order: components['schemas']['UpdateOrderItem']
126
- ): RequestData<components['schemas']['OrderItem']> {
126
+ ): RequestData<components['schemas']['POSOrderItem']> {
127
127
  return {
128
128
  method: 'patch',
129
129
  url: `/consumers/{consumer_id}/pos/orders/${orderId}`,