@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,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "PUT http://woocomerce.com/wp-json/wc/v3/products/1/variations/794",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"id": 794,
|
|
6
|
+
"name": "Premium Quality",
|
|
7
|
+
"slug": "premium-quality-19",
|
|
8
|
+
"permalink": "https://example.com/product/premium-quality-19/",
|
|
9
|
+
"date_created": "2017-03-23T17:01:14",
|
|
10
|
+
"date_created_gmt": "2017-03-23T20:01:14",
|
|
11
|
+
"date_modified": "2017-03-23T17:01:14",
|
|
12
|
+
"date_modified_gmt": "2017-03-23T20:01:14",
|
|
13
|
+
"type": "simple",
|
|
14
|
+
"status": "publish",
|
|
15
|
+
"featured": false,
|
|
16
|
+
"catalog_visibility": "visible",
|
|
17
|
+
"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",
|
|
18
|
+
"short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
|
|
19
|
+
"sku": "",
|
|
20
|
+
"price": "21.99",
|
|
21
|
+
"regular_price": "21.99",
|
|
22
|
+
"sale_price": "",
|
|
23
|
+
"date_on_sale_from": null,
|
|
24
|
+
"date_on_sale_from_gmt": null,
|
|
25
|
+
"date_on_sale_to": null,
|
|
26
|
+
"date_on_sale_to_gmt": null,
|
|
27
|
+
"price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</span>",
|
|
28
|
+
"on_sale": false,
|
|
29
|
+
"purchasable": true,
|
|
30
|
+
"total_sales": 0,
|
|
31
|
+
"virtual": false,
|
|
32
|
+
"downloadable": false,
|
|
33
|
+
"downloads": [],
|
|
34
|
+
"download_limit": -1,
|
|
35
|
+
"download_expiry": -1,
|
|
36
|
+
"external_url": "",
|
|
37
|
+
"button_text": "",
|
|
38
|
+
"tax_status": "taxable",
|
|
39
|
+
"tax_class": "",
|
|
40
|
+
"manage_stock": true,
|
|
41
|
+
"stock_quantity": 12,
|
|
42
|
+
"stock_status": "instock",
|
|
43
|
+
"backorders": "no",
|
|
44
|
+
"backorders_allowed": false,
|
|
45
|
+
"backordered": false,
|
|
46
|
+
"sold_individually": false,
|
|
47
|
+
"weight": "",
|
|
48
|
+
"dimensions": {
|
|
49
|
+
"length": "",
|
|
50
|
+
"width": "",
|
|
51
|
+
"height": ""
|
|
52
|
+
},
|
|
53
|
+
"shipping_required": true,
|
|
54
|
+
"shipping_taxable": true,
|
|
55
|
+
"shipping_class": "",
|
|
56
|
+
"shipping_class_id": 0,
|
|
57
|
+
"reviews_allowed": true,
|
|
58
|
+
"average_rating": "0.00",
|
|
59
|
+
"rating_count": 0,
|
|
60
|
+
"related_ids": [
|
|
61
|
+
53,
|
|
62
|
+
40,
|
|
63
|
+
56,
|
|
64
|
+
479,
|
|
65
|
+
99
|
|
66
|
+
],
|
|
67
|
+
"upsell_ids": [],
|
|
68
|
+
"cross_sell_ids": [],
|
|
69
|
+
"parent_id": 0,
|
|
70
|
+
"purchase_note": "",
|
|
71
|
+
"categories": [
|
|
72
|
+
{
|
|
73
|
+
"id": 9,
|
|
74
|
+
"name": "Clothing",
|
|
75
|
+
"slug": "clothing"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": 14,
|
|
79
|
+
"name": "T-shirts",
|
|
80
|
+
"slug": "t-shirts"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"tags": [],
|
|
84
|
+
"images": [
|
|
85
|
+
{
|
|
86
|
+
"id": 792,
|
|
87
|
+
"date_created": "2017-03-23T14:01:13",
|
|
88
|
+
"date_created_gmt": "2017-03-23T20:01:13",
|
|
89
|
+
"date_modified": "2017-03-23T14:01:13",
|
|
90
|
+
"date_modified_gmt": "2017-03-23T20:01:13",
|
|
91
|
+
"src": "https://example.com/wp-content/uploads/2017/03/T_2_front-4.jpg",
|
|
92
|
+
"name": "",
|
|
93
|
+
"alt": ""
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": 793,
|
|
97
|
+
"date_created": "2017-03-23T14:01:14",
|
|
98
|
+
"date_created_gmt": "2017-03-23T20:01:14",
|
|
99
|
+
"date_modified": "2017-03-23T14:01:14",
|
|
100
|
+
"date_modified_gmt": "2017-03-23T20:01:14",
|
|
101
|
+
"src": "https://example.com/wp-content/uploads/2017/03/T_2_back-2.jpg",
|
|
102
|
+
"name": "",
|
|
103
|
+
"alt": ""
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"attributes": [],
|
|
107
|
+
"default_attributes": [],
|
|
108
|
+
"variations": [],
|
|
109
|
+
"grouped_products": [],
|
|
110
|
+
"menu_order": 0,
|
|
111
|
+
"meta_data": [],
|
|
112
|
+
"_links": {
|
|
113
|
+
"self": [
|
|
114
|
+
{
|
|
115
|
+
"href": "https://example.com/wp-json/wc/v3/products/794"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"collection": [
|
|
119
|
+
{
|
|
120
|
+
"href": "https://example.com/wp-json/wc/v3/products"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": {
|
|
6
|
+
"_links": {
|
|
7
|
+
"collection": [
|
|
8
|
+
{
|
|
9
|
+
"href": "https://example.com/wp-json/wc/v3/products"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"self": [
|
|
13
|
+
{
|
|
14
|
+
"href": "https://example.com/wp-json/wc/v3/products/794"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"attributes": [],
|
|
19
|
+
"average_rating": "0.00",
|
|
20
|
+
"backordered": false,
|
|
21
|
+
"backorders": "no",
|
|
22
|
+
"backorders_allowed": false,
|
|
23
|
+
"button_text": "",
|
|
24
|
+
"catalog_visibility": "visible",
|
|
25
|
+
"categories": [
|
|
26
|
+
{
|
|
27
|
+
"id": 9,
|
|
28
|
+
"name": "Clothing",
|
|
29
|
+
"slug": "clothing"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": 14,
|
|
33
|
+
"name": "T-shirts",
|
|
34
|
+
"slug": "t-shirts"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"cross_sell_ids": [],
|
|
38
|
+
"date_created": "2017-03-23T17:01:14",
|
|
39
|
+
"date_created_gmt": "2017-03-23T20:01:14",
|
|
40
|
+
"date_modified": "2017-03-23T17:01:14",
|
|
41
|
+
"date_modified_gmt": "2017-03-23T20:01:14",
|
|
42
|
+
"date_on_sale_from": null,
|
|
43
|
+
"date_on_sale_from_gmt": null,
|
|
44
|
+
"date_on_sale_to": null,
|
|
45
|
+
"date_on_sale_to_gmt": null,
|
|
46
|
+
"default_attributes": [],
|
|
47
|
+
"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",
|
|
48
|
+
"dimensions": {
|
|
49
|
+
"height": "",
|
|
50
|
+
"length": "",
|
|
51
|
+
"width": ""
|
|
52
|
+
},
|
|
53
|
+
"download_expiry": -1,
|
|
54
|
+
"download_limit": -1,
|
|
55
|
+
"downloadable": false,
|
|
56
|
+
"downloads": [],
|
|
57
|
+
"external_url": "",
|
|
58
|
+
"featured": false,
|
|
59
|
+
"grouped_products": [],
|
|
60
|
+
"id": 794,
|
|
61
|
+
"images": [
|
|
62
|
+
{
|
|
63
|
+
"alt": "",
|
|
64
|
+
"date_created": "2017-03-23T14:01:13",
|
|
65
|
+
"date_created_gmt": "2017-03-23T20:01:13",
|
|
66
|
+
"date_modified": "2017-03-23T14:01:13",
|
|
67
|
+
"date_modified_gmt": "2017-03-23T20:01:13",
|
|
68
|
+
"id": 792,
|
|
69
|
+
"name": "",
|
|
70
|
+
"src": "https://example.com/wp-content/uploads/2017/03/T_2_front-4.jpg"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"alt": "",
|
|
74
|
+
"date_created": "2017-03-23T14:01:14",
|
|
75
|
+
"date_created_gmt": "2017-03-23T20:01:14",
|
|
76
|
+
"date_modified": "2017-03-23T14:01:14",
|
|
77
|
+
"date_modified_gmt": "2017-03-23T20:01:14",
|
|
78
|
+
"id": 793,
|
|
79
|
+
"name": "",
|
|
80
|
+
"src": "https://example.com/wp-content/uploads/2017/03/T_2_back-2.jpg"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"manage_stock": true,
|
|
84
|
+
"menu_order": 0,
|
|
85
|
+
"meta_data": [],
|
|
86
|
+
"name": "Premium Quality",
|
|
87
|
+
"on_sale": false,
|
|
88
|
+
"parent_id": 0,
|
|
89
|
+
"permalink": "https://example.com/product/premium-quality-19/",
|
|
90
|
+
"price": "21.99",
|
|
91
|
+
"price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</span>",
|
|
92
|
+
"purchasable": true,
|
|
93
|
+
"purchase_note": "",
|
|
94
|
+
"rating_count": 0,
|
|
95
|
+
"regular_price": "21.99",
|
|
96
|
+
"related_ids": [
|
|
97
|
+
53,
|
|
98
|
+
40,
|
|
99
|
+
56,
|
|
100
|
+
479,
|
|
101
|
+
99
|
|
102
|
+
],
|
|
103
|
+
"reviews_allowed": true,
|
|
104
|
+
"sale_price": "",
|
|
105
|
+
"shipping_class": "",
|
|
106
|
+
"shipping_class_id": 0,
|
|
107
|
+
"shipping_required": true,
|
|
108
|
+
"shipping_taxable": true,
|
|
109
|
+
"short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
|
|
110
|
+
"sku": "",
|
|
111
|
+
"slug": "premium-quality-19",
|
|
112
|
+
"sold_individually": false,
|
|
113
|
+
"status": "publish",
|
|
114
|
+
"stock_quantity": 12,
|
|
115
|
+
"stock_status": "instock",
|
|
116
|
+
"tags": [],
|
|
117
|
+
"tax_class": "",
|
|
118
|
+
"tax_status": "taxable",
|
|
119
|
+
"total_sales": 0,
|
|
120
|
+
"type": "simple",
|
|
121
|
+
"upsell_ids": [],
|
|
122
|
+
"variations": [],
|
|
123
|
+
"virtual": false,
|
|
124
|
+
"weight": ""
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_ADD_NOTE } from '../WooCommerceAddNote';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceAddNote', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_ADD_NOTE);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_CREATE_PRODUCT } from '../WooCommerceCreateProduct';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceCreateProduct', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_CREATE_PRODUCT);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_CREATE_PRODUCT_CATEGORY } from '../WooCommerceCreateProductCategory';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceCreateProductCategory', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_CREATE_PRODUCT_CATEGORY);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_ORDER_NOTES } from '../WooCommerceGetOrderNotes';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetOrderNotes', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_ORDER_NOTES);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_ORDER_STATUSES } from '../WooCommerceGetOrderStatuses';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetOrderStatuses', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_ORDER_STATUSES);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_PAYMENT_GATEWAYS } from '../WooCommerceGetPaymentGateways';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetPaymentGateways', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_PAYMENT_GATEWAYS);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_PRODUCT } from '../WooCommerceGetProduct';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetProduct', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_PRODUCT);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_PRODUCT_VARIANT } from '../WooCommerceGetProductVariant';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetProductVariant', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mock();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('process - ok', async () => {
|
|
19
|
+
await tester.testConnector(WOO_COMMERCE_GET_PRODUCT_VARIANT);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('process - nok', async () => {
|
|
23
|
+
await tester.testConnector(WOO_COMMERCE_GET_PRODUCT_VARIANT, 'nok');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_PRODUCTS_BY_SKU } from '../WooCommerceGetProductsBySku';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetProductsBySku', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_PRODUCTS_BY_SKU);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_SETTINGS_GENERAL } from '../WooCommerceGetSettingsGeneral';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetSettingsGeneral', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mock();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('process - ok', async () => {
|
|
19
|
+
await tester.testConnector(WOO_COMMERCE_GET_SETTINGS_GENERAL);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('process - with id', async () => {
|
|
23
|
+
await tester.testConnector(WOO_COMMERCE_GET_SETTINGS_GENERAL, 'with-id');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_GET_SHIPPING_METHODS } from '../WooCommerceGetShippingMethods';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceGetShippingMethods', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_GET_SHIPPING_METHODS);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_UPDATE_ORDER } from '../WooCommerceUpdateOrder';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceUpdateOrder', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_UPDATE_ORDER);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_UPDATE_PRODUCT } from '../WooCommerceUpdateProduct';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceUpdateProduct', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_UPDATE_PRODUCT);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_UPDATE_PRODUCT_QUANTITY } from '../WooCommerceUpdateProductQuantity';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceUpdateProductQuantity', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_UPDATE_PRODUCT_QUANTITY);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import { init, mock } from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WOO_COMMERCE_UPDATE_PRODUCT_VARIANT } from '../WooCommerceUpdateProductVariant';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WooCommerceUpdateProductVariant', () => {
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
mock();
|
|
16
|
+
await tester.testConnector(WOO_COMMERCE_UPDATE_PRODUCT_VARIANT);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import CoreFormsEnum, { getFormName } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
|
|
2
|
+
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
3
|
+
import Field from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field';
|
|
4
|
+
import FieldType from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType';
|
|
5
|
+
import Form from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form';
|
|
6
|
+
import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
|
|
7
|
+
import WebhookSubscription from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Webhook/WebhookSubscription';
|
|
8
|
+
import {
|
|
9
|
+
ABasicApplication,
|
|
10
|
+
PASSWORD,
|
|
11
|
+
USER,
|
|
12
|
+
} from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
|
|
13
|
+
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
14
|
+
import { HttpMethods, parseHttpMethod } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
15
|
+
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
16
|
+
import { encode } from '@orchesty/nodejs-sdk/dist/lib/Utils/Base64';
|
|
17
|
+
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
18
|
+
|
|
19
|
+
export const WOOCOMMERCE_URL = 'woocommerceUrl';
|
|
20
|
+
|
|
21
|
+
export const NAME = 'woocommerce';
|
|
22
|
+
|
|
23
|
+
export default class WooCommerceApplication extends ABasicApplication {
|
|
24
|
+
|
|
25
|
+
public getDescription(): string {
|
|
26
|
+
return 'Open-source e-commerce plugin for WordPress, designed for small to large-sized online merchants';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public getName(): string {
|
|
30
|
+
return NAME;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public getPublicName(): string {
|
|
34
|
+
return 'WooCommerce';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public getLogo(): string {
|
|
38
|
+
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIKCSBpZD0iVnJzdHZhXzEiIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIKCSBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMDAgMTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6IzdGNTRCMzt9Cgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTkuMywyMC4zaDgxLjNjNS4xLDAsOS4zLDQuMiw5LjMsOS4zdjMxYzAsNS4xLTQuMiw5LjMtOS4zLDkuM0g2MS40bDQsOS44bC0xNy42LTkuOEg5LjQKCQljLTUuMSwwLTkuMy00LjItOS4zLTkuM3YtMzFDMCwyNC41LDQuMiwyMC4zLDkuMywyMC4zTDkuMywyMC4zeiIvPgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTUuNywyOC44YzAuNi0wLjgsMS40LTEuMiwyLjYtMS4zYzIuMS0wLjIsMy4yLDAuOCwzLjUsMi45YzEuMyw4LjUsMi42LDE1LjcsNC4xLDIxLjZsOC45LTE2LjkKCQljMC44LTEuNSwxLjgtMi40LDMtMi40YzEuOC0wLjEsMi45LDEsMy4zLDMuNGMxLDUuNCwyLjMsMTAsMy45LDEzLjljMS4xLTEwLjMsMi44LTE3LjcsNS40LTIyLjNjMC42LTEuMSwxLjUtMS43LDIuNy0xLjgKCQljMC45LTAuMSwxLjgsMC4yLDIuNiwwLjhjMC44LDAuNiwxLjIsMS40LDEuMywyLjNjMCwwLjctMC4xLDEuMy0wLjQsMS45Yy0xLjYsMi45LTIuOSw3LjgtMy45LDE0LjdjLTEsNi42LTEuNCwxMS44LTEuMSwxNS41CgkJYzAuMSwxLTAuMSwxLjktMC41LDIuN2MtMC41LDAuOS0xLjIsMS40LTIuMiwxLjVjLTEuMSwwLjEtMi4yLTAuNC0zLjItMS41Yy0zLjgtMy45LTYuOC05LjYtOS0xNy4zQzI0LDUxLjUsMjIsNTUuNCwyMC43LDU4CgkJYy0yLjQsNC42LTQuNCw2LjktNi4xLDcuMWMtMS4xLDAuMS0yLTAuOS0yLjgtMi44QzkuNyw1Nyw3LjUsNDYuNyw1LjEsMzEuNUM0LjksMzAuNCw1LjIsMjkuNSw1LjcsMjguOEw1LjcsMjguOHogTTkzLDM1LjEKCQljLTEuNS0yLjYtMy42LTQuMS02LjUtNC43Yy0wLjgtMC4yLTEuNS0wLjItMi4yLTAuMmMtMy45LDAtNy4xLDItOS41LDYuMWMtMi4xLDMuNC0zLjIsNy4zLTMuMiwxMS40YzAsMy4xLDAuNiw1LjgsMS45LDgKCQljMS41LDIuNiwzLjYsNC4xLDYuNSw0LjdjMC44LDAuMiwxLjUsMC4yLDIuMiwwLjJjMy45LDAsNy4xLTIsOS41LTYuMWMyLjEtMy41LDMuMi03LjMsMy4yLTExLjVDOTQuOSw0MCw5NC4zLDM3LjMsOTMsMzUuMXoKCQkgTTg3LjgsNDYuNGMtMC42LDIuNy0xLjYsNC43LTMuMSw2Yy0xLjIsMS4xLTIuMywxLjUtMy4zLDEuM2MtMS0wLjItMS44LTEuMS0yLjQtMi42Yy0wLjUtMS4zLTAuNy0yLjUtMC43LTMuN2MwLTEsMC4xLTIsMC4zLTMKCQljMC40LTEuNywxLjEtMy4zLDIuMi00LjhjMS4zLTIsMi44LTIuOCw0LjItMi41YzEsMC4yLDEuOCwxLjEsMi40LDIuNmMwLjUsMS4zLDAuNywyLjUsMC43LDMuN0M4OC4xLDQ0LjQsODgsNDUuNCw4Ny44LDQ2LjQKCQlMODcuOCw0Ni40eiBNNjcuNSwzNS4xYy0xLjUtMi42LTMuNy00LjEtNi41LTQuN2MtMC44LTAuMi0xLjUtMC4yLTIuMi0wLjJjLTMuOSwwLTcuMSwyLTkuNSw2LjFjLTIuMSwzLjQtMy4yLDcuMy0zLjIsMTEuNAoJCWMwLDMuMSwwLjYsNS44LDEuOSw4YzEuNSwyLjYsMy42LDQuMSw2LjUsNC43YzAuOCwwLjIsMS41LDAuMiwyLjIsMC4yYzMuOSwwLDcuMS0yLDkuNS02LjFjMi4xLTMuNSwzLjItNy4zLDMuMi0xMS41CgkJQzY5LjUsNDAsNjguOCwzNy4zLDY3LjUsMzUuMXogTTYyLjQsNDYuNGMtMC42LDIuNy0xLjYsNC43LTMuMSw2Yy0xLjIsMS4xLTIuMywxLjUtMy4zLDEuM2MtMS0wLjItMS44LTEuMS0yLjQtMi42CgkJYy0wLjUtMS4zLTAuNy0yLjUtMC43LTMuN2MwLTEsMC4xLTIsMC4zLTNjMC40LTEuNywxLjEtMy4zLDIuMi00LjhjMS4zLTIsMi44LTIuOCw0LjItMi41YzEsMC4yLDEuOCwxLjEsMi40LDIuNgoJCWMwLjUsMS4zLDAuNywyLjUsMC43LDMuN0M2Mi43LDQ0LjQsNjIuNiw0NS40LDYyLjQsNDYuNEw2Mi40LDQ2LjR6Ii8+CjwvZz4KPC9zdmc+Cg==';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public getRequestDto(
|
|
42
|
+
dto: AProcessDto,
|
|
43
|
+
applicationInstall: ApplicationInstall,
|
|
44
|
+
method: HttpMethods | string,
|
|
45
|
+
url?: string,
|
|
46
|
+
data?: unknown,
|
|
47
|
+
): RequestDto {
|
|
48
|
+
const settings = applicationInstall.getSettings();
|
|
49
|
+
const base64 = encode(
|
|
50
|
+
`${settings[CoreFormsEnum.AUTHORIZATION_FORM][USER]}:${settings[CoreFormsEnum.AUTHORIZATION_FORM][PASSWORD]}`,
|
|
51
|
+
);
|
|
52
|
+
const headers = {
|
|
53
|
+
[CommonHeaders.AUTHORIZATION]: `Basic ${base64}`,
|
|
54
|
+
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
55
|
+
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
let urlx = url ?? '';
|
|
59
|
+
if (!urlx.startsWith('http')) {
|
|
60
|
+
urlx = `${this.getDecoratedUrl(applicationInstall)}/${urlx}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new RequestDto(urlx, parseHttpMethod(method), dto, data, headers);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public getIsoDateFromDate(date?: string): string {
|
|
67
|
+
return date ? new Date(date).toISOString() : '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public getDecoratedUrl(app: ApplicationInstall): string {
|
|
71
|
+
return app
|
|
72
|
+
.getSettings()?.[CoreFormsEnum.AUTHORIZATION_FORM]?.[WOOCOMMERCE_URL] ?? '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public getFormStack(): FormStack {
|
|
76
|
+
const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
|
|
77
|
+
.addField(new Field(FieldType.TEXT, USER, 'User', undefined, true))
|
|
78
|
+
.addField(new Field(FieldType.TEXT, PASSWORD, 'Password', undefined, true))
|
|
79
|
+
.addField(new Field(FieldType.URL, WOOCOMMERCE_URL, 'Url', undefined, true));
|
|
80
|
+
|
|
81
|
+
return new FormStack().addForm(form);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
85
|
+
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
86
|
+
return authorizationForm?.[USER] && authorizationForm?.[PASSWORD] && authorizationForm?.[WOOCOMMERCE_URL];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public getWebhookSubscriptions(): WebhookSubscription[] {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|