@orchesty/connector-woocommerce 1.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/CHANGELOG.md +12 -0
- package/LICENSE +190 -0
- package/coverage/clover.xml +404 -0
- package/coverage/coverage-final.json +21 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/Batch/WooCommerceGetOrders.ts.html +640 -0
- package/coverage/lcov-report/src/Batch/WooCommerceGetProducts.ts.html +532 -0
- package/coverage/lcov-report/src/Batch/WooCommerceGetVariants.ts.html +433 -0
- package/coverage/lcov-report/src/Batch/index.html +146 -0
- package/coverage/lcov-report/src/Connector/WooCommerceAddNote.ts.html +220 -0
- package/coverage/lcov-report/src/Connector/WooCommerceCreateProduct.ts.html +178 -0
- package/coverage/lcov-report/src/Connector/WooCommerceCreateProductCategory.ts.html +307 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetOrderNotes.ts.html +274 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetOrderStatuses.ts.html +175 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetPaymentGateways.ts.html +295 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetProduct.ts.html +181 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetProductVariant.ts.html +496 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetProductsBySku.ts.html +226 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetSettingsGeneral.ts.html +238 -0
- package/coverage/lcov-report/src/Connector/WooCommerceGetShippingMethods.ts.html +478 -0
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateOrder.ts.html +193 -0
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProduct.ts.html +199 -0
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProductQuantity.ts.html +220 -0
- package/coverage/lcov-report/src/Connector/WooCommerceUpdateProductVariant.ts.html +199 -0
- package/coverage/lcov-report/src/Connector/index.html +326 -0
- package/coverage/lcov-report/src/WooCommerceApplication.ts.html +364 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +427 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +661 -0
- package/dist/Batch/WooCommerceGetOrders.d.ts +133 -0
- package/dist/Batch/WooCommerceGetOrders.js +44 -0
- package/dist/Batch/WooCommerceGetProducts.d.ts +108 -0
- package/dist/Batch/WooCommerceGetProducts.js +36 -0
- package/dist/Batch/WooCommerceGetVariants.d.ts +81 -0
- package/dist/Batch/WooCommerceGetVariants.js +30 -0
- package/dist/Connector/WooCommerceAddNote.d.ts +18 -0
- package/dist/Connector/WooCommerceAddNote.js +23 -0
- package/dist/Connector/WooCommerceCreateProduct.d.ts +10 -0
- package/dist/Connector/WooCommerceCreateProduct.js +20 -0
- package/dist/Connector/WooCommerceCreateProductCategory.d.ts +41 -0
- package/dist/Connector/WooCommerceCreateProductCategory.js +28 -0
- package/dist/Connector/WooCommerceGetOrderNotes.d.ts +33 -0
- package/dist/Connector/WooCommerceGetOrderNotes.js +24 -0
- package/dist/Connector/WooCommerceGetOrderStatuses.d.ts +11 -0
- package/dist/Connector/WooCommerceGetOrderStatuses.js +20 -0
- package/dist/Connector/WooCommerceGetPaymentGateways.d.ts +48 -0
- package/dist/Connector/WooCommerceGetPaymentGateways.js +20 -0
- package/dist/Connector/WooCommerceGetProduct.d.ts +11 -0
- package/dist/Connector/WooCommerceGetProduct.js +21 -0
- package/dist/Connector/WooCommerceGetProductVariant.d.ts +12 -0
- package/dist/Connector/WooCommerceGetProductVariant.js +46 -0
- package/dist/Connector/WooCommerceGetProductsBySku.d.ts +12 -0
- package/dist/Connector/WooCommerceGetProductsBySku.js +34 -0
- package/dist/Connector/WooCommerceGetSettingsGeneral.d.ts +29 -0
- package/dist/Connector/WooCommerceGetSettingsGeneral.js +21 -0
- package/dist/Connector/WooCommerceGetShippingMethods.d.ts +82 -0
- package/dist/Connector/WooCommerceGetShippingMethods.js +36 -0
- package/dist/Connector/WooCommerceRegisterWebhook.d.ts +7 -0
- package/dist/Connector/WooCommerceRegisterWebhook.js +65 -0
- package/dist/Connector/WooCommerceUnsubscribeWebhooks.d.ts +6 -0
- package/dist/Connector/WooCommerceUnsubscribeWebhooks.js +59 -0
- package/dist/Connector/WooCommerceUpdateOrder.d.ts +12 -0
- package/dist/Connector/WooCommerceUpdateOrder.js +23 -0
- package/dist/Connector/WooCommerceUpdateProduct.d.ts +12 -0
- package/dist/Connector/WooCommerceUpdateProduct.js +25 -0
- package/dist/Connector/WooCommerceUpdateProductQuantity.d.ts +16 -0
- package/dist/Connector/WooCommerceUpdateProductQuantity.js +22 -0
- package/dist/Connector/WooCommerceUpdateProductVariant.d.ts +13 -0
- package/dist/Connector/WooCommerceUpdateProductVariant.js +21 -0
- package/dist/WooCommerceApplication.d.ts +21 -0
- package/dist/WooCommerceApplication.js +101 -0
- package/dist/package.json +28 -0
- package/jest.config.js +13 -0
- package/package.json +28 -0
- package/src/Batch/WooCommerceGetOrders.ts +185 -0
- package/src/Batch/WooCommerceGetProducts.ts +149 -0
- package/src/Batch/WooCommerceGetVariants.ts +116 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-input.json +8 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-mock.json +319 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/ids-output.json +16 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/input.json +6 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-input.json +6 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-mock.json +319 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/lastRun-output.json +15 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/mock.json +319 -0
- package/src/Batch/__tests__/Data/WooCommerceGetOrders/output.json +15 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/input.json +7 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/mock.json +170 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/output.json +11 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-input.json +7 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-mock.json +170 -0
- package/src/Batch/__tests__/Data/WooCommerceGetProducts/withAfter-output.json +11 -0
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/input.json +169 -0
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/mock.json +160 -0
- package/src/Batch/__tests__/Data/WooCommerceGetVariants/output.json +11 -0
- package/src/Batch/__tests__/WooCommerceGetOrders.ts +42 -0
- package/src/Batch/__tests__/WooCommerceGetProducts.ts +37 -0
- package/src/Batch/__tests__/WooCommerceGetVariants.ts +32 -0
- package/src/Connector/WooCommerceAddNote.ts +45 -0
- package/src/Connector/WooCommerceCreateProduct.ts +31 -0
- package/src/Connector/WooCommerceCreateProductCategory.ts +74 -0
- package/src/Connector/WooCommerceGetOrderNotes.ts +63 -0
- package/src/Connector/WooCommerceGetOrderStatuses.ts +30 -0
- package/src/Connector/WooCommerceGetPaymentGateways.ts +70 -0
- package/src/Connector/WooCommerceGetProduct.ts +32 -0
- package/src/Connector/WooCommerceGetProductVariant.ts +137 -0
- package/src/Connector/WooCommerceGetProductsBySku.ts +47 -0
- package/src/Connector/WooCommerceGetSettingsGeneral.ts +51 -0
- package/src/Connector/WooCommerceGetShippingMethods.ts +131 -0
- package/src/Connector/WooCommerceRegisterWebhook.ts +106 -0
- package/src/Connector/WooCommerceUnsubscribeWebhooks.ts +91 -0
- package/src/Connector/WooCommerceUpdateOrder.ts +36 -0
- package/src/Connector/WooCommerceUpdateProduct.ts +38 -0
- package/src/Connector/WooCommerceUpdateProductQuantity.ts +45 -0
- package/src/Connector/WooCommerceUpdateProductVariant.ts +38 -0
- package/src/Connector/__tests__/Data/WooCommerceAddNote/input.json +11 -0
- package/src/Connector/__tests__/Data/WooCommerceAddNote/mock.json +22 -0
- package/src/Connector/__tests__/Data/WooCommerceAddNote/output.json +23 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/input.json +28 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/mock.json +125 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProduct/output.json +126 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/input.json +11 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/mock.json +36 -0
- package/src/Connector/__tests__/Data/WooCommerceCreateProductCategory/output.json +37 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/input.json +8 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/mock.json +81 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderNotes/output.json +82 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/input.json +6 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/mock.json +41 -0
- package/src/Connector/__tests__/Data/WooCommerceGetOrderStatuses/output.json +42 -0
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/input.json +6 -0
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/mock.json +350 -0
- package/src/Connector/__tests__/Data/WooCommerceGetPaymentGateways/output.json +351 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/input.json +8 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/mock.json +125 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProduct/output.json +126 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/input.json +37 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/mock.json +81 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/mock1.json +81 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-input.json +22 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-mock.json +81 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/nok-output.json +24 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductVariant/output.json +37 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/input.json +8 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/mock.json +170 -0
- package/src/Connector/__tests__/Data/WooCommerceGetProductsBySku/output.json +169 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/input.json +6 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/mock.json +3459 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/output.json +3460 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-input.json +8 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-mock.json +30 -0
- package/src/Connector/__tests__/Data/WooCommerceGetSettingsGeneral/with-id-output.json +31 -0
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/input.json +6 -0
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock.json +50 -0
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock1.json +187 -0
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/mock2.json +187 -0
- package/src/Connector/__tests__/Data/WooCommerceGetShippingMethods/output.json +373 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/input.json +9 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/mock.json +169 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateOrder/output.json +170 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/input.json +9 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/mock.json +125 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProduct/output.json +126 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/input.json +20 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/mock.json +162 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductQuantity/output.json +6 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/input.json +10 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/mock.json +125 -0
- package/src/Connector/__tests__/Data/WooCommerceUpdateProductVariant/output.json +126 -0
- package/src/Connector/__tests__/WooCommerceAddNote.ts +18 -0
- package/src/Connector/__tests__/WooCommerceCreateProduct.ts +18 -0
- package/src/Connector/__tests__/WooCommerceCreateProductCategory.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetOrderNotes.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetOrderStatuses.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetPaymentGateways.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetProduct.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetProductVariant.ts +25 -0
- package/src/Connector/__tests__/WooCommerceGetProductsBySku.ts +18 -0
- package/src/Connector/__tests__/WooCommerceGetSettingsGeneral.ts +25 -0
- package/src/Connector/__tests__/WooCommerceGetShippingMethods.ts +18 -0
- package/src/Connector/__tests__/WooCommerceUpdateOrder.ts +18 -0
- package/src/Connector/__tests__/WooCommerceUpdateProduct.ts +18 -0
- package/src/Connector/__tests__/WooCommerceUpdateProductQuantity.ts +18 -0
- package/src/Connector/__tests__/WooCommerceUpdateProductVariant.ts +18 -0
- package/src/WooCommerceApplication.ts +93 -0
- package/test/dataProvider.ts +114 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET http://woocomerce.com/wp-json/wc/v3/products/799/variations/?per_page=100&page=1",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": [
|
|
5
|
+
{
|
|
6
|
+
"id": 733,
|
|
7
|
+
"date_created": "2017-03-23T00:53:11",
|
|
8
|
+
"date_created_gmt": "2017-03-23T03:53:11",
|
|
9
|
+
"date_modified": "2017-03-23T00:53:11",
|
|
10
|
+
"date_modified_gmt": "2017-03-23T03:53:11",
|
|
11
|
+
"description": "",
|
|
12
|
+
"permalink": "https://example.com/product/ship-your-idea/?attribute_pa_color=green",
|
|
13
|
+
"sku": "",
|
|
14
|
+
"price": "9.00",
|
|
15
|
+
"regular_price": "9.00",
|
|
16
|
+
"sale_price": "",
|
|
17
|
+
"date_on_sale_from": null,
|
|
18
|
+
"date_on_sale_from_gmt": null,
|
|
19
|
+
"date_on_sale_to": null,
|
|
20
|
+
"date_on_sale_to_gmt": null,
|
|
21
|
+
"on_sale": false,
|
|
22
|
+
"status": "publish",
|
|
23
|
+
"purchasable": true,
|
|
24
|
+
"virtual": false,
|
|
25
|
+
"downloadable": false,
|
|
26
|
+
"downloads": [],
|
|
27
|
+
"download_limit": -1,
|
|
28
|
+
"download_expiry": -1,
|
|
29
|
+
"tax_status": "taxable",
|
|
30
|
+
"tax_class": "",
|
|
31
|
+
"manage_stock": false,
|
|
32
|
+
"stock_quantity": null,
|
|
33
|
+
"stock_status": "instock",
|
|
34
|
+
"backorders": "no",
|
|
35
|
+
"backorders_allowed": false,
|
|
36
|
+
"backordered": false,
|
|
37
|
+
"weight": "",
|
|
38
|
+
"dimensions": {
|
|
39
|
+
"length": "",
|
|
40
|
+
"width": "",
|
|
41
|
+
"height": ""
|
|
42
|
+
},
|
|
43
|
+
"shipping_class": "",
|
|
44
|
+
"shipping_class_id": 0,
|
|
45
|
+
"image": {
|
|
46
|
+
"id": 425,
|
|
47
|
+
"date_created": "2016-10-19T12:21:16",
|
|
48
|
+
"date_created_gmt": "2016-10-19T16:21:16",
|
|
49
|
+
"date_modified": "2016-10-19T12:21:16",
|
|
50
|
+
"date_modified_gmt": "2016-10-19T16:21:16",
|
|
51
|
+
"src": "https://example.com/wp-content/uploads/2016/10/T_3_front-12.jpg",
|
|
52
|
+
"name": "",
|
|
53
|
+
"alt": ""
|
|
54
|
+
},
|
|
55
|
+
"attributes": [
|
|
56
|
+
{
|
|
57
|
+
"id": 6,
|
|
58
|
+
"name": "Color",
|
|
59
|
+
"option": "Green"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"menu_order": 0,
|
|
63
|
+
"meta_data": [],
|
|
64
|
+
"_links": {
|
|
65
|
+
"self": [
|
|
66
|
+
{
|
|
67
|
+
"href": "https://example.com/wp-json/wc/v3/products/22/variations/733"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"collection": [
|
|
71
|
+
{
|
|
72
|
+
"href": "https://example.com/wp-json/wc/v3/products/22/variations"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"up": [
|
|
76
|
+
{
|
|
77
|
+
"href": "https://example.com/wp-json/wc/v3/products/22"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": 732,
|
|
84
|
+
"date_created": "2017-03-23T00:36:38",
|
|
85
|
+
"date_created_gmt": "2017-03-23T03:36:38",
|
|
86
|
+
"date_modified": "2017-03-23T00:36:38",
|
|
87
|
+
"date_modified_gmt": "2017-03-23T03:36:38",
|
|
88
|
+
"description": "",
|
|
89
|
+
"permalink": "https://example.com/product/ship-your-idea/?attribute_pa_color=black",
|
|
90
|
+
"sku": "",
|
|
91
|
+
"price": "9.00",
|
|
92
|
+
"regular_price": "9.00",
|
|
93
|
+
"sale_price": "",
|
|
94
|
+
"date_on_sale_from": null,
|
|
95
|
+
"date_on_sale_from_gmt": null,
|
|
96
|
+
"date_on_sale_to": null,
|
|
97
|
+
"date_on_sale_to_gmt": null,
|
|
98
|
+
"on_sale": false,
|
|
99
|
+
"status": "publish",
|
|
100
|
+
"purchasable": true,
|
|
101
|
+
"virtual": false,
|
|
102
|
+
"downloadable": false,
|
|
103
|
+
"downloads": [],
|
|
104
|
+
"download_limit": -1,
|
|
105
|
+
"download_expiry": -1,
|
|
106
|
+
"tax_status": "taxable",
|
|
107
|
+
"tax_class": "",
|
|
108
|
+
"manage_stock": false,
|
|
109
|
+
"stock_quantity": null,
|
|
110
|
+
"stock_status": "instock",
|
|
111
|
+
"backorders": "no",
|
|
112
|
+
"backorders_allowed": false,
|
|
113
|
+
"backordered": false,
|
|
114
|
+
"weight": "",
|
|
115
|
+
"dimensions": {
|
|
116
|
+
"length": "",
|
|
117
|
+
"width": "",
|
|
118
|
+
"height": ""
|
|
119
|
+
},
|
|
120
|
+
"shipping_class": "",
|
|
121
|
+
"shipping_class_id": 0,
|
|
122
|
+
"image": {
|
|
123
|
+
"id": 423,
|
|
124
|
+
"date_created": "2016-10-19T12:21:14",
|
|
125
|
+
"date_created_gmt": "2016-10-19T16:21:14",
|
|
126
|
+
"date_modified": "2016-10-19T12:21:14",
|
|
127
|
+
"date_modified_gmt": "2016-10-19T16:21:14",
|
|
128
|
+
"src": "https://example.com/wp-content/uploads/2016/10/T_4_front-12.jpg",
|
|
129
|
+
"name": "",
|
|
130
|
+
"alt": ""
|
|
131
|
+
},
|
|
132
|
+
"attributes": [
|
|
133
|
+
{
|
|
134
|
+
"id": 6,
|
|
135
|
+
"name": "Color",
|
|
136
|
+
"option": "Black"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"menu_order": 0,
|
|
140
|
+
"meta_data": [],
|
|
141
|
+
"_links": {
|
|
142
|
+
"self": [
|
|
143
|
+
{
|
|
144
|
+
"href": "https://example.com/wp-json/wc/v3/products/22/variations/732"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"collection": [
|
|
148
|
+
{
|
|
149
|
+
"href": "https://example.com/wp-json/wc/v3/products/22/variations"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"up": [
|
|
153
|
+
{
|
|
154
|
+
"href": "https://example.com/wp-json/wc/v3/products/22"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"product\":{\"id\":799,\"name\":\"Ship Your Idea\",\"slug\":\"ship-your-idea-22\",\"permalink\":\"https://example.com/product/ship-your-idea-22/\",\"date_created\":\"2017-03-23T17:03:12\",\"date_created_gmt\":\"2017-03-23T20:03:12\",\"date_modified\":\"2017-03-23T17:03:12\",\"date_modified_gmt\":\"2017-03-23T20:03:12\",\"type\":\"variable\",\"status\":\"publish\",\"featured\":false,\"catalog_visibility\":\"visible\",\"description\":\"<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\\n\",\"short_description\":\"<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\\n\",\"sku\":\"\",\"price\":\"\",\"regular_price\":\"\",\"sale_price\":\"\",\"date_on_sale_from\":null,\"date_on_sale_from_gmt\":null,\"date_on_sale_to\":null,\"date_on_sale_to_gmt\":null,\"price_html\":\"\",\"on_sale\":false,\"purchasable\":false,\"total_sales\":0,\"virtual\":false,\"downloadable\":false,\"downloads\":[],\"download_limit\":-1,\"download_expiry\":-1,\"external_url\":\"\",\"button_text\":\"\",\"tax_status\":\"taxable\",\"tax_class\":\"\",\"manage_stock\":false,\"stock_quantity\":null,\"stock_status\":\"instock\",\"backorders\":\"no\",\"backorders_allowed\":false,\"backordered\":false,\"sold_individually\":false,\"weight\":\"\",\"dimensions\":{\"length\":\"\",\"width\":\"\",\"height\":\"\"},\"shipping_required\":true,\"shipping_taxable\":true,\"shipping_class\":\"\",\"shipping_class_id\":0,\"reviews_allowed\":true,\"average_rating\":\"0.00\",\"rating_count\":0,\"related_ids\":[31,22,369,414,56],\"upsell_ids\":[],\"cross_sell_ids\":[],\"parent_id\":0,\"purchase_note\":\"\",\"categories\":[{\"id\":9,\"name\":\"Clothing\",\"slug\":\"clothing\"},{\"id\":14,\"name\":\"T-shirts\",\"slug\":\"t-shirts\"}],\"tags\":[],\"images\":[{\"id\":795,\"date_created\":\"2017-03-23T14:03:08\",\"date_created_gmt\":\"2017-03-23T20:03:08\",\"date_modified\":\"2017-03-23T14:03:08\",\"date_modified_gmt\":\"2017-03-23T20:03:08\",\"src\":\"https://example.com/wp-content/uploads/2017/03/T_4_front-11.jpg\",\"name\":\"\",\"alt\":\"\"},{\"id\":796,\"date_created\":\"2017-03-23T14:03:09\",\"date_created_gmt\":\"2017-03-23T20:03:09\",\"date_modified\":\"2017-03-23T14:03:09\",\"date_modified_gmt\":\"2017-03-23T20:03:09\",\"src\":\"https://example.com/wp-content/uploads/2017/03/T_4_back-10.jpg\",\"name\":\"\",\"alt\":\"\"},{\"id\":797,\"date_created\":\"2017-03-23T14:03:10\",\"date_created_gmt\":\"2017-03-23T20:03:10\",\"date_modified\":\"2017-03-23T14:03:10\",\"date_modified_gmt\":\"2017-03-23T20:03:10\",\"src\":\"https://example.com/wp-content/uploads/2017/03/T_3_front-10.jpg\",\"name\":\"\",\"alt\":\"\"},{\"id\":798,\"date_created\":\"2017-03-23T14:03:11\",\"date_created_gmt\":\"2017-03-23T20:03:11\",\"date_modified\":\"2017-03-23T14:03:11\",\"date_modified_gmt\":\"2017-03-23T20:03:11\",\"src\":\"https://example.com/wp-content/uploads/2017/03/T_3_back-10.jpg\",\"name\":\"\",\"alt\":\"\"}],\"attributes\":[{\"id\":6,\"name\":\"Color\",\"position\":0,\"visible\":false,\"variation\":true,\"options\":[\"Black\",\"Green\"]},{\"id\":0,\"name\":\"Size\",\"position\":0,\"visible\":true,\"variation\":true,\"options\":[\"S\",\"M\"]}],\"default_attributes\":[],\"variations\":[],\"grouped_products\":[],\"menu_order\":0,\"meta_data\":[],\"_links\":{\"self\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/799\"}],\"collection\":[{\"href\":\"https://example.com/wp-json/wc/v3/products\"}]}},\"variants\":[{\"id\":733,\"date_created\":\"2017-03-23T00:53:11\",\"date_created_gmt\":\"2017-03-23T03:53:11\",\"date_modified\":\"2017-03-23T00:53:11\",\"date_modified_gmt\":\"2017-03-23T03:53:11\",\"description\":\"\",\"permalink\":\"https://example.com/product/ship-your-idea/?attribute_pa_color=green\",\"sku\":\"\",\"price\":\"9.00\",\"regular_price\":\"9.00\",\"sale_price\":\"\",\"date_on_sale_from\":null,\"date_on_sale_from_gmt\":null,\"date_on_sale_to\":null,\"date_on_sale_to_gmt\":null,\"on_sale\":false,\"status\":\"publish\",\"purchasable\":true,\"virtual\":false,\"downloadable\":false,\"downloads\":[],\"download_limit\":-1,\"download_expiry\":-1,\"tax_status\":\"taxable\",\"tax_class\":\"\",\"manage_stock\":false,\"stock_quantity\":null,\"stock_status\":\"instock\",\"backorders\":\"no\",\"backorders_allowed\":false,\"backordered\":false,\"weight\":\"\",\"dimensions\":{\"length\":\"\",\"width\":\"\",\"height\":\"\"},\"shipping_class\":\"\",\"shipping_class_id\":0,\"image\":{\"id\":425,\"date_created\":\"2016-10-19T12:21:16\",\"date_created_gmt\":\"2016-10-19T16:21:16\",\"date_modified\":\"2016-10-19T12:21:16\",\"date_modified_gmt\":\"2016-10-19T16:21:16\",\"src\":\"https://example.com/wp-content/uploads/2016/10/T_3_front-12.jpg\",\"name\":\"\",\"alt\":\"\"},\"attributes\":[{\"id\":6,\"name\":\"Color\",\"option\":\"Green\"}],\"menu_order\":0,\"meta_data\":[],\"_links\":{\"self\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22/variations/733\"}],\"collection\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22/variations\"}],\"up\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22\"}]}},{\"id\":732,\"date_created\":\"2017-03-23T00:36:38\",\"date_created_gmt\":\"2017-03-23T03:36:38\",\"date_modified\":\"2017-03-23T00:36:38\",\"date_modified_gmt\":\"2017-03-23T03:36:38\",\"description\":\"\",\"permalink\":\"https://example.com/product/ship-your-idea/?attribute_pa_color=black\",\"sku\":\"\",\"price\":\"9.00\",\"regular_price\":\"9.00\",\"sale_price\":\"\",\"date_on_sale_from\":null,\"date_on_sale_from_gmt\":null,\"date_on_sale_to\":null,\"date_on_sale_to_gmt\":null,\"on_sale\":false,\"status\":\"publish\",\"purchasable\":true,\"virtual\":false,\"downloadable\":false,\"downloads\":[],\"download_limit\":-1,\"download_expiry\":-1,\"tax_status\":\"taxable\",\"tax_class\":\"\",\"manage_stock\":false,\"stock_quantity\":null,\"stock_status\":\"instock\",\"backorders\":\"no\",\"backorders_allowed\":false,\"backordered\":false,\"weight\":\"\",\"dimensions\":{\"length\":\"\",\"width\":\"\",\"height\":\"\"},\"shipping_class\":\"\",\"shipping_class_id\":0,\"image\":{\"id\":423,\"date_created\":\"2016-10-19T12:21:14\",\"date_created_gmt\":\"2016-10-19T16:21:14\",\"date_modified\":\"2016-10-19T12:21:14\",\"date_modified_gmt\":\"2016-10-19T16:21:14\",\"src\":\"https://example.com/wp-content/uploads/2016/10/T_4_front-12.jpg\",\"name\":\"\",\"alt\":\"\"},\"attributes\":[{\"id\":6,\"name\":\"Color\",\"option\":\"Black\"}],\"menu_order\":0,\"meta_data\":[],\"_links\":{\"self\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22/variations/732\"}],\"collection\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22/variations\"}],\"up\":[{\"href\":\"https://example.com/wp-json/wc/v3/products/22\"}]}}]}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import { orchestyOptions } from '@orchesty/nodejs-sdk/dist/lib/Config/Config';
|
|
3
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
+
import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
|
|
5
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
6
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
7
|
+
import { NAME as WOO_COMMERCE_GET_ORDERS } from '../WooCommerceGetOrders';
|
|
8
|
+
|
|
9
|
+
let tester: NodeTester;
|
|
10
|
+
|
|
11
|
+
describe('Tests for WooCommerceGetOrders', () => {
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
tester = new NodeTester(container, __filename);
|
|
14
|
+
init();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
mockOnce([
|
|
19
|
+
{ request: {
|
|
20
|
+
method: HttpMethods.POST,
|
|
21
|
+
url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/ApplicationInstall.*`),
|
|
22
|
+
},
|
|
23
|
+
response: {},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('process - ok', async () => {
|
|
29
|
+
mock();
|
|
30
|
+
await tester.testBatch(WOO_COMMERCE_GET_ORDERS);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('process - lastRun', async () => {
|
|
34
|
+
mock({ orderLastRun: '2022-09-22T08:21:27.000Z' });
|
|
35
|
+
await tester.testBatch(WOO_COMMERCE_GET_ORDERS, 'lastRun');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('process - with ids', async () => {
|
|
39
|
+
mock();
|
|
40
|
+
await tester.testBatch(WOO_COMMERCE_GET_ORDERS, 'ids');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import { orchestyOptions } from '@orchesty/nodejs-sdk/dist/lib/Config/Config';
|
|
3
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
+
import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
|
|
5
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
6
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
7
|
+
import { NAME as WOO_COMMERCE_GET_PRODUCTS } from '../WooCommerceGetProducts';
|
|
8
|
+
|
|
9
|
+
let tester: NodeTester;
|
|
10
|
+
|
|
11
|
+
describe('Tests for WooCommerceGetProducts', () => {
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
tester = new NodeTester(container, __filename);
|
|
14
|
+
init();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
mockOnce([
|
|
19
|
+
{ request: {
|
|
20
|
+
method: HttpMethods.POST,
|
|
21
|
+
url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/ApplicationInstall.*`),
|
|
22
|
+
},
|
|
23
|
+
response: {},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('process - ok', async () => {
|
|
29
|
+
mock();
|
|
30
|
+
await tester.testBatch(WOO_COMMERCE_GET_PRODUCTS);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('process - with after', async () => {
|
|
34
|
+
mock({ productLastRun: '2022-09-22T08:21:27.000Z' });
|
|
35
|
+
await tester.testBatch(WOO_COMMERCE_GET_PRODUCTS, 'withAfter');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import { orchestyOptions } from '@orchesty/nodejs-sdk/dist/lib/Config/Config';
|
|
3
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
+
import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
|
|
5
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
6
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
7
|
+
import { NAME as WOO_COMMERCE_GET_VARIANTS } from '../WooCommerceGetVariants';
|
|
8
|
+
|
|
9
|
+
let tester: NodeTester;
|
|
10
|
+
|
|
11
|
+
describe('Tests for WooCommerceGetVariants', () => {
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
tester = new NodeTester(container, __filename);
|
|
14
|
+
init();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
mockOnce([
|
|
19
|
+
{ request: {
|
|
20
|
+
method: HttpMethods.POST,
|
|
21
|
+
url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/ApplicationInstall.*`),
|
|
22
|
+
},
|
|
23
|
+
response: {},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('process - ok', async () => {
|
|
29
|
+
mock();
|
|
30
|
+
await tester.testBatch(WOO_COMMERCE_GET_VARIANTS);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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-add-note';
|
|
7
|
+
|
|
8
|
+
export default class WooCommerceAddNote 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.POST,
|
|
21
|
+
`wp-json/wc/v3/orders/${id}/notes`,
|
|
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
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
35
|
+
export interface IInput {
|
|
36
|
+
id: number;
|
|
37
|
+
author?: string;
|
|
38
|
+
date_created?: Date;
|
|
39
|
+
date_created_gmt?: Date;
|
|
40
|
+
note?: string;
|
|
41
|
+
customer_note?: boolean;
|
|
42
|
+
added_by_user?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { IOutput as IInput } from '../Batch/WooCommerceGetProducts';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'woo-commerce-create-product';
|
|
7
|
+
|
|
8
|
+
export default class WooCommerceCreateProduct extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
15
|
+
const req = await this.getApplication().getRequestDto(
|
|
16
|
+
dto,
|
|
17
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
18
|
+
HttpMethods.POST,
|
|
19
|
+
'wp-json/wc/v3/products',
|
|
20
|
+
JSON.stringify(dto.getJsonData()),
|
|
21
|
+
);
|
|
22
|
+
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
23
|
+
|
|
24
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type IResponse = IInput;
|
|
30
|
+
|
|
31
|
+
type IOutput = IInput;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
+
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
3
|
+
import { IResultRanges } from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResultCodeRange';
|
|
4
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
5
|
+
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
6
|
+
|
|
7
|
+
export const NAME = 'woo-commerce-create-product-category';
|
|
8
|
+
|
|
9
|
+
export default class WooCommerceCreateProductCategory extends AConnector {
|
|
10
|
+
|
|
11
|
+
public getName(): string {
|
|
12
|
+
return NAME;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
16
|
+
const req = await this.getApplication().getRequestDto(
|
|
17
|
+
dto,
|
|
18
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
19
|
+
HttpMethods.POST,
|
|
20
|
+
'wp-json/wc/v3/products/categories',
|
|
21
|
+
JSON.stringify(dto.getJsonData()),
|
|
22
|
+
);
|
|
23
|
+
const resp = await this.getSender().send<IResponse>(req, this.getCodeRanges());
|
|
24
|
+
|
|
25
|
+
return this.setNewJsonData(dto, resp) as ProcessDto<IOutput>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected setNewJsonData(dto: ProcessDto, resp: ResponseDto): ProcessDto {
|
|
29
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected getCodeRanges(): IResultRanges {
|
|
33
|
+
return {
|
|
34
|
+
success: [200],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type IResponse = IInput;
|
|
41
|
+
|
|
42
|
+
type IOutput = IInput;
|
|
43
|
+
|
|
44
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
45
|
+
export interface IInput {
|
|
46
|
+
id?: number;
|
|
47
|
+
name?: string;
|
|
48
|
+
slug?: string;
|
|
49
|
+
parent?: number;
|
|
50
|
+
description?: string;
|
|
51
|
+
display?: string;
|
|
52
|
+
image?: {
|
|
53
|
+
id?: number;
|
|
54
|
+
date_created?: string;
|
|
55
|
+
date_created_gmt?: string;
|
|
56
|
+
date_modified?: string;
|
|
57
|
+
date_modified_gmt?: string;
|
|
58
|
+
src?: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
alt?: string;
|
|
61
|
+
};
|
|
62
|
+
menu_order?: number;
|
|
63
|
+
count?: number;
|
|
64
|
+
_links?: {
|
|
65
|
+
self?: {
|
|
66
|
+
href?: string;
|
|
67
|
+
}[];
|
|
68
|
+
collection?: {
|
|
69
|
+
href?: string;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
+
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
3
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
+
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'woo-commerce-get-order-notes';
|
|
7
|
+
|
|
8
|
+
export default class WooCommerceGetOrderNotes 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 } = dto.getJsonData();
|
|
16
|
+
|
|
17
|
+
const req = await this.getApplication().getRequestDto(
|
|
18
|
+
dto,
|
|
19
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
20
|
+
HttpMethods.GET,
|
|
21
|
+
`wp-json/wc/v3/orders/${id}/notes`,
|
|
22
|
+
);
|
|
23
|
+
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
24
|
+
|
|
25
|
+
return this.setNewJsonData(dto, resp);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected setNewJsonData(dto: ProcessDto<IInput>, resp: ResponseDto<IResponse>): ProcessDto<IOutput> {
|
|
29
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type IResponse = IOrderNote[];
|
|
35
|
+
|
|
36
|
+
export interface IInput {
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type IOutput = IResponse;
|
|
41
|
+
|
|
42
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
43
|
+
export interface IOrderNote {
|
|
44
|
+
id: number;
|
|
45
|
+
author: string;
|
|
46
|
+
date_created: string;
|
|
47
|
+
date_created_gmt: string;
|
|
48
|
+
note: string;
|
|
49
|
+
customer_note: boolean;
|
|
50
|
+
_links: {
|
|
51
|
+
self: {
|
|
52
|
+
href: string;
|
|
53
|
+
}[];
|
|
54
|
+
collection: {
|
|
55
|
+
href: string;
|
|
56
|
+
}[];
|
|
57
|
+
up: {
|
|
58
|
+
href: string;
|
|
59
|
+
}[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,30 @@
|
|
|
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-order-statuses';
|
|
6
|
+
|
|
7
|
+
export default class WooCommerceGetOrderStatuses extends AConnector {
|
|
8
|
+
|
|
9
|
+
public getName(): string {
|
|
10
|
+
return NAME;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async processAction(dto: ProcessDto): Promise<ProcessDto<IResponse[]>> {
|
|
14
|
+
const req = await this.getApplication().getRequestDto(
|
|
15
|
+
dto,
|
|
16
|
+
await this.getApplicationInstallFromProcess(dto, null),
|
|
17
|
+
HttpMethods.GET,
|
|
18
|
+
'wp-json/wc/v3/reports/orders/totals?per_page=1000',
|
|
19
|
+
);
|
|
20
|
+
const resp = await this.getSender().send<IResponse[]>(req, [200]);
|
|
21
|
+
|
|
22
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IResponse {
|
|
28
|
+
slug: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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-payment-gateways';
|
|
6
|
+
|
|
7
|
+
export default class WooCommerceGetPaymentGateways extends AConnector {
|
|
8
|
+
|
|
9
|
+
public getName(): string {
|
|
10
|
+
return NAME;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async processAction(dto: ProcessDto): Promise<ProcessDto<IOutput>> {
|
|
14
|
+
const req = await this.getApplication().getRequestDto(
|
|
15
|
+
dto,
|
|
16
|
+
await this.getApplicationInstallFromProcess(dto, null),
|
|
17
|
+
HttpMethods.GET,
|
|
18
|
+
'wp-json/wc/v3/payment_gateways',
|
|
19
|
+
);
|
|
20
|
+
const resp = await this.getSender().send<IOutput>(req, [200]);
|
|
21
|
+
|
|
22
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type IOutput = IPaymentMethod[];
|
|
28
|
+
|
|
29
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
30
|
+
export interface IPaymentMethod {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
order: number;
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
method_title: string;
|
|
37
|
+
method_description: string;
|
|
38
|
+
method_supports: string[];
|
|
39
|
+
settings: {
|
|
40
|
+
title: {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
type: string;
|
|
45
|
+
value: string;
|
|
46
|
+
default: string;
|
|
47
|
+
tip: string;
|
|
48
|
+
placeholder: string;
|
|
49
|
+
};
|
|
50
|
+
instructions: {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
description: string;
|
|
54
|
+
type: string;
|
|
55
|
+
value: string;
|
|
56
|
+
default: string;
|
|
57
|
+
tip: string;
|
|
58
|
+
placeholder: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
_links: {
|
|
62
|
+
self: {
|
|
63
|
+
href: string;
|
|
64
|
+
}[];
|
|
65
|
+
collection: {
|
|
66
|
+
href: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { IOutput } from '../Batch/WooCommerceGetProducts';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'woocommerce-get-product';
|
|
7
|
+
|
|
8
|
+
export default class WooCommerceGetProduct extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IInput | IOutput>> {
|
|
15
|
+
const { id } = dto.getJsonData();
|
|
16
|
+
|
|
17
|
+
const req = await this.getApplication().getRequestDto(
|
|
18
|
+
dto,
|
|
19
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
20
|
+
HttpMethods.GET,
|
|
21
|
+
`wp-json/wc/v3/products/${id}`,
|
|
22
|
+
);
|
|
23
|
+
const resp = await this.getSender().send<IOutput>(req, [200]);
|
|
24
|
+
|
|
25
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IInput {
|
|
31
|
+
id: number
|
|
32
|
+
}
|