@orchesty/connector-wix 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 +7 -0
- package/LICENSE +190 -0
- package/coverage/clover.xml +125 -0
- package/coverage/coverage-final.json +7 -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 +146 -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/Connector/WixCreateOrderConnector.ts.html +679 -0
- package/coverage/lcov-report/src/Connector/WixCreateProductConnector.ts.html +781 -0
- package/coverage/lcov-report/src/Connector/WixGetOrderConnector.ts.html +493 -0
- package/coverage/lcov-report/src/Connector/WixUpdateProductConnector.ts.html +574 -0
- package/coverage/lcov-report/src/Connector/index.html +161 -0
- package/coverage/lcov-report/src/WixApplication.ts.html +334 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +268 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +189 -0
- package/dist/Connector/WixCreateOrderConnector.d.ts +181 -0
- package/dist/Connector/WixCreateOrderConnector.js +21 -0
- package/dist/Connector/WixCreateProductConnector.d.ts +217 -0
- package/dist/Connector/WixCreateProductConnector.js +21 -0
- package/dist/Connector/WixGetOrderConnector.d.ts +119 -0
- package/dist/Connector/WixGetOrderConnector.js +22 -0
- package/dist/Connector/WixUpdateProductConnector.d.ts +147 -0
- package/dist/Connector/WixUpdateProductConnector.js +22 -0
- package/dist/WixApplication.d.ts +19 -0
- package/dist/WixApplication.js +97 -0
- package/dist/package.json +22 -0
- package/jest.config.js +13 -0
- package/package.json +22 -0
- package/src/Connector/WixCreateOrderConnector.ts +198 -0
- package/src/Connector/WixCreateProductConnector.ts +232 -0
- package/src/Connector/WixGetOrderConnector.ts +136 -0
- package/src/Connector/WixUpdateProductConnector.ts +163 -0
- package/src/Connector/__tests__/Data/WixCreateOrderConnector/input.json +74 -0
- package/src/Connector/__tests__/Data/WixCreateOrderConnector/mock.json +109 -0
- package/src/Connector/__tests__/Data/WixCreateOrderConnector/output.json +110 -0
- package/src/Connector/__tests__/Data/WixCreateProductConnector/input.json +43 -0
- package/src/Connector/__tests__/Data/WixCreateProductConnector/mock.json +180 -0
- package/src/Connector/__tests__/Data/WixCreateProductConnector/output.json +181 -0
- package/src/Connector/__tests__/Data/WixGetOrderConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/WixGetOrderConnector/mock.json +113 -0
- package/src/Connector/__tests__/Data/WixGetOrderConnector/output.json +114 -0
- package/src/Connector/__tests__/Data/WixUpdateProductConnector/input.json +36 -0
- package/src/Connector/__tests__/Data/WixUpdateProductConnector/mock.json +115 -0
- package/src/Connector/__tests__/Data/WixUpdateProductConnector/output.json +117 -0
- package/src/Connector/__tests__/WixCreateOrderConnector.ts +17 -0
- package/src/Connector/__tests__/WixCreateProductConnector.ts +17 -0
- package/src/Connector/__tests__/WixGetOrderConnector.ts +17 -0
- package/src/Connector/__tests__/WixUpdateProductConnector.ts +17 -0
- package/src/WixApplication.ts +83 -0
- package/test/dataProvider.ts +61 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://www.wixapis.com/stores/v2/orders/id",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"order": {
|
|
6
|
+
"id": "fedb19f5-bd4c-4bfc-b2d1-212538319611",
|
|
7
|
+
"number": 10096,
|
|
8
|
+
"dateCreated": "2020-03-18T16:47:59.222Z",
|
|
9
|
+
"currency": "USD",
|
|
10
|
+
"weightUnit": "LB",
|
|
11
|
+
"totals": {
|
|
12
|
+
"subtotal": "10",
|
|
13
|
+
"shipping": "3",
|
|
14
|
+
"tax": "3",
|
|
15
|
+
"discount": "1",
|
|
16
|
+
"total": "15",
|
|
17
|
+
"weight": "30",
|
|
18
|
+
"quantity": 2
|
|
19
|
+
},
|
|
20
|
+
"billingInfo": {
|
|
21
|
+
"paymentMethod": "PayPal",
|
|
22
|
+
"externalTransactionId": "tx_1806",
|
|
23
|
+
"paymentProviderTransactionId": "tx_1806",
|
|
24
|
+
"address": {
|
|
25
|
+
"fullName": {
|
|
26
|
+
"firstName": "John",
|
|
27
|
+
"lastName": "Smith"
|
|
28
|
+
},
|
|
29
|
+
"country": "US",
|
|
30
|
+
"city": "New York",
|
|
31
|
+
"zipCode": "92544",
|
|
32
|
+
"phone": "+972 555234555",
|
|
33
|
+
"email": "Ivanushka@example.com"
|
|
34
|
+
},
|
|
35
|
+
"paidDate": "2020-03-18T16:47:59.244Z"
|
|
36
|
+
},
|
|
37
|
+
"shippingInfo": {
|
|
38
|
+
"deliveryOption": "Express",
|
|
39
|
+
"shippingRegion": "East coast",
|
|
40
|
+
"estimatedDeliveryTime": "Today",
|
|
41
|
+
"shipmentDetails": {
|
|
42
|
+
"address": {
|
|
43
|
+
"fullName": {
|
|
44
|
+
"firstName": "John",
|
|
45
|
+
"lastName": "Smith"
|
|
46
|
+
},
|
|
47
|
+
"country": "US",
|
|
48
|
+
"city": "New York",
|
|
49
|
+
"zipCode": "92544",
|
|
50
|
+
"phone": "+972 555234555",
|
|
51
|
+
"email": "Ivanushka@example.com"
|
|
52
|
+
},
|
|
53
|
+
"discount": "0",
|
|
54
|
+
"tax": "1",
|
|
55
|
+
"priceData": {
|
|
56
|
+
"taxIncludedInPrice": false,
|
|
57
|
+
"price": "3"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"read": false,
|
|
62
|
+
"archived": false,
|
|
63
|
+
"paymentStatus": "PAID",
|
|
64
|
+
"fulfillmentStatus": "NOT_FULFILLED",
|
|
65
|
+
"lineItems": [
|
|
66
|
+
{
|
|
67
|
+
"index": 1,
|
|
68
|
+
"quantity": 2,
|
|
69
|
+
"price": "5",
|
|
70
|
+
"name": "my product",
|
|
71
|
+
"productId": "a1f9d337-f831-4529-31e6-67db8fd4e1aa",
|
|
72
|
+
"totalPrice": "10",
|
|
73
|
+
"lineItemType": "PHYSICAL",
|
|
74
|
+
"options": [],
|
|
75
|
+
"customTextFields": [],
|
|
76
|
+
"weight": "15",
|
|
77
|
+
"sku": "12345678",
|
|
78
|
+
"discount": "1",
|
|
79
|
+
"tax": "1",
|
|
80
|
+
"taxIncludedInPrice": false,
|
|
81
|
+
"priceData": {
|
|
82
|
+
"taxIncludedInPrice": false,
|
|
83
|
+
"price": "5",
|
|
84
|
+
"totalPrice": "10"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"activities": [
|
|
89
|
+
{
|
|
90
|
+
"type": "ORDER_PLACED",
|
|
91
|
+
"timestamp": "2020-03-18T16:47:59.222Z"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"type": "ORDER_PAID",
|
|
95
|
+
"timestamp": "2020-03-18T16:47:59.244Z"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"fulfillments": [],
|
|
99
|
+
"discount": {
|
|
100
|
+
"value": "1"
|
|
101
|
+
},
|
|
102
|
+
"buyerLanguage": "en",
|
|
103
|
+
"channelInfo": {
|
|
104
|
+
"type": "WEB"
|
|
105
|
+
},
|
|
106
|
+
"enteredBy": {
|
|
107
|
+
"id": "e85274cf-047a-4989-baff-dac5e0c3971d",
|
|
108
|
+
"identityType": "USER"
|
|
109
|
+
},
|
|
110
|
+
"lastUpdated": "2020-03-18T16:47:59.244Z"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": {
|
|
6
|
+
"order": {
|
|
7
|
+
"id": "fedb19f5-bd4c-4bfc-b2d1-212538319611",
|
|
8
|
+
"number": 10096,
|
|
9
|
+
"dateCreated": "2020-03-18T16:47:59.222Z",
|
|
10
|
+
"currency": "USD",
|
|
11
|
+
"weightUnit": "LB",
|
|
12
|
+
"totals": {
|
|
13
|
+
"subtotal": "10",
|
|
14
|
+
"shipping": "3",
|
|
15
|
+
"tax": "3",
|
|
16
|
+
"discount": "1",
|
|
17
|
+
"total": "15",
|
|
18
|
+
"weight": "30",
|
|
19
|
+
"quantity": 2
|
|
20
|
+
},
|
|
21
|
+
"billingInfo": {
|
|
22
|
+
"paymentMethod": "PayPal",
|
|
23
|
+
"externalTransactionId": "tx_1806",
|
|
24
|
+
"paymentProviderTransactionId": "tx_1806",
|
|
25
|
+
"address": {
|
|
26
|
+
"fullName": {
|
|
27
|
+
"firstName": "John",
|
|
28
|
+
"lastName": "Smith"
|
|
29
|
+
},
|
|
30
|
+
"country": "US",
|
|
31
|
+
"city": "New York",
|
|
32
|
+
"zipCode": "92544",
|
|
33
|
+
"phone": "+972 555234555",
|
|
34
|
+
"email": "Ivanushka@example.com"
|
|
35
|
+
},
|
|
36
|
+
"paidDate": "2020-03-18T16:47:59.244Z"
|
|
37
|
+
},
|
|
38
|
+
"shippingInfo": {
|
|
39
|
+
"deliveryOption": "Express",
|
|
40
|
+
"shippingRegion": "East coast",
|
|
41
|
+
"estimatedDeliveryTime": "Today",
|
|
42
|
+
"shipmentDetails": {
|
|
43
|
+
"address": {
|
|
44
|
+
"fullName": {
|
|
45
|
+
"firstName": "John",
|
|
46
|
+
"lastName": "Smith"
|
|
47
|
+
},
|
|
48
|
+
"country": "US",
|
|
49
|
+
"city": "New York",
|
|
50
|
+
"zipCode": "92544",
|
|
51
|
+
"phone": "+972 555234555",
|
|
52
|
+
"email": "Ivanushka@example.com"
|
|
53
|
+
},
|
|
54
|
+
"discount": "0",
|
|
55
|
+
"tax": "1",
|
|
56
|
+
"priceData": {
|
|
57
|
+
"taxIncludedInPrice": false,
|
|
58
|
+
"price": "3"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"read": false,
|
|
63
|
+
"archived": false,
|
|
64
|
+
"paymentStatus": "PAID",
|
|
65
|
+
"fulfillmentStatus": "NOT_FULFILLED",
|
|
66
|
+
"lineItems": [
|
|
67
|
+
{
|
|
68
|
+
"index": 1,
|
|
69
|
+
"quantity": 2,
|
|
70
|
+
"price": "5",
|
|
71
|
+
"name": "my product",
|
|
72
|
+
"productId": "a1f9d337-f831-4529-31e6-67db8fd4e1aa",
|
|
73
|
+
"totalPrice": "10",
|
|
74
|
+
"lineItemType": "PHYSICAL",
|
|
75
|
+
"options": [],
|
|
76
|
+
"customTextFields": [],
|
|
77
|
+
"weight": "15",
|
|
78
|
+
"sku": "12345678",
|
|
79
|
+
"discount": "1",
|
|
80
|
+
"tax": "1",
|
|
81
|
+
"taxIncludedInPrice": false,
|
|
82
|
+
"priceData": {
|
|
83
|
+
"taxIncludedInPrice": false,
|
|
84
|
+
"price": "5",
|
|
85
|
+
"totalPrice": "10"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"activities": [
|
|
90
|
+
{
|
|
91
|
+
"type": "ORDER_PLACED",
|
|
92
|
+
"timestamp": "2020-03-18T16:47:59.222Z"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "ORDER_PAID",
|
|
96
|
+
"timestamp": "2020-03-18T16:47:59.244Z"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"fulfillments": [],
|
|
100
|
+
"discount": {
|
|
101
|
+
"value": "1"
|
|
102
|
+
},
|
|
103
|
+
"buyerLanguage": "en",
|
|
104
|
+
"channelInfo": {
|
|
105
|
+
"type": "WEB"
|
|
106
|
+
},
|
|
107
|
+
"enteredBy": {
|
|
108
|
+
"id": "e85274cf-047a-4989-baff-dac5e0c3971d",
|
|
109
|
+
"identityType": "USER"
|
|
110
|
+
},
|
|
111
|
+
"lastUpdated": "2020-03-18T16:47:59.244Z"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": {
|
|
6
|
+
"productId": "productID",
|
|
7
|
+
"product": {
|
|
8
|
+
"name": "T-shirt",
|
|
9
|
+
"productType": "physical",
|
|
10
|
+
"priceData": {
|
|
11
|
+
"price": 12.5
|
|
12
|
+
},
|
|
13
|
+
"description": "nice summer t-shirt",
|
|
14
|
+
"sku": "123df",
|
|
15
|
+
"visible": false,
|
|
16
|
+
"weight": 0.2,
|
|
17
|
+
"ribbon": "Sold Out",
|
|
18
|
+
"brand": "Nice",
|
|
19
|
+
"discount": {
|
|
20
|
+
"type": "AMOUNT",
|
|
21
|
+
"value": 2
|
|
22
|
+
},
|
|
23
|
+
"productOptions": [
|
|
24
|
+
{
|
|
25
|
+
"name": "Size",
|
|
26
|
+
"choices": [
|
|
27
|
+
{
|
|
28
|
+
"value": "S",
|
|
29
|
+
"description": "Small"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "PATCH https://www.wixapis.com/stores/v1/products/productID",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"product": {
|
|
6
|
+
"id": "83f41911-5375-4ede-aafa-68f8b6dee9e2",
|
|
7
|
+
"name": "T-shirt",
|
|
8
|
+
"slug": "t-shirt-1",
|
|
9
|
+
"visible": false,
|
|
10
|
+
"productType": "physical",
|
|
11
|
+
"description": "nice summer t-shirt",
|
|
12
|
+
"stock": {
|
|
13
|
+
"trackInventory": false,
|
|
14
|
+
"inStock": true
|
|
15
|
+
},
|
|
16
|
+
"price": {
|
|
17
|
+
"currency": "USD",
|
|
18
|
+
"price": 12.5,
|
|
19
|
+
"discountedPrice": 10.5,
|
|
20
|
+
"formatted": {
|
|
21
|
+
"price": "$12.50",
|
|
22
|
+
"discountedPrice": "$10.50"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"priceData": {
|
|
26
|
+
"currency": "USD",
|
|
27
|
+
"price": 12.5,
|
|
28
|
+
"discountedPrice": 10.5,
|
|
29
|
+
"formatted": {
|
|
30
|
+
"price": "$12.50",
|
|
31
|
+
"discountedPrice": "$10.50"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"convertedPriceData": {
|
|
35
|
+
"currency": "USD",
|
|
36
|
+
"price": 12.5,
|
|
37
|
+
"discountedPrice": 10.5,
|
|
38
|
+
"formatted": {
|
|
39
|
+
"price": "$12.50",
|
|
40
|
+
"discountedPrice": "$10.50"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"additionalInfoSections": [],
|
|
44
|
+
"ribbons": [
|
|
45
|
+
{
|
|
46
|
+
"text": "Sold Out"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"media": {
|
|
50
|
+
"items": []
|
|
51
|
+
},
|
|
52
|
+
"customTextFields": [],
|
|
53
|
+
"manageVariants": true,
|
|
54
|
+
"productOptions": [
|
|
55
|
+
{
|
|
56
|
+
"optionType": "drop_down",
|
|
57
|
+
"name": "Size",
|
|
58
|
+
"choices": [
|
|
59
|
+
{
|
|
60
|
+
"value": "S",
|
|
61
|
+
"description": "Small",
|
|
62
|
+
"inStock": true,
|
|
63
|
+
"visible": true
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"productPageUrl": {
|
|
69
|
+
"base": "https://roysha.wixsite.com/roycoffeestore",
|
|
70
|
+
"path": "/product-page/t-shirt-1"
|
|
71
|
+
},
|
|
72
|
+
"numericId": "1620048324853000",
|
|
73
|
+
"inventoryItemId": "7c0be6ee-ac8a-b121-5505-97074921161d",
|
|
74
|
+
"discount": {
|
|
75
|
+
"type": "AMOUNT",
|
|
76
|
+
"value": 2
|
|
77
|
+
},
|
|
78
|
+
"collectionIds": [],
|
|
79
|
+
"variants": [
|
|
80
|
+
{
|
|
81
|
+
"id": "9a86bab7-0558-48a7-a953-0594e6d5534d",
|
|
82
|
+
"choices": {
|
|
83
|
+
"Size": "Small"
|
|
84
|
+
},
|
|
85
|
+
"variant": {
|
|
86
|
+
"priceData": {
|
|
87
|
+
"currency": "USD",
|
|
88
|
+
"price": 12.5,
|
|
89
|
+
"discountedPrice": 10.5,
|
|
90
|
+
"formatted": {
|
|
91
|
+
"price": "$12.50",
|
|
92
|
+
"discountedPrice": "$10.50"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"convertedPriceData": {
|
|
96
|
+
"currency": "USD",
|
|
97
|
+
"price": 12.5,
|
|
98
|
+
"discountedPrice": 10.5,
|
|
99
|
+
"formatted": {
|
|
100
|
+
"price": "$12.50",
|
|
101
|
+
"discountedPrice": "$10.50"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"weight": 0.2,
|
|
105
|
+
"sku": "123df",
|
|
106
|
+
"visible": false
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"lastUpdated": "2021-05-03T13:44:17.610Z",
|
|
111
|
+
"ribbon": "Sold Out",
|
|
112
|
+
"brand": "Nice"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": {
|
|
6
|
+
"product": {
|
|
7
|
+
"id": "83f41911-5375-4ede-aafa-68f8b6dee9e2",
|
|
8
|
+
"name": "T-shirt",
|
|
9
|
+
"slug": "t-shirt-1",
|
|
10
|
+
"visible": false,
|
|
11
|
+
"productType": "physical",
|
|
12
|
+
"description": "nice summer t-shirt",
|
|
13
|
+
"stock": {
|
|
14
|
+
"trackInventory": false,
|
|
15
|
+
"inStock": true
|
|
16
|
+
},
|
|
17
|
+
"price": {
|
|
18
|
+
"currency": "USD",
|
|
19
|
+
"price": 12.5,
|
|
20
|
+
"discountedPrice": 10.5,
|
|
21
|
+
"formatted": {
|
|
22
|
+
"price": "$12.50",
|
|
23
|
+
"discountedPrice": "$10.50"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"priceData": {
|
|
27
|
+
"currency": "USD",
|
|
28
|
+
"price": 12.5,
|
|
29
|
+
"discountedPrice": 10.5,
|
|
30
|
+
"formatted": {
|
|
31
|
+
"price": "$12.50",
|
|
32
|
+
"discountedPrice": "$10.50"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"convertedPriceData": {
|
|
36
|
+
"currency": "USD",
|
|
37
|
+
"price": 12.5,
|
|
38
|
+
"discountedPrice": 10.5,
|
|
39
|
+
"formatted": {
|
|
40
|
+
"price": "$12.50",
|
|
41
|
+
"discountedPrice": "$10.50"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"additionalInfoSections": [],
|
|
45
|
+
"ribbons": [
|
|
46
|
+
{
|
|
47
|
+
"text": "Sold Out"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"media": {
|
|
51
|
+
"items": []
|
|
52
|
+
},
|
|
53
|
+
"customTextFields": [],
|
|
54
|
+
"manageVariants": true,
|
|
55
|
+
"productOptions": [
|
|
56
|
+
{
|
|
57
|
+
"optionType": "drop_down",
|
|
58
|
+
"name": "Size",
|
|
59
|
+
"choices": [
|
|
60
|
+
{
|
|
61
|
+
"value": "S",
|
|
62
|
+
"description": "Small",
|
|
63
|
+
"inStock": true,
|
|
64
|
+
"visible": true
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"productPageUrl": {
|
|
70
|
+
"base": "https://roysha.wixsite.com/roycoffeestore",
|
|
71
|
+
"path": "/product-page/t-shirt-1"
|
|
72
|
+
},
|
|
73
|
+
"numericId": "1620048324853000",
|
|
74
|
+
"inventoryItemId": "7c0be6ee-ac8a-b121-5505-97074921161d",
|
|
75
|
+
"discount": {
|
|
76
|
+
"type": "AMOUNT",
|
|
77
|
+
"value": 2
|
|
78
|
+
},
|
|
79
|
+
"collectionIds": [],
|
|
80
|
+
"variants": [
|
|
81
|
+
{
|
|
82
|
+
"id": "9a86bab7-0558-48a7-a953-0594e6d5534d",
|
|
83
|
+
"choices": {
|
|
84
|
+
"Size": "Small"
|
|
85
|
+
},
|
|
86
|
+
"variant": {
|
|
87
|
+
"priceData": {
|
|
88
|
+
"currency": "USD",
|
|
89
|
+
"price": 12.5,
|
|
90
|
+
"discountedPrice": 10.5,
|
|
91
|
+
"formatted": {
|
|
92
|
+
"price": "$12.50",
|
|
93
|
+
"discountedPrice": "$10.50"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"convertedPriceData": {
|
|
97
|
+
"currency": "USD",
|
|
98
|
+
"price": 12.5,
|
|
99
|
+
"discountedPrice": 10.5,
|
|
100
|
+
"formatted": {
|
|
101
|
+
"price": "$12.50",
|
|
102
|
+
"discountedPrice": "$10.50"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"weight": 0.2,
|
|
106
|
+
"sku": "123df",
|
|
107
|
+
"visible": false
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"lastUpdated": "2021-05-03T13:44:17.610Z",
|
|
112
|
+
"ribbon": "Sold Out",
|
|
113
|
+
"brand": "Nice"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WIX_CREATE_ORDER_CONNECTOR } from '../WixCreateOrderConnector';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WixCreateOrderConnector', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testConnector(WIX_CREATE_ORDER_CONNECTOR);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WIX_CREATE_PRODUCT_CONNECTOR } from '../WixCreateProductConnector';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WixCreateProductConnector', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testConnector(WIX_CREATE_PRODUCT_CONNECTOR);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WIX_GET_ORDER_CONNECTOR } from '../WixGetOrderConnector';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WixGetOrderConnector', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testConnector(WIX_GET_ORDER_CONNECTOR);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as WIX_UPDATE_PRODUCT_CONNECTOR } from '../WixUpdateProductConnector';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WixUpdateProductConnector', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename, true);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testConnector(WIX_UPDATE_PRODUCT_CONNECTOR);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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 AOAuth2Application from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/AOAuth2Application';
|
|
8
|
+
import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
|
|
9
|
+
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
10
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
11
|
+
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
12
|
+
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
13
|
+
|
|
14
|
+
export const NAME = 'wix';
|
|
15
|
+
|
|
16
|
+
export default class WixApplication extends AOAuth2Application {
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
+
public getScopes(applicationInstall: ApplicationInstall): string[] {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public getName(): string {
|
|
24
|
+
return NAME;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getAuthUrl(): string {
|
|
28
|
+
return 'https://www.wix.com/installer/install';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public getTokenUrl(): string {
|
|
32
|
+
return 'https://www.wixapis.com/oauth/access';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public getPublicName(): string {
|
|
36
|
+
return 'Wix';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public getDescription(): string {
|
|
40
|
+
return 'Simple cloud-based platform for web development';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public getLogo(): string {
|
|
44
|
+
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IlZyc3R2YV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAwIDEwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBkPSJNNjEuNSwzMC43YzAsMiwwLjMsNS4xLTQuNSw2LjhjLTEuNSwwLjUtMi41LDEuNS0yLjUsMS41YzAtNC44LDAuNy02LjYsMi43LTcuNkM1OC43LDMwLjYsNjEuNSwzMC43LDYxLjUsMzAuN3ogTTQzLjQsMzYuMgoJbC01LjMsMjAuN0wzMy42LDQwYy0xLjItNS0zLjItNy42LTcuNS03LjZjLTQuMywwLTYuMywyLjUtNy41LDcuNmwtNC40LDE2LjlMOC43LDM2LjJjLTAuOS00LjItNC45LTYtOC42LTUuNWwxMC4yLDM4LjYKCWMwLDAsMy40LDAuMiw1LjEtMC42YzIuMi0xLjEsMy4zLTIsNC42LTcuM2MxLjItNC43LDQuNS0xOC41LDQuOS0xOS40YzAuNy0yLjMsMS43LTIuMiwyLjQsMGMwLjMsMSwzLjcsMTQuOCw0LjksMTkuNAoJYzEuMyw1LjMsMi40LDYuMSw0LjYsNy4zYzEuNywwLjksNS4xLDAuNiw1LjEsMC42TDUyLDMwLjdDNDguMiwzMC4yLDQ0LjMsMzIuMSw0My40LDM2LjJMNDMuNCwzNi4yeiBNNjEuNCwzN2MwLDAtMC42LDEtMi4xLDEuOAoJYy0wLjksMC41LTEuOCwwLjktMi44LDEuM2MtMi40LDEuMS0yLjEsMi4yLTIuMSw1LjV2MjMuN2MwLDAsMi42LDAuMyw0LjMtMC41YzIuMi0xLjEsMi43LTIuMiwyLjctN1YzOC40bDAsMEw2MS40LDM3TDYxLjQsMzd6CgkgTTg2LjksNTAuMWwxMy0xOS4zYzAsMC01LjUtMC45LTguMiwxLjVjLTIuMSwxLjktMy44LDQuNi04LjQsMTEuM2MtMC4xLDAuMS0xLDEuNi0yLDBjLTQuNi02LjYtNi40LTkuNC04LjQtMTEuMwoJYy0yLjctMi41LTguMi0xLjUtOC4yLTEuNWwxMywxOS4zTDY0LjYsNjkuNGMwLDAsNS43LDAuNyw4LjQtMS43YzEuOC0xLjYsMi43LTMuMiw4LjItMTFjMS4xLTEuNiwyLTAuMSwyLDBjNC42LDYuNiw2LjEsOSw4LjMsMTEKCWMyLjcsMi41LDguMywxLjcsOC4zLDEuN0w4Ni45LDUwLjFMODYuOSw1MC4xeiIvPgo8L3N2Zz4K';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public getRequestDto(
|
|
48
|
+
dto: AProcessDto,
|
|
49
|
+
applicationInstall: ApplicationInstall,
|
|
50
|
+
method: HttpMethods,
|
|
51
|
+
_url?: string,
|
|
52
|
+
data?: unknown,
|
|
53
|
+
): RequestDto {
|
|
54
|
+
const request = new RequestDto(`https://www.wixapis.com/stores/${_url}`, method, dto);
|
|
55
|
+
request.setHeaders({
|
|
56
|
+
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
57
|
+
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
58
|
+
[CommonHeaders.AUTHORIZATION]: this.getAccessToken(applicationInstall),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (data) {
|
|
62
|
+
request.setJsonBody(data);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return request;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public getFormStack(): FormStack {
|
|
69
|
+
const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
|
|
70
|
+
.addField(new Field(FieldType.TEXT, CLIENT_ID, 'Client Id', undefined, true))
|
|
71
|
+
.addField(new Field(FieldType.TEXT, CLIENT_SECRET, 'Client Secret', undefined, true));
|
|
72
|
+
|
|
73
|
+
return new FormStack().addForm(form);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
77
|
+
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
78
|
+
return super.isAuthorized(applicationInstall)
|
|
79
|
+
&& authorizationForm?.[CLIENT_ID]
|
|
80
|
+
&& authorizationForm?.[CLIENT_SECRET];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|