@orchesty/connector-authentica 1.0.0 → 1.0.1
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/package.json +5 -2
- package/package.json +5 -2
- 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,40 +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
|
-
|
|
5
|
-
export const AUTHENTICA_GET_CARRIERS = 'authentica-get-carriers';
|
|
6
|
-
|
|
7
|
-
export class AuthenticaGetCarriers extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return AUTHENTICA_GET_CARRIERS;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto<AuthenticaGetCarriersOutput>> {
|
|
14
|
-
const req = await this.getApplication().getRequestDto(
|
|
15
|
-
dto,
|
|
16
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
17
|
-
HttpMethods.GET,
|
|
18
|
-
'carrier',
|
|
19
|
-
);
|
|
20
|
-
const resp = (await this.getSender().send<Response>(req, [200])).getJsonBody();
|
|
21
|
-
await this.processItems(dto, resp);
|
|
22
|
-
|
|
23
|
-
return dto.setNewJsonData(resp);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
protected async processItems(_dto: ProcessDto, _items: AuthenticaCarrier[]): Promise<void> {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface AuthenticaCarrier {
|
|
32
|
-
id: number;
|
|
33
|
-
name: string;
|
|
34
|
-
branchSupported: boolean;
|
|
35
|
-
branchRequired: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type Response = AuthenticaCarrier[];
|
|
39
|
-
|
|
40
|
-
export type AuthenticaGetCarriersOutput = AuthenticaCarrier[];
|
|
@@ -1,58 +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_GET_ORDER = 'authentica-get-order';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaGetOrder extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_GET_ORDER;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaGetOrderInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaGetOrderOutput>> {
|
|
23
|
-
const data = dto.getJsonData();
|
|
24
|
-
// eslint-disable-next-line
|
|
25
|
-
let id = data.id;
|
|
26
|
-
if (this.dataKey) {
|
|
27
|
-
// eslint-disable-next-line
|
|
28
|
-
id = (data as any)[this.dataKey].id;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const req = await this.getApplication().getRequestDto(
|
|
32
|
-
dto,
|
|
33
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
34
|
-
HttpMethods.GET,
|
|
35
|
-
`order/${id}`,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
39
|
-
|
|
40
|
-
if (this.dataKey) {
|
|
41
|
-
// eslint-disable-next-line
|
|
42
|
-
const data = dto.getJsonData() as any;
|
|
43
|
-
data[this.dataKey] = resp;
|
|
44
|
-
dto.setNewJsonData(data);
|
|
45
|
-
} else {
|
|
46
|
-
dto.setNewJsonData(resp);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return dto as unknown as ProcessDto<AuthenticaGetOrderOutput>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface AuthenticaGetOrderInput {
|
|
55
|
-
id: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type AuthenticaGetOrderOutput = AuthenticaOrder;
|
|
@@ -1,38 +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
|
-
|
|
5
|
-
export const NAME = 'authentica-get-order-status';
|
|
6
|
-
|
|
7
|
-
export default class AuthenticaGetOrderStatus extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto<IOutputItem[]>> {
|
|
14
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
15
|
-
dto,
|
|
16
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
17
|
-
HttpMethods.GET,
|
|
18
|
-
'applinth/order-statuses',
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const response = (await this.getSender().send<IResponse>(
|
|
22
|
-
requestDto.setTimeout(5000),
|
|
23
|
-
[200],
|
|
24
|
-
)).getJsonBody();
|
|
25
|
-
|
|
26
|
-
return dto.setNewJsonData(response.data);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IOutputItem {
|
|
32
|
-
id: string;
|
|
33
|
-
title: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface IResponse {
|
|
37
|
-
data: IOutputItem[];
|
|
38
|
-
}
|
|
@@ -1,58 +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_GET_RECEIPT = 'authentica-get-receipt';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaGetReceipt extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_GET_RECEIPT;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaGetReceiptInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaGetReceiptOutput>> {
|
|
23
|
-
const data = dto.getJsonData();
|
|
24
|
-
// eslint-disable-next-line
|
|
25
|
-
let id = data.id;
|
|
26
|
-
if (this.dataKey) {
|
|
27
|
-
// eslint-disable-next-line
|
|
28
|
-
id = (data as any)[this.dataKey].id;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const req = await this.getApplication().getRequestDto(
|
|
32
|
-
dto,
|
|
33
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
34
|
-
HttpMethods.GET,
|
|
35
|
-
`receipt/${id}`,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
39
|
-
|
|
40
|
-
if (this.dataKey) {
|
|
41
|
-
// eslint-disable-next-line
|
|
42
|
-
const data = dto.getJsonData() as any;
|
|
43
|
-
data[this.dataKey] = resp;
|
|
44
|
-
dto.setNewJsonData(data);
|
|
45
|
-
} else {
|
|
46
|
-
dto.setNewJsonData(resp);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return dto as unknown as ProcessDto<AuthenticaGetReceiptOutput>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface AuthenticaGetReceiptInput {
|
|
55
|
-
id: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type AuthenticaGetReceiptOutput = AuthenticaReceipt;
|
|
@@ -1,41 +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
|
-
|
|
5
|
-
export const NAME = 'authentica-get-shipping-methods';
|
|
6
|
-
|
|
7
|
-
export default class AuthenticaGetShippingMethods extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto<IOutputItem[]>> {
|
|
14
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
15
|
-
dto,
|
|
16
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
17
|
-
HttpMethods.GET,
|
|
18
|
-
'applinth/delivery-methods',
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const response = (await this.getSender().send<IResponse>(
|
|
22
|
-
requestDto.setTimeout(5000),
|
|
23
|
-
[200],
|
|
24
|
-
)).getJsonBody();
|
|
25
|
-
|
|
26
|
-
return dto.setNewJsonData(response.data);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IOutputItem {
|
|
32
|
-
id: string;
|
|
33
|
-
title: string;
|
|
34
|
-
type: string;
|
|
35
|
-
shipper: string;
|
|
36
|
-
serviceType: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface IResponse {
|
|
40
|
-
data: IOutputItem[];
|
|
41
|
-
}
|
|
@@ -1,37 +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
|
-
|
|
5
|
-
export const NAME = 'authentica-post-label';
|
|
6
|
-
|
|
7
|
-
export default class AuthenticaPostLabel extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IInput>> {
|
|
14
|
-
const label = dto.getJsonData();
|
|
15
|
-
|
|
16
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
17
|
-
dto,
|
|
18
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
19
|
-
HttpMethods.POST,
|
|
20
|
-
'applinth/label',
|
|
21
|
-
label,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
await this.getSender().send(requestDto);
|
|
25
|
-
|
|
26
|
-
dto.setNewJsonData(label);
|
|
27
|
-
|
|
28
|
-
return dto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface IInput {
|
|
34
|
-
printcode: string;
|
|
35
|
-
data: string;
|
|
36
|
-
extension: string;
|
|
37
|
-
}
|
|
@@ -1,83 +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
|
-
|
|
5
|
-
export const NAME = 'authentica-post-orders';
|
|
6
|
-
|
|
7
|
-
export default class AuthenticaPutOrders extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
14
|
-
const orders = dto.getJsonData();
|
|
15
|
-
|
|
16
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
17
|
-
dto,
|
|
18
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
19
|
-
HttpMethods.PUT,
|
|
20
|
-
'applinth/orders',
|
|
21
|
-
orders,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
await this.getSender().send<IResponse>(requestDto, { success: 200, stopAndFail: '300-499' });
|
|
25
|
-
|
|
26
|
-
dto.setNewJsonData(orders);
|
|
27
|
-
|
|
28
|
-
return dto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface IOrder {
|
|
34
|
-
id: string;
|
|
35
|
-
orderNumber: string;
|
|
36
|
-
destination: {
|
|
37
|
-
firstName: string;
|
|
38
|
-
lastName: string;
|
|
39
|
-
phone: string;
|
|
40
|
-
email: string;
|
|
41
|
-
company: string;
|
|
42
|
-
address1: string;
|
|
43
|
-
address2: string;
|
|
44
|
-
city: string;
|
|
45
|
-
province: string;
|
|
46
|
-
country: string;
|
|
47
|
-
zip: string;
|
|
48
|
-
};
|
|
49
|
-
deliveryMethod: {
|
|
50
|
-
id: number;
|
|
51
|
-
branchId: string;
|
|
52
|
-
} | null;
|
|
53
|
-
paymentMethod: {
|
|
54
|
-
codAmount: number;
|
|
55
|
-
codCurrency: string;
|
|
56
|
-
} | null;
|
|
57
|
-
price: {
|
|
58
|
-
totalPrice: number;
|
|
59
|
-
currency: string;
|
|
60
|
-
};
|
|
61
|
-
items: {
|
|
62
|
-
sku: string;
|
|
63
|
-
quantity: number;
|
|
64
|
-
unitPrice: number | null;
|
|
65
|
-
}[];
|
|
66
|
-
variableSymbol: string | null;
|
|
67
|
-
application: string;
|
|
68
|
-
orderTags: string[];
|
|
69
|
-
packagingType?: string;
|
|
70
|
-
printDeliveryNote?: boolean;
|
|
71
|
-
packagingInstructions?: {
|
|
72
|
-
message: string;
|
|
73
|
-
packagingInstructionType: string;
|
|
74
|
-
}[];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface IResponse {
|
|
78
|
-
data: IOrder[];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export type IInput = IOrder[];
|
|
82
|
-
|
|
83
|
-
export type IOutput = IInput;
|
|
@@ -1,55 +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
|
-
|
|
5
|
-
export const NAME = 'authentica-put-products';
|
|
6
|
-
|
|
7
|
-
export default class AuthenticaPutProducts extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
14
|
-
const products = dto.getJsonData();
|
|
15
|
-
|
|
16
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
17
|
-
dto,
|
|
18
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
19
|
-
HttpMethods.PUT,
|
|
20
|
-
'applinth/products',
|
|
21
|
-
products,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const response = await this.getSender().send<IResponse>(requestDto, { stopAndFail: '300-499' });
|
|
25
|
-
|
|
26
|
-
dto.setNewJsonData(response.getJsonBody().data);
|
|
27
|
-
|
|
28
|
-
return dto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface IProduct {
|
|
34
|
-
productId: string;
|
|
35
|
-
sku: string;
|
|
36
|
-
name: string;
|
|
37
|
-
englishName: string | null;
|
|
38
|
-
ean: string;
|
|
39
|
-
width: number | null;
|
|
40
|
-
widthUnit: string | null;
|
|
41
|
-
height: number | null;
|
|
42
|
-
heightUnit: string | null;
|
|
43
|
-
length: number | null;
|
|
44
|
-
lengthUnit: string | null;
|
|
45
|
-
weight: number | null;
|
|
46
|
-
weightUnit: string | null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface IResponse {
|
|
50
|
-
data: IProduct[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type IInput = IProduct[];
|
|
54
|
-
|
|
55
|
-
export type IOutput = IInput;
|
|
@@ -1,57 +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_UPDATE_ORDER = 'authentica-update-order';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaUpdateOrder extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_UPDATE_ORDER;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaUpdateOrderInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaUpdateOrderOutput>> {
|
|
23
|
-
// eslint-disable-next-line
|
|
24
|
-
let order: any = dto.getJsonData();
|
|
25
|
-
if (this.dataKey) {
|
|
26
|
-
// eslint-disable-next-line
|
|
27
|
-
order = (order as any)[this.dataKey];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const url = `order/${order.id}`;
|
|
31
|
-
delete order.id;
|
|
32
|
-
|
|
33
|
-
const req = await this.getApplication().getRequestDto(
|
|
34
|
-
dto,
|
|
35
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
36
|
-
HttpMethods.PUT,
|
|
37
|
-
url,
|
|
38
|
-
order,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
42
|
-
if (this.dataKey) {
|
|
43
|
-
// eslint-disable-next-line
|
|
44
|
-
const data = dto.getJsonData() as any;
|
|
45
|
-
data[this.dataKey] = resp;
|
|
46
|
-
dto.setNewJsonData(data);
|
|
47
|
-
} else {
|
|
48
|
-
dto.setNewJsonData(resp);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return dto as unknown as ProcessDto<AuthenticaUpdateOrderOutput>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type AuthenticaUpdateOrderInput = Omit<AuthenticaOrder, 'status' | 'trackingNumbers' | 'trackingUrls'>;
|
|
57
|
-
export type AuthenticaUpdateOrderOutput = AuthenticaOrder;
|
|
@@ -1,58 +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_UPDATE_PRODUCT = 'authentica-update-product';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaUpdateProduct extends AConnector {
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
protected dataKey: string | null = null,
|
|
12
|
-
) {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getName(): string {
|
|
17
|
-
return AUTHENTICA_UPDATE_PRODUCT;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async processAction(
|
|
21
|
-
dto: ProcessDto<AuthenticaUpdateProductInput>,
|
|
22
|
-
): Promise<ProcessDto<AuthenticaUpdateProductOutput>> {
|
|
23
|
-
// eslint-disable-next-line
|
|
24
|
-
let product: any = dto.getJsonData();
|
|
25
|
-
if (this.dataKey) {
|
|
26
|
-
// eslint-disable-next-line
|
|
27
|
-
product = (product as any)[this.dataKey];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const url = `product/${product.id}`;
|
|
31
|
-
delete product.id;
|
|
32
|
-
|
|
33
|
-
const req = await this.getApplication().getRequestDto(
|
|
34
|
-
dto,
|
|
35
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
36
|
-
HttpMethods.PUT,
|
|
37
|
-
url,
|
|
38
|
-
product,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const resp = (await this.getSender().send<AuthenticaProduct>(req)).getJsonBody();
|
|
42
|
-
if (this.dataKey) {
|
|
43
|
-
// eslint-disable-next-line
|
|
44
|
-
const data = dto.getJsonData() as any;
|
|
45
|
-
data[this.dataKey] = resp;
|
|
46
|
-
dto.setNewJsonData(data);
|
|
47
|
-
} else {
|
|
48
|
-
dto.setNewJsonData(resp);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return dto as unknown as ProcessDto<AuthenticaUpdateProductOutput>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type AuthenticaUpdateProductInput = Omit<AuthenticaProduct, 'hasImei' | 'hasLot' | 'hasLotExpiration'>;
|
|
57
|
-
|
|
58
|
-
export type AuthenticaUpdateProductOutput = AuthenticaProduct;
|
|
@@ -1,36 +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_UPDATE_RECEIPT = 'authentica-update-receipt';
|
|
7
|
-
|
|
8
|
-
export default class AuthenticaUpdateReceipt extends AConnector {
|
|
9
|
-
|
|
10
|
-
public getName(): string {
|
|
11
|
-
return AUTHENTICA_UPDATE_RECEIPT;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async processAction(
|
|
15
|
-
dto: ProcessDto<AuthenticaUpdateReceiptInput>,
|
|
16
|
-
): Promise<ProcessDto<AuthenticaUpdateReceiptOutput>> {
|
|
17
|
-
const receipt = dto.getJsonData();
|
|
18
|
-
|
|
19
|
-
const req = await this.getApplication().getRequestDto(
|
|
20
|
-
dto,
|
|
21
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
22
|
-
HttpMethods.PUT,
|
|
23
|
-
`receipt/${receipt.id}`,
|
|
24
|
-
receipt,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const resp = (await this.getSender().send<AuthenticaOrder>(req)).getJsonBody();
|
|
28
|
-
dto.setNewJsonData(resp);
|
|
29
|
-
|
|
30
|
-
return dto as unknown as ProcessDto<AuthenticaUpdateReceiptOutput>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type AuthenticaUpdateReceiptInput = Omit<AuthenticaReceipt, 'status' | 'trackingNumbers' | 'shipments'>;
|
|
36
|
-
export type AuthenticaUpdateReceiptOutput = AuthenticaReceipt;
|
|
@@ -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 { AUTHENTICA_CREATE_ORDER } from '../AuthenticaCreateOrder';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaCreateOrder', () => {
|
|
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.testConnector(AUTHENTICA_CREATE_ORDER);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -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 { AUTHENTICA_CREATE_PRODUCT } from '../AuthenticaCreateProduct';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaCreateProduct', () => {
|
|
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.testConnector(AUTHENTICA_CREATE_PRODUCT);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -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 { AUTHENTICA_CREATE_RECEIPT } from '../AuthenticaCreateReceipt';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaCreateReceipt', () => {
|
|
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.testConnector(AUTHENTICA_CREATE_RECEIPT);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -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 { AUTHENTICA_GET_CARRIERS } from '../AuthenticaGetCarriersConnector';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaGetCarriers', () => {
|
|
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.testConnector(AUTHENTICA_GET_CARRIERS);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -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 { AUTHENTICA_GET_ORDER } from '../AuthenticaGetOrder';
|
|
6
|
-
|
|
7
|
-
let tester: NodeTester;
|
|
8
|
-
|
|
9
|
-
describe('Tests for AuthenticaGetOrder', () => {
|
|
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.testConnector(AUTHENTICA_GET_ORDER);
|
|
21
|
-
});
|
|
22
|
-
});
|