@chift/chift-nodejs 1.0.18 → 1.0.20
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/src/helpers/openapi.d.ts +3 -0
- package/dist/src/helpers/openapi.js +18 -0
- package/dist/src/helpers/settings.d.ts +4 -0
- package/dist/src/helpers/settings.js +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/modules/accounting.d.ts +68 -0
- package/dist/src/modules/accounting.js +326 -0
- package/dist/src/modules/api.d.ts +18431 -0
- package/dist/src/modules/api.js +36 -0
- package/dist/src/modules/consumer.d.ts +3638 -0
- package/dist/src/modules/consumer.js +142 -0
- package/dist/src/modules/consumers.d.ts +18317 -0
- package/dist/src/modules/consumers.js +51 -0
- package/dist/src/modules/custom.d.ts +8 -0
- package/dist/src/modules/custom.js +36 -0
- package/dist/src/modules/datastores.d.ts +18 -0
- package/dist/src/modules/datastores.js +23 -0
- package/dist/src/modules/ecommerce.d.ts +24 -0
- package/dist/src/modules/ecommerce.js +97 -0
- package/dist/src/modules/flow.d.ts +15 -0
- package/dist/src/modules/flow.js +156 -0
- package/dist/src/modules/integrations.d.ts +23 -0
- package/dist/src/modules/integrations.js +23 -0
- package/dist/src/modules/internalApi.d.ts +24 -0
- package/dist/src/modules/internalApi.js +175 -0
- package/dist/src/modules/invoicing.d.ts +20 -0
- package/dist/src/modules/invoicing.js +90 -0
- package/dist/src/modules/payment.d.ts +14 -0
- package/dist/src/modules/payment.js +41 -0
- package/dist/src/modules/pms.d.ts +15 -0
- package/dist/src/modules/pms.js +47 -0
- package/dist/src/modules/pos.d.ts +26 -0
- package/dist/src/modules/pos.js +101 -0
- package/dist/src/modules/sync.d.ts +14718 -0
- package/dist/src/modules/sync.js +73 -0
- package/dist/src/modules/syncs.d.ts +11 -0
- package/dist/src/modules/syncs.js +39 -0
- package/dist/src/modules/webhooks.d.ts +58 -0
- package/dist/src/modules/webhooks.js +53 -0
- package/{src/types/api.ts → dist/src/types/api.d.ts} +4 -12
- package/dist/src/types/api.js +2 -0
- package/{src/types/consumers.ts → dist/src/types/consumers.d.ts} +0 -1
- package/dist/src/types/consumers.js +2 -0
- package/dist/src/types/public-api/mappings.js +2 -0
- package/dist/src/types/public-api/schema.d.ts +15334 -0
- package/{src/types/sync.ts → dist/src/types/sync.d.ts} +5 -6
- package/dist/src/types/sync.js +2 -0
- package/dist/test/modules/accounting.test.d.ts +1 -0
- package/dist/test/modules/accounting.test.js +590 -0
- package/dist/test/modules/consumer.test.d.ts +1 -0
- package/dist/test/modules/consumer.test.js +89 -0
- package/dist/test/modules/consumers.test.d.ts +1 -0
- package/dist/test/modules/consumers.test.js +109 -0
- package/dist/test/modules/ecommerce.test.d.ts +1 -0
- package/dist/test/modules/ecommerce.test.js +224 -0
- package/dist/test/modules/integrations.test.d.ts +1 -0
- package/dist/test/modules/integrations.test.js +54 -0
- package/dist/test/modules/invoicing.test.d.ts +1 -0
- package/dist/test/modules/invoicing.test.js +115 -0
- package/dist/test/modules/payment.test.d.ts +1 -0
- package/dist/test/modules/payment.test.js +88 -0
- package/dist/test/modules/pms.test.d.ts +1 -0
- package/dist/test/modules/pms.test.js +90 -0
- package/dist/test/modules/pos.test.d.ts +1 -0
- package/dist/test/modules/pos.test.js +179 -0
- package/dist/test/modules/sync.test.d.ts +1 -0
- package/dist/test/modules/sync.test.js +93 -0
- package/dist/test/modules/syncs.test.d.ts +1 -0
- package/dist/test/modules/syncs.test.js +53 -0
- package/dist/test/modules/webhooks.test.d.ts +1 -0
- package/dist/test/modules/webhooks.test.js +120 -0
- package/package.json +3 -2
- package/src/types/public-api/schema.d.ts +50 -10
- /package/{src/types/public-api/mappings.ts → dist/src/types/public-api/mappings.d.ts} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.InternalAPI = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const settings_1 = __importDefault(require("../helpers/settings"));
|
|
18
|
+
class InternalAPI {
|
|
19
|
+
constructor(auth) {
|
|
20
|
+
this.debug = false;
|
|
21
|
+
this.getToken = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
const tokenData = {
|
|
24
|
+
clientId: this.auth.clientId,
|
|
25
|
+
clientSecret: this.auth.clientSecret,
|
|
26
|
+
accountId: this.auth.accountId,
|
|
27
|
+
};
|
|
28
|
+
if (this.auth.envId) {
|
|
29
|
+
tokenData['envId'] = this.auth.envId;
|
|
30
|
+
}
|
|
31
|
+
const res = yield axios_1.default.post(`${this.auth.baseUrl || settings_1.default.BASE_URL}/token`, tokenData);
|
|
32
|
+
this.token = res.data;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
if (axios_1.default.isAxiosError(err)) {
|
|
36
|
+
if (err.response) {
|
|
37
|
+
if (err.response.status === 401) {
|
|
38
|
+
throw new Error('The provided credentials are not correct');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.getPaginationParams = (currPage) => {
|
|
45
|
+
return {
|
|
46
|
+
page: currPage,
|
|
47
|
+
size: 100,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
// add interceptor
|
|
51
|
+
this.auth = auth;
|
|
52
|
+
this.instance = axios_1.default.create({
|
|
53
|
+
baseURL: this.auth.baseUrl || settings_1.default.BASE_URL,
|
|
54
|
+
});
|
|
55
|
+
this.get = this.instance.get;
|
|
56
|
+
this.post = this.instance.post;
|
|
57
|
+
this.patch = this.instance.patch;
|
|
58
|
+
this.delete = this.instance.delete;
|
|
59
|
+
this.instance.interceptors.request.use((config) => {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
if (this.connectionId) {
|
|
63
|
+
config.headers['X-Chift-ConnectionId'] = this.connectionId;
|
|
64
|
+
}
|
|
65
|
+
if (this.integrationId) {
|
|
66
|
+
config.headers['X-Chift-IntegrationId'] = this.integrationId;
|
|
67
|
+
}
|
|
68
|
+
if (this.relatedChainExecutionId) {
|
|
69
|
+
config.headers['X-Chift-RelatedChainExecutionId'] =
|
|
70
|
+
this.relatedChainExecutionId;
|
|
71
|
+
}
|
|
72
|
+
if (this.token) {
|
|
73
|
+
if (((_a = this.token) === null || _a === void 0 ? void 0 : _a.expires_on) < new Date().getTime()) {
|
|
74
|
+
return this.getToken()
|
|
75
|
+
.then(() => {
|
|
76
|
+
var _a;
|
|
77
|
+
config.headers['Authorization'] =
|
|
78
|
+
'Bearer ' + ((_a = this.token) === null || _a === void 0 ? void 0 : _a.access_token);
|
|
79
|
+
return resolve(config);
|
|
80
|
+
})
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
return reject(err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
config.headers['Authorization'] = 'Bearer ' + ((_b = this.token) === null || _b === void 0 ? void 0 : _b.access_token);
|
|
87
|
+
return resolve(config);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return this.getToken()
|
|
92
|
+
.then(() => {
|
|
93
|
+
var _a;
|
|
94
|
+
config.headers['Authorization'] =
|
|
95
|
+
'Bearer ' + ((_a = this.token) === null || _a === void 0 ? void 0 : _a.access_token);
|
|
96
|
+
return resolve(config);
|
|
97
|
+
})
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
return reject(err);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}, function (error) {
|
|
104
|
+
// Do something with request error
|
|
105
|
+
return Promise.reject(error);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
setRelatedChainExecutionId(chainExecutionId) {
|
|
109
|
+
this.relatedChainExecutionId = chainExecutionId;
|
|
110
|
+
}
|
|
111
|
+
makeRequest(requestData) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
try {
|
|
114
|
+
if (this.debug) {
|
|
115
|
+
console.log(`[DEBUG]: Executing operation ${requestData === null || requestData === void 0 ? void 0 : requestData.property} with url ${requestData.url} for consumer: ${requestData.consumerName}`);
|
|
116
|
+
}
|
|
117
|
+
let continuePagination = true;
|
|
118
|
+
let items = [];
|
|
119
|
+
let currentPage = 0;
|
|
120
|
+
while (continuePagination) {
|
|
121
|
+
currentPage++;
|
|
122
|
+
let params = requestData.params || {};
|
|
123
|
+
if (requestData.method === 'get') {
|
|
124
|
+
params = Object.assign(Object.assign({}, params), this.getPaginationParams(currentPage));
|
|
125
|
+
}
|
|
126
|
+
const res = yield this.instance({
|
|
127
|
+
url: requestData.url,
|
|
128
|
+
method: requestData.method,
|
|
129
|
+
params: params,
|
|
130
|
+
data: requestData.body !== undefined ? requestData.body : undefined,
|
|
131
|
+
});
|
|
132
|
+
const { data } = res;
|
|
133
|
+
if (data) {
|
|
134
|
+
if (requestData.method === 'get' && 'total' in data && 'items' in data) {
|
|
135
|
+
if (currentPage * 100 > data.total) {
|
|
136
|
+
continuePagination = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
if (this.debug) {
|
|
141
|
+
console.log(`[DEBUG]: Data received: ${JSON.stringify(data)}`);
|
|
142
|
+
}
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
items = items.concat(data.items);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (this.debug) {
|
|
152
|
+
console.log(`[DEBUG]: Data received: ${JSON.stringify(items)}`);
|
|
153
|
+
}
|
|
154
|
+
return items;
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
if (e.response) {
|
|
158
|
+
if (e.response.data) {
|
|
159
|
+
const error = Object.assign(Object.assign({}, e.response.data), { status_code: e.response.status });
|
|
160
|
+
const fullerror = {
|
|
161
|
+
error,
|
|
162
|
+
consumerId: requestData.consumerId,
|
|
163
|
+
consumerName: requestData.consumerName,
|
|
164
|
+
url: requestData.url,
|
|
165
|
+
};
|
|
166
|
+
//return error as TResponse;
|
|
167
|
+
throw fullerror;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
throw e;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.InternalAPI = InternalAPI;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { components, operations } from '../types/public-api/schema';
|
|
2
|
+
import { AutoPaginatedParams, RequestData } from '../types/api';
|
|
3
|
+
type GetInvoicesParams = AutoPaginatedParams<operations['invoicing_get_invoices']['parameters']['query']>;
|
|
4
|
+
type GetContactsParams = AutoPaginatedParams<operations['invoicing_get_contacts']['parameters']['query']>;
|
|
5
|
+
declare const invoicingFactory: {
|
|
6
|
+
getInvoices(params?: GetInvoicesParams): RequestData<components['schemas']['InvoiceItemOut'][]>;
|
|
7
|
+
getInvoiceById(invoiceId: string, params?: operations['invoicing_get_invoice']['parameters']['query']): RequestData<components['schemas']['InvoiceItemOut']>;
|
|
8
|
+
createInvoice(invoice: components['schemas']['InvoiceItem']): RequestData<components['schemas']['InvoiceItemOut']>;
|
|
9
|
+
getProducts(): RequestData<components['schemas']['ProductItemOut'][]>;
|
|
10
|
+
getProductById(productId: string): RequestData<components['schemas']['ProductItemOut']>;
|
|
11
|
+
createProduct(product: components['schemas']['backbone_common__models__invoicing__ProductItem']): RequestData<components['schemas']['ProductItemOut']>;
|
|
12
|
+
getTaxes(): RequestData<components['schemas']['backbone_common__models__invoicing__VatCode'][]>;
|
|
13
|
+
getTaxById(taxId: string): RequestData<components['schemas']['backbone_common__models__invoicing__VatCode']>;
|
|
14
|
+
getOpportunities(): RequestData<components['schemas']['OpportunityItem'][]>;
|
|
15
|
+
getOpportunitiesById(opportunityId: string): RequestData<components['schemas']['OpportunityItem']>;
|
|
16
|
+
getContacts(params?: GetContactsParams): RequestData<components['schemas']['ContactItemOut'][]>;
|
|
17
|
+
getContactById(contactId: string): RequestData<components['schemas']['ContactItemOut']>;
|
|
18
|
+
createContact(contact: components['schemas']['ContactItemIn']): RequestData<components['schemas']['ContactItemOut']>;
|
|
19
|
+
};
|
|
20
|
+
export { invoicingFactory };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invoicingFactory = void 0;
|
|
4
|
+
const invoicingFactory = {
|
|
5
|
+
getInvoices(params) {
|
|
6
|
+
return {
|
|
7
|
+
method: 'get',
|
|
8
|
+
url: `/consumers/{consumer_id}/invoicing/invoices`,
|
|
9
|
+
params: params,
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
getInvoiceById(invoiceId, params) {
|
|
13
|
+
return {
|
|
14
|
+
method: 'get',
|
|
15
|
+
url: `/consumers/{consumer_id}/invoicing/invoices/${invoiceId}`,
|
|
16
|
+
params: params,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
createInvoice(invoice) {
|
|
20
|
+
return {
|
|
21
|
+
method: 'create',
|
|
22
|
+
url: `/consumers/{consumer_id}/invoicing/invoices`,
|
|
23
|
+
body: invoice,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
getProducts() {
|
|
27
|
+
return {
|
|
28
|
+
method: 'get',
|
|
29
|
+
url: `/consumers/{consumer_id}/invoicing/products`,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
getProductById(productId) {
|
|
33
|
+
return {
|
|
34
|
+
method: 'get',
|
|
35
|
+
url: `/consumers/{consumer_id}/invoicing/products/${productId}`,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
createProduct(product) {
|
|
39
|
+
return {
|
|
40
|
+
method: 'create',
|
|
41
|
+
url: `/consumers/{consumer_id}/invoicing/products`,
|
|
42
|
+
body: product,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
getTaxes() {
|
|
46
|
+
return {
|
|
47
|
+
method: 'get',
|
|
48
|
+
url: `/consumers/{consumer_id}/invoicing/taxes`,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getTaxById(taxId) {
|
|
52
|
+
return {
|
|
53
|
+
method: 'get',
|
|
54
|
+
url: `/consumers/{consumer_id}/invoicing/taxes/${taxId}`,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
getOpportunities() {
|
|
58
|
+
return {
|
|
59
|
+
method: 'get',
|
|
60
|
+
url: `/consumers/{consumer_id}/invoicing/opportunities`,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
getOpportunitiesById(opportunityId) {
|
|
64
|
+
return {
|
|
65
|
+
method: 'get',
|
|
66
|
+
url: `/consumers/{consumer_id}/invoicing/opportunities/${opportunityId}`,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
getContacts(params) {
|
|
70
|
+
return {
|
|
71
|
+
method: 'get',
|
|
72
|
+
url: `/consumers/{consumer_id}/invoicing/contacts`,
|
|
73
|
+
params: params,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
getContactById(contactId) {
|
|
77
|
+
return {
|
|
78
|
+
method: 'get',
|
|
79
|
+
url: `/consumers/{consumer_id}/invoicing/contacts/${contactId}`,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
createContact(contact) {
|
|
83
|
+
return {
|
|
84
|
+
method: 'create',
|
|
85
|
+
url: `/consumers/{consumer_id}/invoicing/contacts`,
|
|
86
|
+
body: contact,
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
exports.invoicingFactory = invoicingFactory;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { operations, components } from '../types/public-api/schema';
|
|
2
|
+
import { AutoPaginatedParams, RequestData } from '../types/api';
|
|
3
|
+
type GetBalancesParams = AutoPaginatedParams<operations['payment_get_balances']['parameters']['query']>;
|
|
4
|
+
type GetPaymentsParams = AutoPaginatedParams<operations['payment_get_payments']['parameters']['query']>;
|
|
5
|
+
type GetTransactionsParams = AutoPaginatedParams<operations['payment_get_transaction']['parameters']['query']>;
|
|
6
|
+
type GetRefundsParams = AutoPaginatedParams<operations['payment_get_refunds']['parameters']['query']>;
|
|
7
|
+
declare const paymentFactory: {
|
|
8
|
+
getPayments(params: GetPaymentsParams): RequestData<components['schemas']['PaymentItemOut'][]>;
|
|
9
|
+
getBalances(params: GetBalancesParams): RequestData<components['schemas']['BalanceItemOut'][]>;
|
|
10
|
+
getTransactions(params: GetTransactionsParams): RequestData<components['schemas']['TransactionItemOut'][]>;
|
|
11
|
+
getPayment(params: operations['payment_get_payment']['parameters']['path']): RequestData<components['schemas']['PaymentItemOut']>;
|
|
12
|
+
getRefunds(params: GetRefundsParams): RequestData<components['schemas']['RefundItemOut'][]>;
|
|
13
|
+
};
|
|
14
|
+
export { paymentFactory };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentFactory = void 0;
|
|
4
|
+
const paymentFactory = {
|
|
5
|
+
getPayments(params) {
|
|
6
|
+
return {
|
|
7
|
+
params,
|
|
8
|
+
method: 'get',
|
|
9
|
+
url: `/consumers/{consumer_id}/payment/payments`,
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
getBalances(params) {
|
|
13
|
+
return {
|
|
14
|
+
params,
|
|
15
|
+
method: 'get',
|
|
16
|
+
url: `/consumers/{consumer_id}/payment/balances`,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
getTransactions(params) {
|
|
20
|
+
return {
|
|
21
|
+
params,
|
|
22
|
+
method: 'get',
|
|
23
|
+
url: `/consumers/{consumer_id}/payment/transactions`,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
getPayment(params) {
|
|
27
|
+
return {
|
|
28
|
+
params,
|
|
29
|
+
method: 'get',
|
|
30
|
+
url: `/consumers/{consumer_id}/payment/payments/{payment_id}`,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getRefunds(params) {
|
|
34
|
+
return {
|
|
35
|
+
params,
|
|
36
|
+
method: 'get',
|
|
37
|
+
url: `/consumers/{consumer_id}/payment/refunds`,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
exports.paymentFactory = paymentFactory;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { operations, components } from '../types/public-api/schema';
|
|
2
|
+
import { AutoPaginatedParams, RequestData } from '../types/api';
|
|
3
|
+
type GetPaymentsParams = AutoPaginatedParams<operations['pms_get_payments']['parameters']['query']>;
|
|
4
|
+
type GetPaymentMethodsParams = AutoPaginatedParams<operations['pms_get_payments_methods']['parameters']['query']>;
|
|
5
|
+
type GetAccountingCategoriesParams = AutoPaginatedParams<operations['pms_get_accounting_categories']['parameters']['query']>;
|
|
6
|
+
type GetOrdersParams = AutoPaginatedParams<operations['pms_get_orders']['parameters']['query']>;
|
|
7
|
+
declare const pmsFactory: {
|
|
8
|
+
getLocations(): RequestData<components['schemas']['PMSLocationItem'][]>;
|
|
9
|
+
getOrders(params: GetOrdersParams): RequestData<components['schemas']['PMSOrderItem'][]>;
|
|
10
|
+
getPaymentMethods(params?: GetPaymentMethodsParams): RequestData<components['schemas']['PMSPaymentMethods'][]>;
|
|
11
|
+
getClosure(date: string, params?: operations['pms_get_closure']['parameters']['query']): RequestData<components['schemas']['PMSClosureItem']>;
|
|
12
|
+
getPayments(params: GetPaymentsParams): RequestData<components['schemas']['PMSPaymentItem'][]>;
|
|
13
|
+
getAccountingCategories(params?: GetAccountingCategoriesParams): RequestData<components['schemas']['PMSAccountingCategoryItem'][]>;
|
|
14
|
+
};
|
|
15
|
+
export { pmsFactory };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pmsFactory = void 0;
|
|
4
|
+
const pmsFactory = {
|
|
5
|
+
getLocations() {
|
|
6
|
+
return {
|
|
7
|
+
method: 'get',
|
|
8
|
+
url: '/consumers/{consumer_id}/pms/locations',
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
getOrders(params) {
|
|
12
|
+
return {
|
|
13
|
+
params,
|
|
14
|
+
method: 'get',
|
|
15
|
+
url: '/consumers/{consumer_id}/pms/orders',
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
getPaymentMethods(params) {
|
|
19
|
+
return {
|
|
20
|
+
params,
|
|
21
|
+
method: 'get',
|
|
22
|
+
url: `/consumers/{consumer_id}/pms/payment-methods`,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
getClosure(date, params) {
|
|
26
|
+
return {
|
|
27
|
+
params,
|
|
28
|
+
method: 'get',
|
|
29
|
+
url: `/consumers/{consumer_id}/pms/closures/${date}`,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
getPayments(params) {
|
|
33
|
+
return {
|
|
34
|
+
params,
|
|
35
|
+
method: 'get',
|
|
36
|
+
url: `/consumers/{consumer_id}/pms/payments`,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
getAccountingCategories(params) {
|
|
40
|
+
return {
|
|
41
|
+
params,
|
|
42
|
+
method: 'get',
|
|
43
|
+
url: `/consumers/{consumer_id}/pms/accounting-categories`,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
exports.pmsFactory = pmsFactory;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { operations, components } from '../types/public-api/schema';
|
|
2
|
+
import { AutoPaginatedParams, RequestData } from '../types/api';
|
|
3
|
+
type GetPaymentsParams = AutoPaginatedParams<operations['pos_get_payments']['parameters']['query']>;
|
|
4
|
+
type GetPaymentMethodsParams = AutoPaginatedParams<operations['pos_get_payments_methods']['parameters']['query']>;
|
|
5
|
+
type GetProductCategoriesParams = AutoPaginatedParams<operations['pos_get_product_categories']['parameters']['query']>;
|
|
6
|
+
type GetProductsParams = AutoPaginatedParams<operations['pos_get_products']['parameters']['query']>;
|
|
7
|
+
type GetCustomersParams = AutoPaginatedParams<operations['pos_get_customers']['parameters']['query']>;
|
|
8
|
+
type GetAccountingCategoriesParams = AutoPaginatedParams<operations['pos_get_accounting_categories']['parameters']['query']>;
|
|
9
|
+
type GetOrdersParams = AutoPaginatedParams<operations['pos_get_orders']['parameters']['query']>;
|
|
10
|
+
declare const posFactory: {
|
|
11
|
+
getLocations(): RequestData<components['schemas']['POSLocationItem'][]>;
|
|
12
|
+
getOrders(params: GetOrdersParams): RequestData<components['schemas']['POSOrderItem'][]>;
|
|
13
|
+
getCustomers(params?: GetCustomersParams): RequestData<components['schemas']['POSCustomerItem'][]>;
|
|
14
|
+
getOrder(orderId: string): RequestData<components['schemas']['POSOrderItem']>;
|
|
15
|
+
getCustomer(customerId: string): RequestData<components['schemas']['POSCustomerItem']>;
|
|
16
|
+
createCustomer(customer: components['schemas']['POSCreateCustomerItem']): RequestData<components['schemas']['POSCustomerItem']>;
|
|
17
|
+
getPaymentMethods(params?: GetPaymentMethodsParams): RequestData<components['schemas']['PaymentMethods'][]>;
|
|
18
|
+
getProductCategories(params?: GetProductCategoriesParams): RequestData<components['schemas']['CategoryItem'][]>;
|
|
19
|
+
getProducts(params?: GetProductsParams): RequestData<components['schemas']['POSProductItem'][]>;
|
|
20
|
+
getSales(params: operations['pos_get_sales']['parameters']['query']): RequestData<components['schemas']['SalesItem']>;
|
|
21
|
+
getClosure(date: string, params?: operations['pos_get_closure']['parameters']['query']): RequestData<components['schemas']['ClosureItem']>;
|
|
22
|
+
getPayments(params: GetPaymentsParams): RequestData<components['schemas']['POSPaymentItem'][]>;
|
|
23
|
+
updateOrder(orderId: string, order: components['schemas']['UpdateOrderItem']): RequestData<components['schemas']['POSOrderItem']>;
|
|
24
|
+
getAccountingCategories(params?: GetAccountingCategoriesParams): RequestData<components['schemas']['AccountingCategoryItem'][]>;
|
|
25
|
+
};
|
|
26
|
+
export { posFactory };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.posFactory = void 0;
|
|
4
|
+
const posFactory = {
|
|
5
|
+
getLocations() {
|
|
6
|
+
return {
|
|
7
|
+
method: 'get',
|
|
8
|
+
url: '/consumers/{consumer_id}/pos/locations',
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
getOrders(params) {
|
|
12
|
+
return {
|
|
13
|
+
params,
|
|
14
|
+
method: 'get',
|
|
15
|
+
url: '/consumers/{consumer_id}/pos/orders',
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
getCustomers(params) {
|
|
19
|
+
return {
|
|
20
|
+
params,
|
|
21
|
+
method: 'get',
|
|
22
|
+
url: '/consumers/{consumer_id}/pos/customers',
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
getOrder(orderId) {
|
|
26
|
+
return {
|
|
27
|
+
method: 'get',
|
|
28
|
+
url: `/consumers/{consumer_id}/pos/orders/${orderId}`,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
getCustomer(customerId) {
|
|
32
|
+
return {
|
|
33
|
+
method: 'get',
|
|
34
|
+
url: `/consumers/{consumer_id}/pos/customers/${customerId}`,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
createCustomer(customer) {
|
|
38
|
+
return {
|
|
39
|
+
method: 'create',
|
|
40
|
+
url: `/consumers/{consumer_id}/pos/customers`,
|
|
41
|
+
body: customer,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
getPaymentMethods(params) {
|
|
45
|
+
return {
|
|
46
|
+
params,
|
|
47
|
+
method: 'get',
|
|
48
|
+
url: `/consumers/{consumer_id}/pos/payment-methods`,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getProductCategories(params) {
|
|
52
|
+
return {
|
|
53
|
+
params,
|
|
54
|
+
method: 'get',
|
|
55
|
+
url: `/consumers/{consumer_id}/pos/product-categories`,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
getProducts(params) {
|
|
59
|
+
return {
|
|
60
|
+
params,
|
|
61
|
+
method: 'get',
|
|
62
|
+
url: `/consumers/{consumer_id}/pos/products`,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
getSales(params) {
|
|
66
|
+
return {
|
|
67
|
+
params,
|
|
68
|
+
method: 'get',
|
|
69
|
+
url: `/consumers/{consumer_id}/pos/sales`,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
getClosure(date, params) {
|
|
73
|
+
return {
|
|
74
|
+
params,
|
|
75
|
+
method: 'get',
|
|
76
|
+
url: `/consumers/{consumer_id}/pos/closures/${date}`,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
getPayments(params) {
|
|
80
|
+
return {
|
|
81
|
+
params,
|
|
82
|
+
method: 'get',
|
|
83
|
+
url: `/consumers/{consumer_id}/pos/payments`,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
updateOrder(orderId, order) {
|
|
87
|
+
return {
|
|
88
|
+
method: 'patch',
|
|
89
|
+
url: `/consumers/{consumer_id}/pos/orders/${orderId}`,
|
|
90
|
+
body: order,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
getAccountingCategories(params) {
|
|
94
|
+
return {
|
|
95
|
+
params,
|
|
96
|
+
method: 'get',
|
|
97
|
+
url: `/consumers/{consumer_id}/pos/accounting-categories`,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
exports.posFactory = posFactory;
|