@orchesty/connector-woocommerce 1.0.0 → 2.0.0
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/README.md +102 -0
- package/dist/Connector/WooCommerceGetProductVariant.d.ts +15 -1
- package/dist/Connector/WooCommerceRegisterWebhook.js +1 -0
- package/dist/Connector/WooCommerceUnsubscribeWebhooks.js +5 -1
- package/dist/package.json +7 -5
- package/package.json +6 -4
- package/CHANGELOG.md +0 -12
- package/coverage/clover.xml +0 -404
- package/coverage/coverage-final.json +0 -21
- 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/Batch/WooCommerceGetOrders.ts.html +0 -640
- package/coverage/lcov-report/src/Batch/WooCommerceGetProducts.ts.html +0 -532
- package/coverage/lcov-report/src/Batch/WooCommerceGetVariants.ts.html +0 -433
- package/coverage/lcov-report/src/Batch/index.html +0 -146
- package/coverage/lcov-report/src/Connector/WooCommerceAddNote.ts.html +0 -220
- package/coverage/lcov-report/src/Connector/WooCommerceCreateProduct.ts.html +0 -178
- package/coverage/lcov-report/src/Connector/WooCommerceCreateProductCategory.ts.html +0 -307
- package/coverage/lcov-report/src/Connector/WooCommerceGetOrderNotes.ts.html +0 -274
- package/coverage/lcov-report/src/Connector/WooCommerceGetOrderStatuses.ts.html +0 -175
- package/coverage/lcov-report/src/Connector/WooCommerceGetPaymentGateways.ts.html +0 -295
- package/coverage/lcov-report/src/Connector/WooCommerceGetProduct.ts.html +0 -181
- package/coverage/lcov-report/src/Connector/WooCommerceGetProductVariant.ts.html +0 -496
- package/coverage/lcov-report/src/Connector/WooCommerceGetProductsBySku.ts.html +0 -226
- package/coverage/lcov-report/src/Connector/WooCommerceGetSettingsGeneral.ts.html +0 -238
- package/coverage/lcov-report/src/Connector/WooCommerceGetShippingMethods.ts.html +0 -478
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateOrder.ts.html +0 -193
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProduct.ts.html +0 -199
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProductQuantity.ts.html +0 -220
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProductVariant.ts.html +0 -199
- package/coverage/lcov-report/src/Connector/index.html +0 -326
- package/coverage/lcov-report/src/WooCommerceApplication.ts.html +0 -364
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/test/dataProvider.ts.html +0 -427
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov.info +0 -661
- package/jest.config.js +0 -13
- package/src/Batch/WooCommerceGetOrders.ts +0 -185
- package/src/Batch/WooCommerceGetProducts.ts +0 -149
- package/src/Batch/WooCommerceGetVariants.ts +0 -116
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-input.json +0 -8
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-mock.json +0 -319
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-output.json +0 -16
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/input.json +0 -6
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-input.json +0 -6
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-mock.json +0 -319
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-output.json +0 -15
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/mock.json +0 -319
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/output.json +0 -15
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/input.json +0 -7
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/mock.json +0 -170
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/output.json +0 -11
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-input.json +0 -7
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-mock.json +0 -170
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-output.json +0 -11
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/input.json +0 -169
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/mock.json +0 -160
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/output.json +0 -11
- package/src/Batch/__tests__/WooCommerceGetOrders.ts +0 -42
- package/src/Batch/__tests__/WooCommerceGetProducts.ts +0 -37
- package/src/Batch/__tests__/WooCommerceGetVariants.ts +0 -32
- package/src/Connector/WooCommerceAddNote.ts +0 -45
- package/src/Connector/WooCommerceCreateProduct.ts +0 -31
- package/src/Connector/WooCommerceCreateProductCategory.ts +0 -74
- package/src/Connector/WooCommerceGetOrderNotes.ts +0 -63
- package/src/Connector/WooCommerceGetOrderStatuses.ts +0 -30
- package/src/Connector/WooCommerceGetPaymentGateways.ts +0 -70
- package/src/Connector/WooCommerceGetProduct.ts +0 -32
- package/src/Connector/WooCommerceGetProductVariant.ts +0 -137
- package/src/Connector/WooCommerceGetProductsBySku.ts +0 -47
- package/src/Connector/WooCommerceGetSettingsGeneral.ts +0 -51
- package/src/Connector/WooCommerceGetShippingMethods.ts +0 -131
- package/src/Connector/WooCommerceRegisterWebhook.ts +0 -106
- package/src/Connector/WooCommerceUnsubscribeWebhooks.ts +0 -91
- package/src/Connector/WooCommerceUpdateOrder.ts +0 -36
- package/src/Connector/WooCommerceUpdateProduct.ts +0 -38
- package/src/Connector/WooCommerceUpdateProductQuantity.ts +0 -45
- package/src/Connector/WooCommerceUpdateProductVariant.ts +0 -38
- package/src/Connector/__tests__/Data/WooCommerceAddNote/input.json +0 -11
- package/src/Connector/__tests__/Data/WooCommerceAddNote/mock.json +0 -22
- package/src/Connector/__tests__/Data/WooCommerceAddNote/output.json +0 -23
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/input.json +0 -28
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/mock.json +0 -125
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/output.json +0 -126
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/input.json +0 -11
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/mock.json +0 -36
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/output.json +0 -37
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/input.json +0 -8
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/mock.json +0 -81
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/output.json +0 -82
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/input.json +0 -6
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/mock.json +0 -41
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/output.json +0 -42
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/input.json +0 -6
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/mock.json +0 -350
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/output.json +0 -351
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/input.json +0 -8
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/mock.json +0 -125
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/output.json +0 -126
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/input.json +0 -37
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/mock.json +0 -81
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/mock1.json +0 -81
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-input.json +0 -22
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-mock.json +0 -81
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-output.json +0 -24
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/output.json +0 -37
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/input.json +0 -8
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/mock.json +0 -170
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/output.json +0 -169
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/input.json +0 -6
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/mock.json +0 -3459
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/output.json +0 -3460
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-input.json +0 -8
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-mock.json +0 -30
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-output.json +0 -31
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/input.json +0 -6
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock.json +0 -50
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock1.json +0 -187
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock2.json +0 -187
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/output.json +0 -373
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/input.json +0 -9
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/mock.json +0 -169
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/output.json +0 -170
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/input.json +0 -9
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/mock.json +0 -125
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/output.json +0 -126
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/input.json +0 -20
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/mock.json +0 -162
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/output.json +0 -6
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/input.json +0 -10
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/mock.json +0 -125
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/output.json +0 -126
- package/src/Connector/__tests__/WooCommerceAddNote.ts +0 -18
- package/src/Connector/__tests__/WooCommerceCreateProduct.ts +0 -18
- package/src/Connector/__tests__/WooCommerceCreateProductCategory.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetOrderNotes.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetOrderStatuses.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetPaymentGateways.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetProduct.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetProductVariant.ts +0 -25
- package/src/Connector/__tests__/WooCommerceGetProductsBySku.ts +0 -18
- package/src/Connector/__tests__/WooCommerceGetSettingsGeneral.ts +0 -25
- package/src/Connector/__tests__/WooCommerceGetShippingMethods.ts +0 -18
- package/src/Connector/__tests__/WooCommerceUpdateOrder.ts +0 -18
- package/src/Connector/__tests__/WooCommerceUpdateProduct.ts +0 -18
- package/src/Connector/__tests__/WooCommerceUpdateProductQuantity.ts +0 -18
- package/src/Connector/__tests__/WooCommerceUpdateProductVariant.ts +0 -18
- package/src/WooCommerceApplication.ts +0 -93
- package/test/dataProvider.ts +0 -114
- package/tsconfig.json +0 -8
- package/tsconfig.prod.json +0 -13
- package/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { IProduct } from '@orchesty/connector-authentica/src/Connector/AuthenticaPutProducts';
|
|
2
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
3
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
5
|
-
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
6
|
-
import { checkParams } from '@orchesty/nodejs-sdk/dist/lib/Utils/Validations';
|
|
7
|
-
import { NAME as BASE_NAME } from '../WooCommerceApplication';
|
|
8
|
-
|
|
9
|
-
export const NAME = `${BASE_NAME.toLowerCase()}-get-products-variant`;
|
|
10
|
-
|
|
11
|
-
export default class WooCommerceGetProductVariant extends AConnector {
|
|
12
|
-
|
|
13
|
-
public getName(): string {
|
|
14
|
-
return NAME;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public async processAction(dto: ProcessDto<IInput[]>): Promise<ProcessDto<IOutput>> {
|
|
18
|
-
try {
|
|
19
|
-
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
20
|
-
return dto.setNewJsonData<IOutput>(await Promise.all(dto.getJsonData().map(async (product) => {
|
|
21
|
-
checkParams(product, ['productId', 'id'], true);
|
|
22
|
-
const { productId, id } = product;
|
|
23
|
-
const req = await this.getApplication()
|
|
24
|
-
.getRequestDto(
|
|
25
|
-
dto,
|
|
26
|
-
appInstall,
|
|
27
|
-
HttpMethods.GET,
|
|
28
|
-
`/wp-json/wc/v3/products/${productId}/variations/${id}`,
|
|
29
|
-
);
|
|
30
|
-
const resp = await this.getSender()
|
|
31
|
-
.send<IResponse>(req, [200]);
|
|
32
|
-
const newProduct = product;
|
|
33
|
-
newProduct.sku = resp.getJsonBody().sku;
|
|
34
|
-
delete newProduct.id;
|
|
35
|
-
if (!newProduct.sku) {
|
|
36
|
-
throw Error(`SKU in woocommerce is missing [ProductId=${productId}, Id=${id}]`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return newProduct as IProduct;
|
|
40
|
-
})));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
if (e instanceof Error) {
|
|
43
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, e.message);
|
|
44
|
-
return dto;
|
|
45
|
-
}
|
|
46
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, `Unknown error in ${NAME}`);
|
|
47
|
-
return dto;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IInput extends IProduct {
|
|
54
|
-
id?: number;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type IOutput = IProduct[];
|
|
58
|
-
|
|
59
|
-
interface IResponse {
|
|
60
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
61
|
-
id: number;
|
|
62
|
-
date_created: string;
|
|
63
|
-
date_created_gmt: string;
|
|
64
|
-
date_modified: string;
|
|
65
|
-
date_modified_gmt: string;
|
|
66
|
-
description: string;
|
|
67
|
-
permalink: string;
|
|
68
|
-
sku: string;
|
|
69
|
-
price: string;
|
|
70
|
-
regular_price: string;
|
|
71
|
-
sale_price: string;
|
|
72
|
-
date_on_sale_from: string | null;
|
|
73
|
-
date_on_sale_from_gmt: string | null;
|
|
74
|
-
date_on_sale_to: string | null;
|
|
75
|
-
date_on_sale_to_gmt: string | null;
|
|
76
|
-
on_sale: boolean;
|
|
77
|
-
status: string;
|
|
78
|
-
purchasable: boolean;
|
|
79
|
-
virtual: boolean;
|
|
80
|
-
downloadable: boolean;
|
|
81
|
-
downloads: unknown[];
|
|
82
|
-
download_limit: number;
|
|
83
|
-
download_expiry: number;
|
|
84
|
-
tax_status: string;
|
|
85
|
-
tax_class: string;
|
|
86
|
-
manage_stock: boolean;
|
|
87
|
-
stock_quantity: number | null;
|
|
88
|
-
stock_status: string;
|
|
89
|
-
backorders: string;
|
|
90
|
-
backorders_allowed: boolean;
|
|
91
|
-
backordered: boolean;
|
|
92
|
-
weight: string;
|
|
93
|
-
dimensions: {
|
|
94
|
-
length: string;
|
|
95
|
-
width: string;
|
|
96
|
-
height: string;
|
|
97
|
-
};
|
|
98
|
-
shipping_class: string;
|
|
99
|
-
shipping_class_id: number;
|
|
100
|
-
image: {
|
|
101
|
-
id: number;
|
|
102
|
-
date_created: string;
|
|
103
|
-
date_created_gmt: string;
|
|
104
|
-
date_modified: string;
|
|
105
|
-
date_modified_gmt: string;
|
|
106
|
-
src: string;
|
|
107
|
-
name: string;
|
|
108
|
-
alt: string;
|
|
109
|
-
};
|
|
110
|
-
attributes: [
|
|
111
|
-
{
|
|
112
|
-
id: number;
|
|
113
|
-
name: string;
|
|
114
|
-
option: string;
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
menu_order: number;
|
|
118
|
-
meta_data: unknown[];
|
|
119
|
-
_links: {
|
|
120
|
-
self: [
|
|
121
|
-
{
|
|
122
|
-
href: string;
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
|
-
collection: [
|
|
126
|
-
{
|
|
127
|
-
href: string;
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
up: [
|
|
131
|
-
{
|
|
132
|
-
href: string;
|
|
133
|
-
},
|
|
134
|
-
];
|
|
135
|
-
};
|
|
136
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
137
|
-
}
|
|
@@ -1,47 +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 ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
5
|
-
import { IOutput } from '../Batch/WooCommerceGetProducts';
|
|
6
|
-
|
|
7
|
-
export const NAME = 'woocommerce-get-products-by-sku';
|
|
8
|
-
|
|
9
|
-
export default class WooCommerceGetProductsBySku extends AConnector {
|
|
10
|
-
|
|
11
|
-
public getName(): string {
|
|
12
|
-
return NAME;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IInput | IOutput>> {
|
|
16
|
-
const { sku } = dto.getJsonData();
|
|
17
|
-
|
|
18
|
-
const req = await this.getApplication().getRequestDto(
|
|
19
|
-
dto,
|
|
20
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
21
|
-
HttpMethods.GET,
|
|
22
|
-
`wp-json/wc/v3/products?sku=${sku}`,
|
|
23
|
-
);
|
|
24
|
-
const resp = await this.getSender().send<IOutput[]>(req, [200]);
|
|
25
|
-
|
|
26
|
-
const responseData = resp.getJsonBody();
|
|
27
|
-
if (!responseData.length) {
|
|
28
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, `Product not found [sku=${sku}]`);
|
|
29
|
-
return dto;
|
|
30
|
-
}
|
|
31
|
-
if (responseData.length > 1) {
|
|
32
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, `More than one product found [sku=${sku}]`);
|
|
33
|
-
return dto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return this.setNewJsonData(dto, responseData[0]);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
protected setNewJsonData(dto: ProcessDto, resp: IOutput): ProcessDto<IOutput> {
|
|
40
|
-
return dto.setNewJsonData(resp);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface IInput {
|
|
46
|
-
sku: string;
|
|
47
|
-
}
|
|
@@ -1,51 +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 = 'woo-commerce-get-settings-general';
|
|
6
|
-
|
|
7
|
-
export default class WooCommerceGetSettingsGeneral extends AConnector {
|
|
8
|
-
|
|
9
|
-
public getName(): string {
|
|
10
|
-
return NAME;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput | ISetting>> {
|
|
14
|
-
const { id } = dto.getJsonData();
|
|
15
|
-
|
|
16
|
-
const req = await this.getApplication().getRequestDto(
|
|
17
|
-
dto,
|
|
18
|
-
await this.getApplicationInstallFromProcess(dto, null),
|
|
19
|
-
HttpMethods.GET,
|
|
20
|
-
`wp-json/wc/v3/settings/general/${id ?? ''}`,
|
|
21
|
-
);
|
|
22
|
-
const resp = await this.getSender().send<IOutput>(req, [200]);
|
|
23
|
-
|
|
24
|
-
return dto.setNewJsonData(resp.getJsonBody());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface IInput {
|
|
30
|
-
id?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type IOutput = ISetting[];
|
|
34
|
-
export interface ISetting {
|
|
35
|
-
id: string;
|
|
36
|
-
label: string;
|
|
37
|
-
description: string;
|
|
38
|
-
type: string;
|
|
39
|
-
default: string;
|
|
40
|
-
tip: string;
|
|
41
|
-
value: string;
|
|
42
|
-
_links: {
|
|
43
|
-
self: {
|
|
44
|
-
href: string;
|
|
45
|
-
}[];
|
|
46
|
-
collection: {
|
|
47
|
-
href: string;
|
|
48
|
-
}[];
|
|
49
|
-
};
|
|
50
|
-
options?: Record<string, string>;
|
|
51
|
-
}
|
|
@@ -1,131 +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 WooCommerceApplication, { NAME as BASE_NAME } from '../WooCommerceApplication';
|
|
5
|
-
|
|
6
|
-
export const NAME = `${BASE_NAME.toLowerCase()}-get-shipping-methods`;
|
|
7
|
-
|
|
8
|
-
export default class WooCommerceGetShippingMethods extends AConnector {
|
|
9
|
-
|
|
10
|
-
public getName(): string {
|
|
11
|
-
return NAME;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto<IShippingMethod[]>> {
|
|
15
|
-
const app = this.getApplication<WooCommerceApplication>();
|
|
16
|
-
const appInstall = await this.getApplicationInstallFromProcess(dto, null);
|
|
17
|
-
|
|
18
|
-
const requestDto = app.getRequestDto(
|
|
19
|
-
dto,
|
|
20
|
-
appInstall,
|
|
21
|
-
HttpMethods.GET,
|
|
22
|
-
'wp-json/wc/v3/shipping/zones?per_page=10000',
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const res = await this.getSender().send<IShippingZone[]>(requestDto, [200, 404]);
|
|
26
|
-
const shippingMethods: IShippingMethod[] = [];
|
|
27
|
-
const shippingZones = res.getJsonBody();
|
|
28
|
-
const result = shippingZones.map(async (shippingZone) => {
|
|
29
|
-
const innerRequestDto = app.getRequestDto(
|
|
30
|
-
dto,
|
|
31
|
-
appInstall,
|
|
32
|
-
HttpMethods.GET,
|
|
33
|
-
`wp-json/wc/v3/shipping/zones/${shippingZone.id}/methods?per_page=10000`,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const innerRes = await this.getSender().send<IShippingMethod[]>(innerRequestDto, [200, 404]);
|
|
37
|
-
shippingMethods.push(...innerRes.getJsonBody()
|
|
38
|
-
.filter((shippingMethod) => shippingMethod.enabled)
|
|
39
|
-
.map((shippingMethod) => {
|
|
40
|
-
// eslint-disable-next-line no-param-reassign
|
|
41
|
-
shippingMethod.shipping_zone_title = shippingZone.name;
|
|
42
|
-
|
|
43
|
-
return shippingMethod;
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
46
|
-
await Promise.all(result);
|
|
47
|
-
|
|
48
|
-
return dto.setNewJsonData(shippingMethods);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
54
|
-
export interface IShippingZone {
|
|
55
|
-
id: number;
|
|
56
|
-
name: string;
|
|
57
|
-
order: number;
|
|
58
|
-
_links: {
|
|
59
|
-
self: {
|
|
60
|
-
href: string;
|
|
61
|
-
}[];
|
|
62
|
-
collection: {
|
|
63
|
-
href: string;
|
|
64
|
-
}[];
|
|
65
|
-
describedby: {
|
|
66
|
-
href: string;
|
|
67
|
-
}[];
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface IShippingMethod {
|
|
72
|
-
instance_id: number;
|
|
73
|
-
title: string;
|
|
74
|
-
order: number;
|
|
75
|
-
enabled: boolean;
|
|
76
|
-
method_id: string;
|
|
77
|
-
method_title: string;
|
|
78
|
-
method_description: string;
|
|
79
|
-
settings: {
|
|
80
|
-
title: {
|
|
81
|
-
id: string;
|
|
82
|
-
label: string;
|
|
83
|
-
description: string;
|
|
84
|
-
type: string;
|
|
85
|
-
value: string;
|
|
86
|
-
default: string;
|
|
87
|
-
tip: string;
|
|
88
|
-
placeholder: string;
|
|
89
|
-
};
|
|
90
|
-
requires: {
|
|
91
|
-
id: string;
|
|
92
|
-
label: string;
|
|
93
|
-
description: string;
|
|
94
|
-
type: string;
|
|
95
|
-
value: string;
|
|
96
|
-
default: string;
|
|
97
|
-
tip: string;
|
|
98
|
-
placeholder: string;
|
|
99
|
-
options: {
|
|
100
|
-
coupon: string;
|
|
101
|
-
min_amount: string;
|
|
102
|
-
either: string;
|
|
103
|
-
both: string;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
min_amount: {
|
|
107
|
-
id: string;
|
|
108
|
-
label: string;
|
|
109
|
-
description: string;
|
|
110
|
-
type: string;
|
|
111
|
-
value: string;
|
|
112
|
-
default: string;
|
|
113
|
-
tip: string;
|
|
114
|
-
placeholder: string;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
_links: {
|
|
118
|
-
self: {
|
|
119
|
-
href: string;
|
|
120
|
-
}[];
|
|
121
|
-
collection: {
|
|
122
|
-
href: string;
|
|
123
|
-
}[];
|
|
124
|
-
describes: {
|
|
125
|
-
href: string;
|
|
126
|
-
}[];
|
|
127
|
-
};
|
|
128
|
-
shipping_zone_title?: string;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
2
|
-
import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
|
|
3
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
4
|
-
import TopologyRunner from '@orchesty/nodejs-sdk/dist/lib/Topology/TopologyRunner';
|
|
5
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
6
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
7
|
-
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
8
|
-
import crypto from 'crypto';
|
|
9
|
-
import WooCommerceApplication from '../WooCommerceApplication';
|
|
10
|
-
|
|
11
|
-
const WOOCOMMERCE_REGISTER_WEBHOOK_ENDPOINT = 'wp-json/wc/v3/webhooks/batch';
|
|
12
|
-
|
|
13
|
-
export default class WooCommerceRegisterWebhook extends AConnector {
|
|
14
|
-
|
|
15
|
-
public getName(): string {
|
|
16
|
-
return 'woocommerce-register-webhook';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto> {
|
|
20
|
-
const app = this.getApplication<WooCommerceApplication>();
|
|
21
|
-
|
|
22
|
-
const whData = app.getWebhookSubscriptions().map((sub) => ({
|
|
23
|
-
topic: sub.getName(),
|
|
24
|
-
token: this.getRandomToken(),
|
|
25
|
-
node: sub.getNode(),
|
|
26
|
-
topology: sub.getTopology(),
|
|
27
|
-
}));
|
|
28
|
-
const body = app.getWebhookSubscriptions().map((sub, index) => ({
|
|
29
|
-
name: sub.getName(),
|
|
30
|
-
topic: whData[index].topic,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
32
|
-
delivery_url: TopologyRunner.getWebhookUrl(whData[index].topology, whData[index].node, whData[index].token),
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
36
|
-
const requestDto = app.getRequestDto(
|
|
37
|
-
dto,
|
|
38
|
-
appInstall,
|
|
39
|
-
HttpMethods.POST,
|
|
40
|
-
WOOCOMMERCE_REGISTER_WEBHOOK_ENDPOINT,
|
|
41
|
-
JSON.stringify({ create: body }),
|
|
42
|
-
);
|
|
43
|
-
const repo = this.getDbClient().getRepository(Webhook);
|
|
44
|
-
|
|
45
|
-
let res;
|
|
46
|
-
try {
|
|
47
|
-
res = await this.getSender().send<IResponseJson>(requestDto, [200]);
|
|
48
|
-
const respBody = res.getJsonBody();
|
|
49
|
-
|
|
50
|
-
await Promise.all(
|
|
51
|
-
respBody.create.map(async (webhook) => {
|
|
52
|
-
const located = whData.find((value) => value.topic === webhook.topic);
|
|
53
|
-
if (located) {
|
|
54
|
-
const wb = new Webhook()
|
|
55
|
-
.setWebhookId(webhook.id.toString())
|
|
56
|
-
.setUser(appInstall.getUser())
|
|
57
|
-
.setNode(located.node)
|
|
58
|
-
.setToken(located.token)
|
|
59
|
-
.setApplication(app.getName())
|
|
60
|
-
.setTopology(located.topology)
|
|
61
|
-
.setName(webhook.topic);
|
|
62
|
-
|
|
63
|
-
return repo.insert(wb);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return undefined;
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
|
-
} catch (e) {
|
|
71
|
-
appInstall.setEnabled(false);
|
|
72
|
-
await this.getDbClient().getRepository(ApplicationInstall).update(appInstall);
|
|
73
|
-
|
|
74
|
-
dto.setStopProcess(ResultCode.STOP_AND_FAILED, res?.getBody() ?? 'Webhook could not be registered!');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return dto;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private getRandomToken(): string {
|
|
81
|
-
return crypto.randomBytes(64).toString('hex');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface IResponseJson {
|
|
87
|
-
create: [
|
|
88
|
-
{
|
|
89
|
-
id: number;
|
|
90
|
-
name: string;
|
|
91
|
-
status: string;
|
|
92
|
-
topic: string;
|
|
93
|
-
resource: string;
|
|
94
|
-
event: string;
|
|
95
|
-
hooks: string[];
|
|
96
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
97
|
-
delivery_url: string;
|
|
98
|
-
date_created: string;
|
|
99
|
-
date_created_gmt: string;
|
|
100
|
-
date_modified: string;
|
|
101
|
-
date_modified_gmt: string;
|
|
102
|
-
_links: unknown;
|
|
103
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
2
|
-
import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
|
|
3
|
-
import WebhookRepository from '@orchesty/nodejs-sdk/dist/lib/Application/Database/WebhookRepository';
|
|
4
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
5
|
-
import OnRepeatException from '@orchesty/nodejs-sdk/dist/lib/Exception/OnRepeatException';
|
|
6
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
7
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
8
|
-
import { StatusCodes } from 'http-status-codes';
|
|
9
|
-
import WooCommerceApplication from '../WooCommerceApplication';
|
|
10
|
-
|
|
11
|
-
const BATCH_UPDATE_WEBHOOKS = 'wp-json/wc/v3/webhooks/batch';
|
|
12
|
-
|
|
13
|
-
export default class WooCommerceUnsubscribeWebhooks extends AConnector {
|
|
14
|
-
|
|
15
|
-
public getName(): string {
|
|
16
|
-
return 'woocommerce-unsubscribe-webhooks';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public async processAction(dto: ProcessDto): Promise<ProcessDto> {
|
|
20
|
-
const app = this.getApplication<WooCommerceApplication>();
|
|
21
|
-
|
|
22
|
-
let appInstall: ApplicationInstall;
|
|
23
|
-
try {
|
|
24
|
-
appInstall = await this.getApplicationInstallFromProcess(dto, null, true);
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
-
} catch (e) {
|
|
27
|
-
appInstall = await this.getApplicationInstallFromProcess(dto, null, false);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const repo = this.getDbClient().getRepository(Webhook) as WebhookRepository;
|
|
31
|
-
const webhooks = await repo.findMany({ users: [appInstall.getUser()], apps: [app.getName()] });
|
|
32
|
-
|
|
33
|
-
const webhooksIds: number[] = [];
|
|
34
|
-
|
|
35
|
-
webhooks.forEach((webhook) => {
|
|
36
|
-
webhooksIds.push(Number(webhook.getWebhookId()));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
if (webhooks && webhooks.length > 0) {
|
|
40
|
-
const requestDto = app.getRequestDto(
|
|
41
|
-
dto,
|
|
42
|
-
appInstall,
|
|
43
|
-
HttpMethods.POST,
|
|
44
|
-
BATCH_UPDATE_WEBHOOKS,
|
|
45
|
-
JSON.stringify({ delete: webhooksIds }),
|
|
46
|
-
);
|
|
47
|
-
const res = await this.getSender().send<IResponseJson>(requestDto);
|
|
48
|
-
if (res.getResponseCode() !== StatusCodes.OK && res.getResponseCode() !== StatusCodes.NOT_FOUND) {
|
|
49
|
-
await Promise.all(
|
|
50
|
-
webhooks.map(async (wantedDelete) => {
|
|
51
|
-
wantedDelete.setUnsubscribeFailed(true);
|
|
52
|
-
return repo.update(wantedDelete);
|
|
53
|
-
}),
|
|
54
|
-
);
|
|
55
|
-
throw new OnRepeatException(60, 10, res.getBody());
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let repeat = false;
|
|
59
|
-
const resData = res.getJsonBody().delete;
|
|
60
|
-
await Promise.all(
|
|
61
|
-
webhooks.map(async (wantedDelete) => {
|
|
62
|
-
const foundWebhook = resData?.find(
|
|
63
|
-
(item) => item.id.toString() === wantedDelete.getWebhookId(),
|
|
64
|
-
);
|
|
65
|
-
if (foundWebhook) {
|
|
66
|
-
return repo.remove(wantedDelete);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
repeat = true;
|
|
70
|
-
wantedDelete.setUnsubscribeFailed(true);
|
|
71
|
-
return repo.update(wantedDelete);
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
if (repeat) {
|
|
76
|
-
throw new OnRepeatException(60, 10, res.getBody());
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return dto;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface IResponseJson {
|
|
86
|
-
delete: [
|
|
87
|
-
{
|
|
88
|
-
id: number;
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
|
-
}
|
|
@@ -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 { IResponseJson as IOutput } from '../Batch/WooCommerceGetOrders';
|
|
5
|
-
|
|
6
|
-
export const NAME = 'woocommerce-update-order';
|
|
7
|
-
|
|
8
|
-
export default class WooCommerceUpdateOrder extends AConnector {
|
|
9
|
-
|
|
10
|
-
public getName(): string {
|
|
11
|
-
return NAME;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
15
|
-
const { id, ...data } = this.getJsonData(dto);
|
|
16
|
-
|
|
17
|
-
const requestDto = await this.getApplication().getRequestDto(
|
|
18
|
-
dto,
|
|
19
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
20
|
-
HttpMethods.PUT,
|
|
21
|
-
`wp-json/wc/v3/orders/${id}`,
|
|
22
|
-
JSON.stringify(data),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return dto.setNewJsonData((await this.getSender().send<IOutput>(requestDto, [200])).getJsonBody());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
protected getJsonData(dto: ProcessDto<IInput>): IInput {
|
|
29
|
-
return dto.getJsonData();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface IInput {
|
|
35
|
-
id: number;
|
|
36
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
-
import { defaultRanges, IResultRanges } from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResultCodeRange';
|
|
3
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
-
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
5
|
-
import { IOutput as IInput } from '../Batch/WooCommerceGetProducts';
|
|
6
|
-
|
|
7
|
-
export const NAME = 'woo-commerce-update-product';
|
|
8
|
-
|
|
9
|
-
export default class WooCommerceUpdateProduct extends AConnector {
|
|
10
|
-
|
|
11
|
-
public getName(): string {
|
|
12
|
-
return NAME;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
16
|
-
const { id, ...rest } = dto.getJsonData();
|
|
17
|
-
|
|
18
|
-
const req = await this.getApplication().getRequestDto(
|
|
19
|
-
dto,
|
|
20
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
21
|
-
HttpMethods.PUT,
|
|
22
|
-
`wp-json/wc/v3/products/${id}`,
|
|
23
|
-
JSON.stringify(rest),
|
|
24
|
-
);
|
|
25
|
-
const resp = await this.getSender().send<IResponse>(req, this.getCodeRanges());
|
|
26
|
-
|
|
27
|
-
return dto.setNewJsonData(resp.getJsonBody());
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
protected getCodeRanges(): IResultRanges {
|
|
31
|
-
return defaultRanges;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type IResponse = IInput;
|
|
37
|
-
|
|
38
|
-
type IOutput = IInput;
|
|
@@ -1,45 +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 WooCommerceApplication from '../WooCommerceApplication';
|
|
5
|
-
|
|
6
|
-
export const NAME = 'woocommerce-update-product-quantity';
|
|
7
|
-
|
|
8
|
-
export default class WooCommerceUpdateProductQuantity extends AConnector {
|
|
9
|
-
|
|
10
|
-
public getName(): string {
|
|
11
|
-
return NAME;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto> {
|
|
15
|
-
const { productId, update } = dto.getJsonData();
|
|
16
|
-
|
|
17
|
-
const requestDto = this.getApplication<WooCommerceApplication>().getRequestDto(
|
|
18
|
-
dto,
|
|
19
|
-
await this.getApplicationInstallFromProcess(dto),
|
|
20
|
-
HttpMethods.POST,
|
|
21
|
-
`wp-json/wc/v3/products/${productId}/variations/batch`,
|
|
22
|
-
JSON.stringify(update),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
await this.getSender().send(requestDto, [200]);
|
|
26
|
-
|
|
27
|
-
dto.setJsonData({});
|
|
28
|
-
|
|
29
|
-
return dto;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface IInput {
|
|
35
|
-
productId: string;
|
|
36
|
-
update: IWooCommerceStock[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
40
|
-
export interface IWooCommerceStock {
|
|
41
|
-
id: number;
|
|
42
|
-
stock_quantity: number;
|
|
43
|
-
stock_status: string;
|
|
44
|
-
}
|
|
45
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|