oneentry 1.0.142 → 1.0.143
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/admins/adminsApi.d.ts +50 -0
- package/dist/admins/adminsApi.js +65 -0
- package/dist/admins/adminsInterfaces.d.ts +98 -0
- package/dist/admins/adminsInterfaces.js +2 -0
- package/dist/admins/adminsSchemas.d.ts +30 -0
- package/dist/admins/adminsSchemas.js +27 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
- package/dist/attribute-sets/attributeSetsApi.js +98 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +185 -0
- package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
- package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
- package/dist/auth-provider/authProviderApi.d.ts +249 -0
- package/dist/auth-provider/authProviderApi.js +354 -0
- package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
- package/dist/auth-provider/authProviderSchemas.js +82 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +412 -0
- package/dist/auth-provider/authProvidersInterfaces.js +2 -0
- package/dist/base/asyncModules.d.ts +80 -0
- package/dist/base/asyncModules.js +448 -0
- package/dist/base/result.d.ts +39 -0
- package/dist/base/result.js +154 -0
- package/dist/base/stateModule.d.ts +41 -0
- package/dist/base/stateModule.js +128 -0
- package/dist/base/syncModules.d.ts +286 -0
- package/dist/base/syncModules.js +716 -0
- package/dist/base/utils.d.ts +197 -0
- package/dist/base/utils.js +2 -0
- package/dist/base/validation.d.ts +118 -0
- package/dist/base/validation.js +132 -0
- package/dist/blocks/blocksApi.d.ts +76 -0
- package/dist/blocks/blocksApi.js +188 -0
- package/dist/blocks/blocksInterfaces.d.ts +168 -0
- package/dist/blocks/blocksInterfaces.js +2 -0
- package/dist/blocks/blocksSchemas.d.ts +195 -0
- package/dist/blocks/blocksSchemas.js +43 -0
- package/dist/discounts/discountsApi.d.ts +56 -0
- package/dist/discounts/discountsApi.js +82 -0
- package/dist/discounts/discountsInterfaces.d.ts +145 -0
- package/dist/discounts/discountsInterfaces.js +2 -0
- package/dist/events/eventsApi.d.ts +60 -0
- package/dist/events/eventsApi.js +97 -0
- package/dist/events/eventsInterfaces.d.ts +87 -0
- package/dist/events/eventsInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
- package/dist/file-uploading/fileUploadingApi.js +129 -0
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +114 -0
- package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
- package/dist/file-uploading/fileUploadingSchemas.js +21 -0
- package/dist/forms/formsApi.d.ts +42 -0
- package/dist/forms/formsApi.js +57 -0
- package/dist/forms/formsInterfaces.d.ts +134 -0
- package/dist/forms/formsInterfaces.js +2 -0
- package/dist/forms/formsSchemas.d.ts +50 -0
- package/dist/forms/formsSchemas.js +31 -0
- package/dist/forms-data/formsDataApi.d.ts +106 -0
- package/dist/forms-data/formsDataApi.js +189 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +522 -0
- package/dist/forms-data/formsDataInterfaces.js +2 -0
- package/dist/forms-data/formsDataSchemas.d.ts +115 -0
- package/dist/forms-data/formsDataSchemas.js +86 -0
- package/dist/general-types/generalTypesApi.d.ts +28 -0
- package/dist/general-types/generalTypesApi.js +38 -0
- package/dist/general-types/generalTypesInterfaces.d.ts +29 -0
- package/dist/general-types/generalTypesInterfaces.js +2 -0
- package/dist/general-types/generalTypesSchemas.d.ts +50 -0
- package/dist/general-types/generalTypesSchemas.js +35 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +103 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +163 -0
- package/dist/integration-collections/integrationCollectionsApi.js +220 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
- package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
- package/dist/locales/localesApi.d.ts +27 -0
- package/dist/locales/localesApi.js +37 -0
- package/dist/locales/localesInterfaces.d.ts +40 -0
- package/dist/locales/localesInterfaces.js +2 -0
- package/dist/locales/localesSchemas.d.ts +32 -0
- package/dist/locales/localesSchemas.js +26 -0
- package/dist/menus/menusApi.d.ts +29 -0
- package/dist/menus/menusApi.js +39 -0
- package/dist/menus/menusInterfaces.d.ts +87 -0
- package/dist/menus/menusInterfaces.js +3 -0
- package/dist/menus/menusSchemas.d.ts +16 -0
- package/dist/menus/menusSchemas.js +28 -0
- package/dist/orders/ordersApi.d.ts +149 -0
- package/dist/orders/ordersApi.js +203 -0
- package/dist/orders/ordersInterfaces.d.ts +520 -0
- package/dist/orders/ordersInterfaces.js +2 -0
- package/dist/orders/ordersSchemas.d.ts +120 -0
- package/dist/orders/ordersSchemas.js +101 -0
- package/dist/pages/pagesApi.d.ts +151 -0
- package/dist/pages/pagesApi.js +390 -0
- package/dist/pages/pagesInterfaces.d.ts +284 -0
- package/dist/pages/pagesInterfaces.js +2 -0
- package/dist/pages/pagesSchemas.d.ts +85 -0
- package/dist/pages/pagesSchemas.js +46 -0
- package/dist/payments/paymentsApi.d.ts +82 -0
- package/dist/payments/paymentsApi.js +121 -0
- package/dist/payments/paymentsInterfaces.d.ts +200 -0
- package/dist/payments/paymentsInterfaces.js +2 -0
- package/dist/payments/paymentsSchemas.d.ts +100 -0
- package/dist/payments/paymentsSchemas.js +65 -0
- package/dist/product-statuses/productStatusesApi.d.ts +47 -0
- package/dist/product-statuses/productStatusesApi.js +70 -0
- package/dist/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/dist/product-statuses/productStatusesInterfaces.js +2 -0
- package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/dist/product-statuses/productStatusesSchemas.js +30 -0
- package/dist/products/productsApi.d.ts +365 -0
- package/dist/products/productsApi.js +459 -0
- package/dist/products/productsInterfaces.d.ts +577 -0
- package/dist/products/productsInterfaces.js +2 -0
- package/dist/products/productsSchemas.d.ts +200 -0
- package/dist/products/productsSchemas.js +98 -0
- package/dist/sitemap/sitemapApi.d.ts +35 -0
- package/dist/sitemap/sitemapApi.js +45 -0
- package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
- package/dist/sitemap/sitemapInterfaces.js +2 -0
- package/dist/system/systemApi.d.ts +43 -0
- package/dist/system/systemApi.js +56 -0
- package/dist/system/systemInterfaces.d.ts +29 -0
- package/dist/system/systemInterfaces.js +2 -0
- package/dist/templates/templatesApi.d.ts +49 -0
- package/dist/templates/templatesApi.js +75 -0
- package/dist/templates/templatesInterfaces.d.ts +67 -0
- package/dist/templates/templatesInterfaces.js +2 -0
- package/dist/templates/templatesSchemas.d.ts +48 -0
- package/dist/templates/templatesSchemas.js +31 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
- package/dist/templates-preview/templatesPreviewApi.js +53 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +119 -0
- package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
- package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
- package/dist/users/usersApi.d.ts +143 -0
- package/dist/users/usersApi.js +171 -0
- package/dist/users/usersInterfaces.d.ts +229 -0
- package/dist/users/usersInterfaces.js +2 -0
- package/dist/users/usersSchemas.d.ts +38 -0
- package/dist/users/usersSchemas.js +28 -0
- package/dist/web-socket/wsApi.d.ts +25 -0
- package/dist/web-socket/wsApi.js +45 -0
- package/dist/web-socket/wsInterfaces.d.ts +16 -0
- package/dist/web-socket/wsInterfaces.js +2 -0
- package/package.json +3 -81
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { AttributeType, IAttributes, IError, ILocalizeInfo, LangType, Types } from '../base/utils';
|
|
2
|
+
import type { IBlockEntity } from '../blocks/blocksInterfaces';
|
|
3
|
+
import type { IFormConfig } from '../forms/formsInterfaces';
|
|
4
|
+
import type { ITemplateEntity } from '../templates/templatesInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* @interface IPagesApi
|
|
7
|
+
* @description This interface defines methods for retrieving and managing pages in the system.
|
|
8
|
+
*/
|
|
9
|
+
interface IPagesApi {
|
|
10
|
+
/**
|
|
11
|
+
* Get all top-level page objects.
|
|
12
|
+
* @handleName getRootPages
|
|
13
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
14
|
+
* @returns {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
15
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
16
|
+
* @description This method gets all top-level page objects.
|
|
17
|
+
*/
|
|
18
|
+
getRootPages(langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
19
|
+
/**
|
|
20
|
+
* Get all page objects with product information as an array.
|
|
21
|
+
* @handleName getPages
|
|
22
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
23
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
|
|
24
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
25
|
+
* @description This method gets all page objects with product information as an array.
|
|
26
|
+
*/
|
|
27
|
+
getPages(langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
28
|
+
/**
|
|
29
|
+
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
30
|
+
* @handleName getPageById
|
|
31
|
+
* @param {number} id - The unique identifier of the page to be fetched. Example: 123.
|
|
32
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
33
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
34
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
35
|
+
* @description This method gets a page object with information about forms, blocks, menus, linked to the page.
|
|
36
|
+
*/
|
|
37
|
+
getPageById(id: number, langCode?: LangType): Promise<IPagesEntity | IError>;
|
|
38
|
+
/**
|
|
39
|
+
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
40
|
+
* @handleName getPageByUrl
|
|
41
|
+
* @param {string} url - Page URL. Example: "about".
|
|
42
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
43
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
44
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
45
|
+
* @description This method gets a page object with information about forms, blocks, menus, linked to the page by URL.
|
|
46
|
+
*/
|
|
47
|
+
getPageByUrl(url: string, langCode?: LangType): Promise<IPagesEntity | IError>;
|
|
48
|
+
/**
|
|
49
|
+
* Get child pages object with information as an array.
|
|
50
|
+
* @handleName getChildPagesByParentUrl
|
|
51
|
+
* @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about".
|
|
52
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
53
|
+
* @returns {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
54
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
+
* @description This method gets child pages object with information as an array.
|
|
56
|
+
*/
|
|
57
|
+
getChildPagesByParentUrl(url: string, langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
58
|
+
/**
|
|
59
|
+
* Get all blocks by page url.
|
|
60
|
+
* @handleName getBlocksByPageUrl
|
|
61
|
+
* @param {string} url - Page URL. Example: "about".
|
|
62
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
63
|
+
* @returns {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
64
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
65
|
+
* @description This method gets all blocks by page url.
|
|
66
|
+
*/
|
|
67
|
+
getBlocksByPageUrl(url: string, langCode?: LangType): Promise<IPositionBlock[] | IError>;
|
|
68
|
+
/**
|
|
69
|
+
* Get settings for the page.
|
|
70
|
+
* @handleName getConfigPageByUrl
|
|
71
|
+
* @param {string} url - Page URL. Example: "about".
|
|
72
|
+
* @returns {IPageConfig} Returns a ConfigPage object with page display settings
|
|
73
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
74
|
+
* @description This method gets settings for the page.
|
|
75
|
+
*/
|
|
76
|
+
getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
|
|
77
|
+
/**
|
|
78
|
+
* Quick search for page objects with limited output.
|
|
79
|
+
* @handleName searchPage
|
|
80
|
+
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
81
|
+
* @param {string} [url] - Optional page URL to filter search results. Example: "catalog".
|
|
82
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
83
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
84
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
85
|
+
* @description This method performs a quick search for page objects with limited output.
|
|
86
|
+
*/
|
|
87
|
+
searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @interface IPageConfig
|
|
91
|
+
* @property {number | null} rowsPerPage - Number of lines per page. Example: 1.
|
|
92
|
+
* @property {number | null} productsPerRow - Number of products per page. Example: 1.
|
|
93
|
+
* @description This interface defines the configuration for pagination in pages, including the number of rows and products displayed per page.
|
|
94
|
+
*/
|
|
95
|
+
interface IPageConfig {
|
|
96
|
+
rowsPerPage: number | null;
|
|
97
|
+
productsPerRow: number | null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @interface IPositionForm
|
|
101
|
+
* @property {number} id - The identifier of the object. Example: 1764.
|
|
102
|
+
* @property {number} version - The version number of the object. Example: 10.
|
|
103
|
+
* @property {string} identifier - The textual identifier for the record field. Example: "catalog".
|
|
104
|
+
* @property {number} attributeSetId - The identifier of the attribute set being used. Example: 0.
|
|
105
|
+
* @property {string} processingType - Type of form processing. Example: "email".
|
|
106
|
+
* @property {ILocalizeInfo} localizeInfos - The name of the page, taking into account localization.
|
|
107
|
+
* @example
|
|
108
|
+
{
|
|
109
|
+
"title": "Blog",
|
|
110
|
+
"menuTitle": "Blog",
|
|
111
|
+
"htmlContent": "",
|
|
112
|
+
"plainContent": ""
|
|
113
|
+
}
|
|
114
|
+
* @property {object} processingData - Form data. Example: {}.
|
|
115
|
+
* @property {number} position - The position of the object. Example: 0.
|
|
116
|
+
* @property {IAttributes[]} attributes - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language).
|
|
117
|
+
* @example
|
|
118
|
+
[
|
|
119
|
+
{
|
|
120
|
+
"type": "list",
|
|
121
|
+
"marker": "list_marker",
|
|
122
|
+
"position": 2,
|
|
123
|
+
"listTitles": [
|
|
124
|
+
{
|
|
125
|
+
"title": "red",
|
|
126
|
+
"value": 1,
|
|
127
|
+
"position": 1,
|
|
128
|
+
"extendedValue": null,
|
|
129
|
+
"extendedValueType": null
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"title": "yellow",
|
|
133
|
+
"value": 2,
|
|
134
|
+
"position": 2,
|
|
135
|
+
"extendedValue": null,
|
|
136
|
+
"extendedValueType": null
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"validators": {},
|
|
140
|
+
"localizeInfos": {
|
|
141
|
+
"title": "l1"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
* @description This interface defines the structure of a position form entity, including its identifiers, attributes, and processing data.
|
|
145
|
+
*/
|
|
146
|
+
interface IPositionForm {
|
|
147
|
+
id: number;
|
|
148
|
+
version: number;
|
|
149
|
+
identifier: string;
|
|
150
|
+
attributeSetId: number;
|
|
151
|
+
processingType: string;
|
|
152
|
+
localizeInfos: ILocalizeInfo;
|
|
153
|
+
processingData: Record<string, any>;
|
|
154
|
+
position: number;
|
|
155
|
+
attributes: IAttributes[] | IAttributes;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @interface IPositionBlock
|
|
159
|
+
* @property {number} id - The identifier of the object. Example: 1.
|
|
160
|
+
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "block".
|
|
161
|
+
* @property {ILocalizeInfo} localizeInfos - The name of the page, taking into account localization.
|
|
162
|
+
* @example
|
|
163
|
+
{
|
|
164
|
+
"title": "Blog",
|
|
165
|
+
"menuTitle": "Blog",
|
|
166
|
+
"htmlContent": "",
|
|
167
|
+
"plainContent": ""
|
|
168
|
+
}
|
|
169
|
+
* @property {number} version - The version number of the object. Example: 0.
|
|
170
|
+
* @property {number} position - The position of the object. Example: 1.
|
|
171
|
+
* @property {string} identifier - The textual identifier for the record field. Example: "product_block".
|
|
172
|
+
* @property {Types} type - Page type. Example: "product".
|
|
173
|
+
* @property {string | null} templateIdentifier - User id of the linked template. Example: null.
|
|
174
|
+
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
175
|
+
* @property {boolean} isSync - Indication of page indexing. Example: false.
|
|
176
|
+
* @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
177
|
+
* @example
|
|
178
|
+
{
|
|
179
|
+
"block-text": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"value": "some text",
|
|
182
|
+
"position": 0,
|
|
183
|
+
"additionalFields": []
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
* @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
|
|
187
|
+
* @property {number} [quantity] - Quantity pages in block. Example: 1.
|
|
188
|
+
* @description This interface defines the structure of a position block entity, including its identifiers, attributes, and visibility.
|
|
189
|
+
*/
|
|
190
|
+
interface IPositionBlock {
|
|
191
|
+
id: number;
|
|
192
|
+
attributeSetIdentifier: string | null;
|
|
193
|
+
localizeInfos: ILocalizeInfo;
|
|
194
|
+
version: number;
|
|
195
|
+
position: number;
|
|
196
|
+
identifier: string;
|
|
197
|
+
type: string;
|
|
198
|
+
templateIdentifier: string | null;
|
|
199
|
+
isVisible: boolean;
|
|
200
|
+
isSync: boolean;
|
|
201
|
+
attributeValues: AttributeType;
|
|
202
|
+
countElementsPerRow?: number;
|
|
203
|
+
quantity?: number;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @interface IPagesEntity
|
|
207
|
+
* @property {number} id - The identifier of the object. Example: 8.
|
|
208
|
+
* @property {number | null} parentId - The id of the parent page, if it contains null, then it is the top-level page. Example: 10.
|
|
209
|
+
* @property {string} pageUrl - Unique page Url. Example: "blog".
|
|
210
|
+
* @property {number} depth - Page nesting depth relative to parentId. Example: 10.
|
|
211
|
+
* @property {ILocalizeInfo} localizeInfos - The name of the page, taking into account localization.
|
|
212
|
+
* @example
|
|
213
|
+
{
|
|
214
|
+
"title": "Blog",
|
|
215
|
+
"menuTitle": "Blog",
|
|
216
|
+
"htmlContent": "",
|
|
217
|
+
"plainContent": ""
|
|
218
|
+
}
|
|
219
|
+
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
220
|
+
* @property {Types} type - Page type. Example: "common_page".
|
|
221
|
+
* @property {string | null} templateIdentifier - User id of the linked template. Example: "template".
|
|
222
|
+
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "page".
|
|
223
|
+
* @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
224
|
+
* @example
|
|
225
|
+
{
|
|
226
|
+
"text": {
|
|
227
|
+
"type": "string",
|
|
228
|
+
"value": "some text",
|
|
229
|
+
"position": 0,
|
|
230
|
+
"additionalFields": []
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
* @property {boolean} isSync - Indication of page indexing. Example: true.
|
|
234
|
+
* @property {object} [template] - Template object. Example: {}.
|
|
235
|
+
* @property {number} [position] - Item number (for sorting). Example: 2.
|
|
236
|
+
* @property {Record<string, number>} [config] - Output settings for catalog pages.
|
|
237
|
+
* @example
|
|
238
|
+
{
|
|
239
|
+
"rowsPerPage": 1,
|
|
240
|
+
"productsPerRow": 1
|
|
241
|
+
}
|
|
242
|
+
* @property {number} [products] - The number of products linked to the page. Example: 0.
|
|
243
|
+
* @property {string} [childrenCount] - Children count. Example: 1.
|
|
244
|
+
* @property {IBlockEntity[] | string[]} [blocks] - blocks.
|
|
245
|
+
* @example
|
|
246
|
+
{
|
|
247
|
+
"id": 4,
|
|
248
|
+
"attributeSetIdentifier": null,
|
|
249
|
+
"title": "Template",
|
|
250
|
+
"generalTypeId": 4,
|
|
251
|
+
"identifier": "template",
|
|
252
|
+
"version": 0,
|
|
253
|
+
"generalTypeName": "catalog_page",
|
|
254
|
+
"attributeValues": {},
|
|
255
|
+
"position": 1
|
|
256
|
+
}
|
|
257
|
+
* @property {Array<IFormConfig>} [moduleFormConfigs] - Module form configurations linked to the page.
|
|
258
|
+
* @property {string} [total] - Total number of products linked to the page. Example: "10".
|
|
259
|
+
* @property {string} [categoryPath] - Category path string. Example: "catalog".
|
|
260
|
+
* @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
|
|
261
|
+
*/
|
|
262
|
+
interface IPagesEntity {
|
|
263
|
+
id: number;
|
|
264
|
+
parentId: number | null;
|
|
265
|
+
pageUrl: string;
|
|
266
|
+
depth: number;
|
|
267
|
+
localizeInfos: ILocalizeInfo;
|
|
268
|
+
isVisible: boolean;
|
|
269
|
+
type: Types;
|
|
270
|
+
templateIdentifier: string | null;
|
|
271
|
+
attributeSetIdentifier: string | null;
|
|
272
|
+
attributeValues: AttributeType;
|
|
273
|
+
moduleFormConfigs?: IFormConfig[];
|
|
274
|
+
isSync: boolean;
|
|
275
|
+
template?: ITemplateEntity;
|
|
276
|
+
blocks?: IBlockEntity[] | string[];
|
|
277
|
+
position?: number;
|
|
278
|
+
config?: Record<string, number>;
|
|
279
|
+
products?: number;
|
|
280
|
+
childrenCount?: string;
|
|
281
|
+
total?: string;
|
|
282
|
+
categoryPath?: string;
|
|
283
|
+
}
|
|
284
|
+
export type { IPageConfig, IPagesApi, IPagesEntity, IPositionBlock, IPositionForm, };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Pages module
|
|
3
|
+
* @description Zod schemas for validating pages-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Page entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export declare const PageEntitySchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
13
|
+
pageUrl: z.ZodString;
|
|
14
|
+
depth: z.ZodNumber;
|
|
15
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
16
|
+
isVisible: z.ZodBoolean;
|
|
17
|
+
type: z.ZodString;
|
|
18
|
+
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
19
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
20
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
21
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
22
|
+
isSync: z.ZodBoolean;
|
|
23
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
24
|
+
blocks: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodArray<z.ZodString>]>>;
|
|
25
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
27
|
+
products: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
childrenCount: z.ZodOptional<z.ZodString>;
|
|
29
|
+
total: z.ZodOptional<z.ZodString>;
|
|
30
|
+
categoryPath: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/**
|
|
33
|
+
* Pages response schema (array of pages)
|
|
34
|
+
*/
|
|
35
|
+
export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
36
|
+
id: z.ZodNumber;
|
|
37
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
38
|
+
pageUrl: z.ZodString;
|
|
39
|
+
depth: z.ZodNumber;
|
|
40
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
41
|
+
isVisible: z.ZodBoolean;
|
|
42
|
+
type: z.ZodString;
|
|
43
|
+
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
44
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
45
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
46
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
47
|
+
isSync: z.ZodBoolean;
|
|
48
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
49
|
+
blocks: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodArray<z.ZodString>]>>;
|
|
50
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
52
|
+
products: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
childrenCount: z.ZodOptional<z.ZodString>;
|
|
54
|
+
total: z.ZodOptional<z.ZodString>;
|
|
55
|
+
categoryPath: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
/**
|
|
58
|
+
* Single page response schema
|
|
59
|
+
*/
|
|
60
|
+
export declare const SinglePageSchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodNumber;
|
|
62
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
63
|
+
pageUrl: z.ZodString;
|
|
64
|
+
depth: z.ZodNumber;
|
|
65
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
66
|
+
isVisible: z.ZodBoolean;
|
|
67
|
+
type: z.ZodString;
|
|
68
|
+
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
69
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
70
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
71
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
72
|
+
isSync: z.ZodBoolean;
|
|
73
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
74
|
+
blocks: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodArray<z.ZodString>]>>;
|
|
75
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
77
|
+
products: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
childrenCount: z.ZodOptional<z.ZodString>;
|
|
79
|
+
total: z.ZodOptional<z.ZodString>;
|
|
80
|
+
categoryPath: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/**
|
|
83
|
+
* Page config schema
|
|
84
|
+
*/
|
|
85
|
+
export declare const PageConfigSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageConfigSchema = exports.SinglePageSchema = exports.PagesResponseSchema = exports.PageEntitySchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validation schemas for Pages module
|
|
6
|
+
* @description Zod schemas for validating pages-related API responses
|
|
7
|
+
*/
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
/**
|
|
10
|
+
* Page entity schema
|
|
11
|
+
* Includes all fields returned by the API
|
|
12
|
+
*/
|
|
13
|
+
exports.PageEntitySchema = zod_1.z.object({
|
|
14
|
+
id: zod_1.z.number(),
|
|
15
|
+
parentId: zod_1.z.number().nullable(),
|
|
16
|
+
pageUrl: zod_1.z.string(),
|
|
17
|
+
depth: zod_1.z.number(),
|
|
18
|
+
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
19
|
+
isVisible: zod_1.z.boolean(),
|
|
20
|
+
type: zod_1.z.string(),
|
|
21
|
+
templateIdentifier: zod_1.z.string().nullable(),
|
|
22
|
+
attributeSetIdentifier: zod_1.z.string().nullable(),
|
|
23
|
+
attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
24
|
+
moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
|
|
25
|
+
isSync: zod_1.z.boolean(),
|
|
26
|
+
template: zod_1.z.any().optional(),
|
|
27
|
+
blocks: zod_1.z.union([zod_1.z.array(zod_1.z.any()), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
28
|
+
position: zod_1.z.number().optional(),
|
|
29
|
+
config: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(),
|
|
30
|
+
products: zod_1.z.number().optional(),
|
|
31
|
+
childrenCount: zod_1.z.string().optional(),
|
|
32
|
+
total: zod_1.z.string().optional(),
|
|
33
|
+
categoryPath: zod_1.z.string().optional(),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Pages response schema (array of pages)
|
|
37
|
+
*/
|
|
38
|
+
exports.PagesResponseSchema = zod_1.z.array(exports.PageEntitySchema);
|
|
39
|
+
/**
|
|
40
|
+
* Single page response schema
|
|
41
|
+
*/
|
|
42
|
+
exports.SinglePageSchema = exports.PageEntitySchema;
|
|
43
|
+
/**
|
|
44
|
+
* Page config schema
|
|
45
|
+
*/
|
|
46
|
+
exports.PageConfigSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any());
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IAccountsEntity, ICreateSessionEntity, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with payments
|
|
7
|
+
* @handle /api/content/payments
|
|
8
|
+
* @description Controllers for working with payments
|
|
9
|
+
*/
|
|
10
|
+
export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param {StateModule} state - StateModule instance
|
|
16
|
+
* @description Constructor initializes the PaymentsApi with a given state.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
19
|
+
/**
|
|
20
|
+
* Get list of payment sessions.
|
|
21
|
+
* @handleName getSessions
|
|
22
|
+
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
23
|
+
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
24
|
+
* @returns {Promise<ISessionsEntity | IError>} Returns an array of SessionEntity objects.
|
|
25
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
|
+
* @description This method gets list of payment sessions. This method requires user authorization.
|
|
27
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
28
|
+
*/
|
|
29
|
+
getSessions(offset?: number, limit?: number): Promise<ISessionsEntity | IError>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a single payment session object by its identifier.
|
|
32
|
+
* @handleName getSessionById
|
|
33
|
+
* @param {number} id - Identifier of the retrieved payment session object. Example: 12345.
|
|
34
|
+
* @returns {Promise<ISessionEntity | IError>} Returns a single payment session object.
|
|
35
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
36
|
+
* @description This method gets a single payment session object by its identifier. This method requires user authorization.
|
|
37
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
38
|
+
*/
|
|
39
|
+
getSessionById(id: number): Promise<ISessionEntity | IError>;
|
|
40
|
+
/**
|
|
41
|
+
* Get one payment session object by order identifier
|
|
42
|
+
* @handleName getSessionByOrderId
|
|
43
|
+
* @param {number} id - Order identifier. Example: 12345.
|
|
44
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
45
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
46
|
+
* @description This method gets one payment session object by order identifier. This method requires user authorization.
|
|
47
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
48
|
+
*/
|
|
49
|
+
getSessionByOrderId(id: number): Promise<ISessionEntity | ISessionEntity[] | IError>;
|
|
50
|
+
/**
|
|
51
|
+
* Creation of payment session.
|
|
52
|
+
* @handleName createSession
|
|
53
|
+
* @param {number} orderId - Order identifier. Example: 12345.
|
|
54
|
+
* @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: 'session'.
|
|
55
|
+
* @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
|
|
56
|
+
* @returns {Promise<ICreateSessionEntity | IError>} Returns a single payment session object.
|
|
57
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
58
|
+
* @description This method creates a payment session. This method requires user authorization.
|
|
59
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
60
|
+
*/
|
|
61
|
+
createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
|
|
62
|
+
/**
|
|
63
|
+
* Get all payment accounts as an array.
|
|
64
|
+
* @handleName getAccounts
|
|
65
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
|
|
66
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
67
|
+
* @description This method gets all payment accounts as an array. This method requires user authorization.
|
|
68
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
69
|
+
*/
|
|
70
|
+
getAccounts(): Promise<IAccountsEntity[] | IError>;
|
|
71
|
+
/**
|
|
72
|
+
* Get a single payment account object by its identifier.
|
|
73
|
+
* @handleName getAccountById
|
|
74
|
+
* @param {number} id - Identifier of the retrieved payment account object. Example: 12345.
|
|
75
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
76
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
77
|
+
* @description Get a single payment account object by its identifier.
|
|
78
|
+
* @description This method requires user authorization.
|
|
79
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
80
|
+
*/
|
|
81
|
+
getAccountById(id: number): Promise<IAccountsEntity | IError>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
const paymentsSchemas_1 = require("./paymentsSchemas");
|
|
8
|
+
/**
|
|
9
|
+
* Controllers for working with payments
|
|
10
|
+
* @handle /api/content/payments
|
|
11
|
+
* @description Controllers for working with payments
|
|
12
|
+
*/
|
|
13
|
+
class PaymentsApi extends asyncModules_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param {StateModule} state - StateModule instance
|
|
17
|
+
* @description Constructor initializes the PaymentsApi with a given state.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
this._url = state.url + '/api/content/payments';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get list of payment sessions.
|
|
25
|
+
* @handleName getSessions
|
|
26
|
+
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
27
|
+
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
28
|
+
* @returns {Promise<ISessionsEntity | IError>} Returns an array of SessionEntity objects.
|
|
29
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
30
|
+
* @description This method gets list of payment sessions. This method requires user authorization.
|
|
31
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
32
|
+
*/
|
|
33
|
+
async getSessions(offset = 0, limit = 30) {
|
|
34
|
+
const query = {
|
|
35
|
+
offset,
|
|
36
|
+
limit,
|
|
37
|
+
};
|
|
38
|
+
const result = await this._fetchGet('/sessions/?' + this._queryParamsToString(query));
|
|
39
|
+
// Validate response if validation is enabled
|
|
40
|
+
const validated = this._validateResponse(result, paymentsSchemas_1.PaymentSessionsResponseSchema);
|
|
41
|
+
return validated;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a single payment session object by its identifier.
|
|
45
|
+
* @handleName getSessionById
|
|
46
|
+
* @param {number} id - Identifier of the retrieved payment session object. Example: 12345.
|
|
47
|
+
* @returns {Promise<ISessionEntity | IError>} Returns a single payment session object.
|
|
48
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
49
|
+
* @description This method gets a single payment session object by its identifier. This method requires user authorization.
|
|
50
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
51
|
+
*/
|
|
52
|
+
async getSessionById(id) {
|
|
53
|
+
const result = await this._fetchGet(`/sessions/${id}`);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get one payment session object by order identifier
|
|
58
|
+
* @handleName getSessionByOrderId
|
|
59
|
+
* @param {number} id - Order identifier. Example: 12345.
|
|
60
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
61
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
62
|
+
* @description This method gets one payment session object by order identifier. This method requires user authorization.
|
|
63
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
64
|
+
*/
|
|
65
|
+
async getSessionByOrderId(id) {
|
|
66
|
+
const result = await this._fetchGet(`/sessions/order/${id}`);
|
|
67
|
+
// Validate response if validation is enabled
|
|
68
|
+
const validated = this._validateResponse(result, paymentsSchemas_1.SinglePaymentSessionSchema);
|
|
69
|
+
return validated;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creation of payment session.
|
|
73
|
+
* @handleName createSession
|
|
74
|
+
* @param {number} orderId - Order identifier. Example: 12345.
|
|
75
|
+
* @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: 'session'.
|
|
76
|
+
* @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
|
|
77
|
+
* @returns {Promise<ICreateSessionEntity | IError>} Returns a single payment session object.
|
|
78
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
79
|
+
* @description This method creates a payment session. This method requires user authorization.
|
|
80
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
81
|
+
*/
|
|
82
|
+
async createSession(orderId, type, automaticTaxEnabled = false) {
|
|
83
|
+
const result = await this._fetchPost('/sessions', {
|
|
84
|
+
orderId,
|
|
85
|
+
type,
|
|
86
|
+
automaticTaxEnabled,
|
|
87
|
+
});
|
|
88
|
+
// Validate response if validation is enabled
|
|
89
|
+
const validated = this._validateResponse(result, paymentsSchemas_1.CreateSessionResponseSchema);
|
|
90
|
+
return validated;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get all payment accounts as an array.
|
|
94
|
+
* @handleName getAccounts
|
|
95
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
|
|
96
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
97
|
+
* @description This method gets all payment accounts as an array. This method requires user authorization.
|
|
98
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
99
|
+
*/
|
|
100
|
+
async getAccounts() {
|
|
101
|
+
const result = await this._fetchGet('/accounts');
|
|
102
|
+
// Validate response if validation is enabled
|
|
103
|
+
const validated = this._validateResponse(result, paymentsSchemas_1.PaymentAccountsResponseSchema);
|
|
104
|
+
return this._normalizeData(validated);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get a single payment account object by its identifier.
|
|
108
|
+
* @handleName getAccountById
|
|
109
|
+
* @param {number} id - Identifier of the retrieved payment account object. Example: 12345.
|
|
110
|
+
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
111
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
112
|
+
* @description Get a single payment account object by its identifier.
|
|
113
|
+
* @description This method requires user authorization.
|
|
114
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
115
|
+
*/
|
|
116
|
+
async getAccountById(id) {
|
|
117
|
+
const result = await this._fetchGet(`/accounts/${id}`);
|
|
118
|
+
return this._normalizeData(result);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.default = PaymentsApi;
|