@orchesty/connector-authentica 1.0.0 → 1.0.2
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/Connector/AuthenticaPutOrders.d.ts +1 -0
- package/dist/package.json +5 -3
- package/package.json +5 -3
- package/CHANGELOG.md +0 -12
- package/coverage/clover.xml +0 -413
- package/coverage/coverage-final.json +0 -19
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -161
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/AuthenticaApplication.ts.html +0 -496
- package/coverage/lcov-report/src/Batch/AuthenticaGetStock.ts.html +0 -316
- package/coverage/lcov-report/src/Batch/AuthenticaGetStockAvailable.ts.html +0 -262
- package/coverage/lcov-report/src/Batch/index.html +0 -131
- package/coverage/lcov-report/src/Connector/AuthenticaCreateOrder.ts.html +0 -244
- package/coverage/lcov-report/src/Connector/AuthenticaCreateProduct.ts.html +0 -247
- package/coverage/lcov-report/src/Connector/AuthenticaCreateReceipt.ts.html +0 -244
- package/coverage/lcov-report/src/Connector/AuthenticaGetCarriersConnector.ts.html +0 -205
- package/coverage/lcov-report/src/Connector/AuthenticaGetOrder.ts.html +0 -259
- package/coverage/lcov-report/src/Connector/AuthenticaGetOrderStatus.ts.html +0 -199
- package/coverage/lcov-report/src/Connector/AuthenticaGetReceipt.ts.html +0 -259
- package/coverage/lcov-report/src/Connector/AuthenticaGetShippingMethods.ts.html +0 -208
- package/coverage/lcov-report/src/Connector/AuthenticaPostLabel.ts.html +0 -196
- package/coverage/lcov-report/src/Connector/AuthenticaPutOrders.ts.html +0 -334
- package/coverage/lcov-report/src/Connector/AuthenticaPutProducts.ts.html +0 -250
- package/coverage/lcov-report/src/Connector/AuthenticaUpdateOrder.ts.html +0 -256
- package/coverage/lcov-report/src/Connector/AuthenticaUpdateProduct.ts.html +0 -259
- package/coverage/lcov-report/src/Connector/AuthenticaUpdateReceipt.ts.html +0 -193
- package/coverage/lcov-report/src/Connector/index.html +0 -311
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/test/dataProvider.ts.html +0 -325
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov.info +0 -676
- package/jest.config.js +0 -13
- package/src/AuthenticaApplication.ts +0 -137
- package/src/Batch/AuthenticaGetStock.ts +0 -77
- package/src/Batch/AuthenticaGetStockAvailable.ts +0 -59
- package/src/Batch/__tests__/AuthenticaGetStock.ts +0 -26
- package/src/Batch/__tests__/AuthenticaGetStockAvailable.ts +0 -22
- package/src/Batch/__tests__/Data/AuthenticaGetStock/input.json +0 -6
- package/src/Batch/__tests__/Data/AuthenticaGetStock/mock.json +0 -23
- package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-input.json +0 -6
- package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-mock.json +0 -20
- package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-output.json +0 -13
- package/src/Batch/__tests__/Data/AuthenticaGetStock/output.json +0 -11
- package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/1-mock.json +0 -20
- package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/input.json +0 -6
- package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/mock.json +0 -21
- package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/output.json +0 -14
- package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/output1.json +0 -12
- package/src/Connector/AuthenticaCreateOrder.ts +0 -53
- package/src/Connector/AuthenticaCreateProduct.ts +0 -54
- package/src/Connector/AuthenticaCreateReceipt.ts +0 -53
- package/src/Connector/AuthenticaGetCarriersConnector.ts +0 -40
- package/src/Connector/AuthenticaGetOrder.ts +0 -58
- package/src/Connector/AuthenticaGetOrderStatus.ts +0 -38
- package/src/Connector/AuthenticaGetReceipt.ts +0 -58
- package/src/Connector/AuthenticaGetShippingMethods.ts +0 -41
- package/src/Connector/AuthenticaPostLabel.ts +0 -37
- package/src/Connector/AuthenticaPutOrders.ts +0 -83
- package/src/Connector/AuthenticaPutProducts.ts +0 -55
- package/src/Connector/AuthenticaUpdateOrder.ts +0 -57
- package/src/Connector/AuthenticaUpdateProduct.ts +0 -58
- package/src/Connector/AuthenticaUpdateReceipt.ts +0 -36
- package/src/Connector/__tests__/AuthenticaCreateOrder.ts +0 -22
- package/src/Connector/__tests__/AuthenticaCreateProduct.ts +0 -22
- package/src/Connector/__tests__/AuthenticaCreateReceipt.ts +0 -22
- package/src/Connector/__tests__/AuthenticaGetCarriers.ts +0 -22
- package/src/Connector/__tests__/AuthenticaGetOrder.ts +0 -22
- package/src/Connector/__tests__/AuthenticaGetOrderStatus.ts +0 -36
- package/src/Connector/__tests__/AuthenticaGetReceipt.ts +0 -22
- package/src/Connector/__tests__/AuthenticaGetShippingMethods.ts +0 -22
- package/src/Connector/__tests__/AuthenticaPostLabel.ts +0 -36
- package/src/Connector/__tests__/AuthenticaPutOrders.ts +0 -36
- package/src/Connector/__tests__/AuthenticaPutProducts.ts +0 -36
- package/src/Connector/__tests__/AuthenticaUpdateOrder.ts +0 -22
- package/src/Connector/__tests__/AuthenticaUpdateProduct.ts +0 -22
- package/src/Connector/__tests__/AuthenticaUpdateReceipt.ts +0 -22
- package/src/Connector/__tests__/Data/AuthenticaCreateOrder/input.json +0 -67
- package/src/Connector/__tests__/Data/AuthenticaCreateOrder/mock.json +0 -70
- package/src/Connector/__tests__/Data/AuthenticaCreateOrder/output.json +0 -71
- package/src/Connector/__tests__/Data/AuthenticaCreateProduct/input.json +0 -28
- package/src/Connector/__tests__/Data/AuthenticaCreateProduct/mock.json +0 -28
- package/src/Connector/__tests__/Data/AuthenticaCreateProduct/output.json +0 -29
- package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/input.json +0 -47
- package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/mock.json +0 -51
- package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/output.json +0 -52
- package/src/Connector/__tests__/Data/AuthenticaGetCarriers/input.json +0 -6
- package/src/Connector/__tests__/Data/AuthenticaGetCarriers/mock.json +0 -18
- package/src/Connector/__tests__/Data/AuthenticaGetCarriers/output.json +0 -19
- package/src/Connector/__tests__/Data/AuthenticaGetOrder/input.json +0 -8
- package/src/Connector/__tests__/Data/AuthenticaGetOrder/mock.json +0 -63
- package/src/Connector/__tests__/Data/AuthenticaGetOrder/output.json +0 -64
- package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/input.json +0 -6
- package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/mock.json +0 -12
- package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/output.json +0 -11
- package/src/Connector/__tests__/Data/AuthenticaGetReceipt/input.json +0 -8
- package/src/Connector/__tests__/Data/AuthenticaGetReceipt/mock.json +0 -54
- package/src/Connector/__tests__/Data/AuthenticaGetReceipt/output.json +0 -55
- package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/input.json +0 -6
- package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/mock.json +0 -404
- package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/output.json +0 -403
- package/src/Connector/__tests__/Data/AuthenticaPostLabel/input.json +0 -10
- package/src/Connector/__tests__/Data/AuthenticaPostLabel/mock.json +0 -5
- package/src/Connector/__tests__/Data/AuthenticaPostLabel/output.json +0 -10
- package/src/Connector/__tests__/Data/AuthenticaPutOrders/input.json +0 -43
- package/src/Connector/__tests__/Data/AuthenticaPutOrders/mock.json +0 -44
- package/src/Connector/__tests__/Data/AuthenticaPutOrders/output.json +0 -43
- package/src/Connector/__tests__/Data/AuthenticaPutProducts/input.json +0 -19
- package/src/Connector/__tests__/Data/AuthenticaPutProducts/mock.json +0 -20
- package/src/Connector/__tests__/Data/AuthenticaPutProducts/output.json +0 -19
- package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/input.json +0 -68
- package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/mock.json +0 -70
- package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/output.json +0 -71
- package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/input.json +0 -32
- package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/mock.json +0 -28
- package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/output.json +0 -31
- package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/input.json +0 -45
- package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/mock.json +0 -51
- package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/output.json +0 -52
- package/src/__tests__/AuthenticaApplication.ts +0 -41
- package/src/types/order.ts +0 -40
- package/src/types/product.ts +0 -21
- package/src/types/receipt.ts +0 -30
- package/test/dataProvider.ts +0 -80
- package/tsconfig.json +0 -8
- package/tsconfig.prod.json +0 -13
- package/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import CoreFormsEnum, { getFormName } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
|
|
2
|
-
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
3
|
-
import Field from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field';
|
|
4
|
-
import FieldType from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType';
|
|
5
|
-
import Form from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form';
|
|
6
|
-
import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
|
|
7
|
-
import { ABasicApplication } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
|
|
8
|
-
import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
|
|
9
|
-
import CacheService, { ICacheCallback } from '@orchesty/nodejs-sdk/dist/lib/Cache/CacheService';
|
|
10
|
-
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
11
|
-
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
12
|
-
import { defaultRanges } from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResultCodeRange';
|
|
13
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
14
|
-
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
15
|
-
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
16
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
17
|
-
|
|
18
|
-
export const NAME = 'authentica';
|
|
19
|
-
const AUTHENTICA_SHOP_ID = 'authentica-shop-id';
|
|
20
|
-
const CACHE_KEY = 'authentica_cache_key';
|
|
21
|
-
const LOCK_KEY = 'authentica_lock_key';
|
|
22
|
-
|
|
23
|
-
export default class AuthenticaApplication extends ABasicApplication {
|
|
24
|
-
|
|
25
|
-
public constructor(private readonly cacheService: CacheService) {
|
|
26
|
-
super();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public getName(): string {
|
|
30
|
-
return NAME;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public getPublicName(): string {
|
|
34
|
-
return 'Authentica Fulfillment';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public getDescription(): string {
|
|
38
|
-
return 'Simple solution for outsourcing logistics. In a few simple steps, connect your current e-commerce or accounting solution for automated order processing';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public getLogo(): string {
|
|
42
|
-
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KA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4ADQh0AGhAoANAAwIdABoQ6ADQgEAHgAYEOgA0INABoAGBDgANCHQAaECgA0ADAh0AGhDoANCAQAeABgQ6ADQg0AGgAYEOAA0IdABoQKADQAMCHQAaEOgA0IBAB4AGBDoANCDQAaABgQ4ADQh0AGhAoANAAwIdABoQ6ADQgEAHgAYEOgA0INABoAGBDgANCHQAaECgA0ADAh0AGhDoANCAQAeABgQ6ADQg0AGgAYEOAA0IdABoQKADQAMCHQAaEOgA0IBAB4AGBDoANCDQAaABgQ4ADQh0AGhAoANAAwIdABoQ6ADQgEAHgAYEOgA0INABoAGBDgANCHQAaECgA0ADAh0AGhDoANCAQAeABgQ6ADQg0AGgAYEOAA0IdABoQKADQAMCHQAaEOgA0IBAB4AGBDoANCDQAaABgQ4ADQh0AGhAoANAAwIdABoQ6ADQgEAHgAYEOgA0INABoAGBDgANCHQAaECgA0ADAh0AGhDoANCAQAeABgQ6ADQg0AGgAYEOAA0IdABoQKADQAMCHQAaEOgA0IBAB4AGBDoANCDQAaABgQ4ADQh0AGhAoANAAwIdABoQ6ADQgEAHgAYEOgA0INABoAGBDgANCHQAaECgA0ADAh0AGhDoANCAQAeABgQ6ADQg0AGgAYEOAA0IdABoQKADQAMCHQAaEOgA0IBAB4AGBDoANCDQAaABgQ4A1U3T9BfhFEHh3pA/0gAAAABJRU5ErkJggg==';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public getFormStack(): FormStack {
|
|
46
|
-
const settingsForm = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM));
|
|
47
|
-
const clientId = new Field(FieldType.TEXT, CLIENT_ID, 'Client id');
|
|
48
|
-
const clientSecret = new Field(FieldType.PASSWORD, CLIENT_SECRET, 'Client secret');
|
|
49
|
-
const shopId = new Field(FieldType.TEXT, AUTHENTICA_SHOP_ID, 'Shop ID', undefined, false);
|
|
50
|
-
|
|
51
|
-
settingsForm
|
|
52
|
-
.addField(clientId)
|
|
53
|
-
.addField(clientSecret)
|
|
54
|
-
.addField(shopId);
|
|
55
|
-
return new FormStack().addForm(settingsForm);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
59
|
-
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
60
|
-
return authorizationForm?.[CLIENT_ID] && authorizationForm?.[CLIENT_SECRET];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public async getRequestDto(
|
|
64
|
-
dto: ProcessDto,
|
|
65
|
-
applicationInstall: ApplicationInstall,
|
|
66
|
-
method: HttpMethods,
|
|
67
|
-
_url?: string,
|
|
68
|
-
data?: unknown,
|
|
69
|
-
): Promise<RequestDto> {
|
|
70
|
-
const headers = {
|
|
71
|
-
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
72
|
-
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
73
|
-
[AUTHENTICA_SHOP_ID]: applicationInstall.getUser(),
|
|
74
|
-
[CommonHeaders.AUTHORIZATION]: await this.getAccessToken(dto, applicationInstall),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
let url = _url;
|
|
78
|
-
if (!url?.includes('applinth')) {
|
|
79
|
-
const shopId = applicationInstall.getUser();
|
|
80
|
-
url = `shop/${shopId}/${url}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const req = new RequestDto(`${this.getBaseUrl()}/${url}`, method, dto);
|
|
84
|
-
req.setHeaders(headers);
|
|
85
|
-
|
|
86
|
-
if (data) {
|
|
87
|
-
req.setJsonBody(data);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return req;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
protected getBaseUrl(): string {
|
|
94
|
-
return 'https://app.authentica.cz/api';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected async getAccessToken(processDto: AProcessDto, applicationInstall: ApplicationInstall): Promise<string> {
|
|
98
|
-
const url = `${this.getBaseUrl()}/token`;
|
|
99
|
-
|
|
100
|
-
const clientId = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][CLIENT_ID];
|
|
101
|
-
const clientSecret = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][CLIENT_SECRET];
|
|
102
|
-
|
|
103
|
-
const request = new RequestDto(
|
|
104
|
-
url,
|
|
105
|
-
HttpMethods.POST,
|
|
106
|
-
processDto,
|
|
107
|
-
`grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}&scopes=default applinth`,
|
|
108
|
-
{
|
|
109
|
-
[CommonHeaders.CONTENT_TYPE]: 'application/x-www-form-urlencoded',
|
|
110
|
-
},
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const storedAccessToken = await this.cacheService.entryWithLock<IAccessToken>(
|
|
114
|
-
CACHE_KEY,
|
|
115
|
-
LOCK_KEY,
|
|
116
|
-
request,
|
|
117
|
-
this.accessCallBack.bind(this),
|
|
118
|
-
defaultRanges,
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
return `Bearer ${storedAccessToken.access_token}`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
protected accessCallBack(res: ResponseDto): ICacheCallback<IAccessToken> {
|
|
125
|
-
const token = res.getJsonBody() as IAccessToken;
|
|
126
|
-
return {
|
|
127
|
-
dataToStore: token,
|
|
128
|
-
expire: token.expires_in - 300,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface IAccessToken {
|
|
135
|
-
expires_in: number;
|
|
136
|
-
access_token: string;
|
|
137
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
-
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
4
|
-
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
5
|
-
import { StatusCodes } from 'http-status-codes';
|
|
6
|
-
|
|
7
|
-
export const NAME = 'authentica-get-stock';
|
|
8
|
-
|
|
9
|
-
export default class AuthenticaGetStock extends ABatchNode {
|
|
10
|
-
|
|
11
|
-
public getName(): string {
|
|
12
|
-
return NAME;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
16
|
-
const page = dto.getBatchCursor('1');
|
|
17
|
-
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
18
|
-
const req = await this.getApplication().getRequestDto(
|
|
19
|
-
dto,
|
|
20
|
-
appInstall,
|
|
21
|
-
HttpMethods.GET,
|
|
22
|
-
`applinth/stock?page=${page}&limit=50`,
|
|
23
|
-
);
|
|
24
|
-
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
25
|
-
|
|
26
|
-
if (resp.getResponseCode() === StatusCodes.NO_CONTENT) {
|
|
27
|
-
dto.setStopProcess(ResultCode.DO_NOT_CONTINUE, 'Empty body!');
|
|
28
|
-
return dto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const response = resp.getJsonBody();
|
|
32
|
-
|
|
33
|
-
this.setItemsListToDto(dto, response.data ?? []);
|
|
34
|
-
if (response?.meta?.totalPages === undefined || response.meta.totalPages === null) {
|
|
35
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, 'Response not equal meta.totalPages');
|
|
36
|
-
return dto;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (Number(page) < response.meta.totalPages) {
|
|
40
|
-
dto.setBatchCursor((Number(page) + 1).toString());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return dto;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
protected setItemsListToDto(dto: BatchProcessDto, responseBody: IOutput[]): void {
|
|
47
|
-
dto.setItemList(responseBody);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface IResponse {
|
|
53
|
-
data: IOutput[];
|
|
54
|
-
links: {
|
|
55
|
-
first: string;
|
|
56
|
-
last: string;
|
|
57
|
-
prev?: string | null;
|
|
58
|
-
next?: string | null;
|
|
59
|
-
};
|
|
60
|
-
meta: {
|
|
61
|
-
totalPages: number;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface IOutput {
|
|
66
|
-
sku: string;
|
|
67
|
-
productId: string;
|
|
68
|
-
timestamp: string;
|
|
69
|
-
event: EventEnum;
|
|
70
|
-
inStock?: string;
|
|
71
|
-
inStockDelta?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export enum EventEnum {
|
|
75
|
-
AVAILABLE_STOCK_CHANGE = 'availableStockChange',
|
|
76
|
-
QUARANTINE_STOCK_CHANGE = 'quarantineStockChange',
|
|
77
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
-
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
4
|
-
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
5
|
-
import { StatusCodes } from 'http-status-codes';
|
|
6
|
-
|
|
7
|
-
export const NAME = 'authentica-get-stock-available';
|
|
8
|
-
|
|
9
|
-
export default class AuthenticaGetStockAvailable extends ABatchNode {
|
|
10
|
-
|
|
11
|
-
public getName(): string {
|
|
12
|
-
return NAME;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
16
|
-
const page = dto.getBatchCursor('1');
|
|
17
|
-
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
18
|
-
const req = await this.getApplication().getRequestDto(
|
|
19
|
-
dto,
|
|
20
|
-
appInstall,
|
|
21
|
-
HttpMethods.GET,
|
|
22
|
-
`applinth/stock/available?page=${page}&limit=100`,
|
|
23
|
-
);
|
|
24
|
-
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
25
|
-
|
|
26
|
-
if (resp.getResponseCode() === StatusCodes.NO_CONTENT) {
|
|
27
|
-
dto.setStopProcess(ResultCode.DO_NOT_CONTINUE, 'Empty body!');
|
|
28
|
-
return dto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const response = resp.getJsonBody();
|
|
32
|
-
|
|
33
|
-
this.setItemsListToDto(dto, response.data ?? []);
|
|
34
|
-
|
|
35
|
-
if (Number(page) < response.meta.totalPages) {
|
|
36
|
-
dto.setBatchCursor((Number(page) + 1).toString());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return dto;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
protected setItemsListToDto(dto: BatchProcessDto, responseBody: IOutput[]): void {
|
|
43
|
-
dto.setItemList(responseBody);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface IResponse {
|
|
49
|
-
data: IOutput[];
|
|
50
|
-
meta: {
|
|
51
|
-
totalPages: number;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IOutput {
|
|
56
|
-
sku: string;
|
|
57
|
-
productId: string;
|
|
58
|
-
inStock: number;
|
|
59
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import Redis from '@orchesty/nodejs-sdk/dist/lib/Storage/Redis/Redis';
|
|
3
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
4
|
-
import { initAuthenticaTest } from '../../../test/dataProvider';
|
|
5
|
-
import { NAME as AUTHENTICA_GET_STOCK } from '../AuthenticaGetStock';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaGetStock', () => {
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
tester = new NodeTester(container, __filename);
|
|
12
|
-
await initAuthenticaTest();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
afterAll(async () => {
|
|
16
|
-
await container.get(Redis).close();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('process - ok', async () => {
|
|
20
|
-
await tester.testBatch(AUTHENTICA_GET_STOCK);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('process - nok', async () => {
|
|
24
|
-
await tester.testBatch(AUTHENTICA_GET_STOCK, 'nok');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import Redis from '@orchesty/nodejs-sdk/dist/lib/Storage/Redis/Redis';
|
|
3
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
4
|
-
import { initAuthenticaTest } from '../../../test/dataProvider';
|
|
5
|
-
import { NAME } from '../AuthenticaGetStockAvailable';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Test AuthenticaGetStockAvailable', () => {
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
tester = new NodeTester(container, __filename);
|
|
12
|
-
await initAuthenticaTest();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
afterAll(async () => {
|
|
16
|
-
await container.get(Redis).close();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('process', async () => {
|
|
20
|
-
await tester.testBatch(NAME);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"http": "GET https://app.authentica.cz/api/applinth/stock?page=1&limit=50",
|
|
3
|
-
"code": 200,
|
|
4
|
-
"body": {
|
|
5
|
-
"data": [
|
|
6
|
-
{
|
|
7
|
-
"sku": "01-006",
|
|
8
|
-
"inStock": "23",
|
|
9
|
-
"productId": "1",
|
|
10
|
-
"timestamp": "2023-01-25T00:00:00.000Z"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"links": {
|
|
14
|
-
"first": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
15
|
-
"last": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
16
|
-
"prev": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
17
|
-
"next": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100"
|
|
18
|
-
},
|
|
19
|
-
"meta": {
|
|
20
|
-
"totalPages": 1
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"http": "GET https://app.authentica.cz/api/applinth/stock?page=1&limit=50",
|
|
3
|
-
"code": 200,
|
|
4
|
-
"body": {
|
|
5
|
-
"data": [
|
|
6
|
-
{
|
|
7
|
-
"sku": "01-006",
|
|
8
|
-
"inStock": "23",
|
|
9
|
-
"productId": "1",
|
|
10
|
-
"timestamp": "2023-01-25T00:00:00.000Z"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"links": {
|
|
14
|
-
"first": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
15
|
-
"last": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
16
|
-
"prev": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100",
|
|
17
|
-
"next": "https://app.authentica.cz/api/applinth/stock?page=1&limit=100"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"headers": {
|
|
3
|
-
"result-code": "1006",
|
|
4
|
-
"result-message": "Response not equal meta.totalPages",
|
|
5
|
-
"user": "TestUser"
|
|
6
|
-
},
|
|
7
|
-
"data": [
|
|
8
|
-
{
|
|
9
|
-
"body": "{\"sku\":\"01-006\",\"inStock\":\"23\",\"productId\":\"1\",\"timestamp\":\"2023-01-25T00:00:00.000Z\"}",
|
|
10
|
-
"headers": {}
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"http": "GET https://app.authentica.cz/api/applinth/stock/available?page=2&limit=100",
|
|
3
|
-
"code": 200,
|
|
4
|
-
"body": {
|
|
5
|
-
"data": [
|
|
6
|
-
{
|
|
7
|
-
"sku": "02-006",
|
|
8
|
-
"inStock": 3,
|
|
9
|
-
"productId": "2"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"links": {
|
|
13
|
-
"first": "https://app.authentica.cz/api/applinth/stock/available?page=1&limit=100",
|
|
14
|
-
"last": "https://app.authentica.cz/api/applinth/stock/available?page=2&limit=100"
|
|
15
|
-
},
|
|
16
|
-
"meta": {
|
|
17
|
-
"totalPages": 2
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"http": "GET https://app.authentica.cz/api/applinth/stock/available?page=1&limit=100",
|
|
3
|
-
"code": 200,
|
|
4
|
-
"body": {
|
|
5
|
-
"data": [
|
|
6
|
-
{
|
|
7
|
-
"sku": "01-006",
|
|
8
|
-
"inStock": 23,
|
|
9
|
-
"productId": "1"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"links": {
|
|
13
|
-
"first": "https://app.authentica.cz/api/applinth/stock/available?page=1&limit=100",
|
|
14
|
-
"last": "https://app.authentica.cz/api/applinth/stock/available?page=2&limit=100",
|
|
15
|
-
"next": "https://app.authentica.cz/api/applinth/stock/available?page=2&limit=100"
|
|
16
|
-
},
|
|
17
|
-
"meta": {
|
|
18
|
-
"totalPages": 2
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"headers": {
|
|
3
|
-
"user": "TestUser",
|
|
4
|
-
"cursor": "2",
|
|
5
|
-
"result-code": "1010",
|
|
6
|
-
"result-message": "Message will be used as a iterator with cursor [2]. Data will be send to follower(s)."
|
|
7
|
-
},
|
|
8
|
-
"data": [
|
|
9
|
-
{
|
|
10
|
-
"body": "{\"sku\":\"01-006\",\"inStock\":23,\"productId\":\"1\"}",
|
|
11
|
-
"headers": {}
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
4
|
-
import { AuthenticaOrder } from '../types/order';
|
|
5
|
-
|
|
6
|
-
export const AUTHENTICA_CREATE_ORDER = 'authentica-create-order';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaCreateOrder extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_CREATE_ORDER;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaCreateOrderInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaCreateOrderOutput>> {
|
|
23
|
-
let order = dto.getJsonData();
|
|
24
|
-
if (this.dataKey) {
|
|
25
|
-
// eslint-disable-next-line
|
|
26
|
-
order = (order as any)[this.dataKey];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const req = await this.getApplication().getRequestDto(
|
|
30
|
-
dto,
|
|
31
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
32
|
-
HttpMethods.POST,
|
|
33
|
-
'order',
|
|
34
|
-
order,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
38
|
-
if (this.dataKey) {
|
|
39
|
-
// eslint-disable-next-line
|
|
40
|
-
const data = dto.getJsonData() as any;
|
|
41
|
-
data[this.dataKey] = resp;
|
|
42
|
-
dto.setNewJsonData(data);
|
|
43
|
-
} else {
|
|
44
|
-
dto.setNewJsonData(resp);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return dto as unknown as ProcessDto<AuthenticaCreateOrderOutput>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type AuthenticaCreateOrderInput = Omit<AuthenticaOrder, 'id' | 'status' | 'trackingNumbers' | 'trackingUrls'>;
|
|
53
|
-
export type AuthenticaCreateOrderOutput = AuthenticaOrder;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
4
|
-
import { AuthenticaProduct } from '../types/product';
|
|
5
|
-
|
|
6
|
-
export const AUTHENTICA_CREATE_PRODUCT = 'authentica-create-product';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaCreateProduct extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_CREATE_PRODUCT;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaCreateProductInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaCreateProductOutput>> {
|
|
23
|
-
let product = dto.getJsonData();
|
|
24
|
-
if (this.dataKey) {
|
|
25
|
-
// eslint-disable-next-line
|
|
26
|
-
product = (product as any)[this.dataKey];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const req = await this.getApplication().getRequestDto(
|
|
30
|
-
dto,
|
|
31
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
32
|
-
HttpMethods.POST,
|
|
33
|
-
'product',
|
|
34
|
-
product,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const resp = (await this.getSender().send<AuthenticaProduct>(req)).getJsonBody();
|
|
38
|
-
if (this.dataKey) {
|
|
39
|
-
// eslint-disable-next-line
|
|
40
|
-
const data = dto.getJsonData() as any;
|
|
41
|
-
data[this.dataKey] = resp;
|
|
42
|
-
dto.setNewJsonData(data);
|
|
43
|
-
} else {
|
|
44
|
-
dto.setNewJsonData(resp);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return dto as unknown as ProcessDto<AuthenticaCreateProductOutput>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type AuthenticaCreateProductInput = Omit<AuthenticaProduct, 'id'>;
|
|
53
|
-
|
|
54
|
-
export type AuthenticaCreateProductOutput = AuthenticaProduct;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
4
|
-
import { AuthenticaOrder } from '../types/order';
|
|
5
|
-
|
|
6
|
-
export const AUTHENTICA_CREATE_RECEIPT = 'authentica-create-receipt';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaCreateReceipt extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_CREATE_RECEIPT;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaCreateReceiptInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaCreateReceiptOutput>> {
|
|
23
|
-
let receipt = dto.getJsonData();
|
|
24
|
-
if (this.dataKey) {
|
|
25
|
-
// eslint-disable-next-line
|
|
26
|
-
receipt = (receipt as any)[this.dataKey];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const req = await this.getApplication().getRequestDto(
|
|
30
|
-
dto,
|
|
31
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
32
|
-
HttpMethods.POST,
|
|
33
|
-
'receipt',
|
|
34
|
-
receipt,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
38
|
-
if (this.dataKey) {
|
|
39
|
-
// eslint-disable-next-line
|
|
40
|
-
const data = dto.getJsonData() as any;
|
|
41
|
-
data[this.dataKey] = resp;
|
|
42
|
-
dto.setNewJsonData(data);
|
|
43
|
-
} else {
|
|
44
|
-
dto.setNewJsonData(resp);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return dto as unknown as ProcessDto<AuthenticaCreateReceiptOutput>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type AuthenticaCreateReceiptInput = Omit<AuthenticaReceipt, 'id' | 'status' | 'trackingNumbers' | 'shipments'>;
|
|
53
|
-
export type AuthenticaCreateReceiptOutput = AuthenticaReceipt;
|