@orchesty/connector-wix 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/package.json +4 -1
  2. package/package.json +4 -1
  3. package/CHANGELOG.md +0 -7
  4. package/coverage/clover.xml +0 -125
  5. package/coverage/coverage-final.json +0 -7
  6. package/coverage/lcov-report/base.css +0 -224
  7. package/coverage/lcov-report/block-navigation.js +0 -87
  8. package/coverage/lcov-report/favicon.png +0 -0
  9. package/coverage/lcov-report/index.html +0 -146
  10. package/coverage/lcov-report/prettify.css +0 -1
  11. package/coverage/lcov-report/prettify.js +0 -2
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/sorter.js +0 -210
  14. package/coverage/lcov-report/src/Connector/WixCreateOrderConnector.ts.html +0 -679
  15. package/coverage/lcov-report/src/Connector/WixCreateProductConnector.ts.html +0 -781
  16. package/coverage/lcov-report/src/Connector/WixGetOrderConnector.ts.html +0 -493
  17. package/coverage/lcov-report/src/Connector/WixUpdateProductConnector.ts.html +0 -574
  18. package/coverage/lcov-report/src/Connector/index.html +0 -161
  19. package/coverage/lcov-report/src/WixApplication.ts.html +0 -334
  20. package/coverage/lcov-report/src/index.html +0 -116
  21. package/coverage/lcov-report/test/dataProvider.ts.html +0 -268
  22. package/coverage/lcov-report/test/index.html +0 -116
  23. package/coverage/lcov.info +0 -189
  24. package/jest.config.js +0 -13
  25. package/src/Connector/WixCreateOrderConnector.ts +0 -198
  26. package/src/Connector/WixCreateProductConnector.ts +0 -232
  27. package/src/Connector/WixGetOrderConnector.ts +0 -136
  28. package/src/Connector/WixUpdateProductConnector.ts +0 -163
  29. package/src/Connector/__tests__/Data/WixCreateOrderConnector/input.json +0 -74
  30. package/src/Connector/__tests__/Data/WixCreateOrderConnector/mock.json +0 -109
  31. package/src/Connector/__tests__/Data/WixCreateOrderConnector/output.json +0 -110
  32. package/src/Connector/__tests__/Data/WixCreateProductConnector/input.json +0 -43
  33. package/src/Connector/__tests__/Data/WixCreateProductConnector/mock.json +0 -180
  34. package/src/Connector/__tests__/Data/WixCreateProductConnector/output.json +0 -181
  35. package/src/Connector/__tests__/Data/WixGetOrderConnector/input.json +0 -8
  36. package/src/Connector/__tests__/Data/WixGetOrderConnector/mock.json +0 -113
  37. package/src/Connector/__tests__/Data/WixGetOrderConnector/output.json +0 -114
  38. package/src/Connector/__tests__/Data/WixUpdateProductConnector/input.json +0 -36
  39. package/src/Connector/__tests__/Data/WixUpdateProductConnector/mock.json +0 -115
  40. package/src/Connector/__tests__/Data/WixUpdateProductConnector/output.json +0 -117
  41. package/src/Connector/__tests__/WixCreateOrderConnector.ts +0 -17
  42. package/src/Connector/__tests__/WixCreateProductConnector.ts +0 -17
  43. package/src/Connector/__tests__/WixGetOrderConnector.ts +0 -17
  44. package/src/Connector/__tests__/WixUpdateProductConnector.ts +0 -17
  45. package/src/WixApplication.ts +0 -83
  46. package/test/dataProvider.ts +0 -61
  47. package/tsconfig.json +0 -8
  48. package/tsconfig.prod.json +0 -13
  49. package/tsconfig.prod.tsbuildinfo +0 -1
@@ -1,163 +0,0 @@
1
- import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
-
5
- export const NAME = 'wix-update-product-connector';
6
-
7
- export default class WixUpdateProductConnector extends AConnector {
8
-
9
- public getName(): string {
10
- return NAME;
11
- }
12
-
13
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
14
- const { productId, ...body } = dto.getJsonData();
15
-
16
- const appInstall = await this.getApplicationInstallFromProcess(dto);
17
- const req = await this.getApplication().getRequestDto(
18
- dto,
19
- appInstall,
20
- HttpMethods.PATCH,
21
- `v1/products/${productId}`,
22
- body,
23
- );
24
- const resp = await this.getSender().send<IOutput>(req, [200]);
25
-
26
- return dto.setNewJsonData(resp.getJsonBody());
27
- }
28
-
29
- }
30
-
31
- /* eslint-disable @typescript-eslint/naming-convention */
32
- export interface IInput {
33
- productId: string;
34
- product: {
35
- name: string;
36
- productType: string;
37
- priceData: {
38
- price: number;
39
- };
40
- description: string;
41
- sku: string;
42
- visible: boolean;
43
- weight: number;
44
- ribbon: string;
45
- brand: string;
46
- discount: {
47
- type: string;
48
- value: number;
49
- };
50
- productOptions: [
51
- {
52
- name: string;
53
- choices: [
54
- {
55
- value: string;
56
- description: string;
57
- },
58
- ];
59
- },
60
- ];
61
- };
62
-
63
- }
64
-
65
- export interface IOutput {
66
- product: {
67
- id: string;
68
- name: string;
69
- slug: string;
70
- visible: boolean;
71
- productType: string;
72
- description: string;
73
- stock: {
74
- trackInventory: boolean;
75
- inStock: boolean;
76
- };
77
- price: {
78
- currency: string;
79
- price: number;
80
- discountedPrice: number;
81
- formatted: {
82
- price: string;
83
- discountedPrice: string;
84
- };
85
- };
86
- priceData: {
87
- currency: string;
88
- price: string;
89
- discountedPrice: number;
90
- formatted: {
91
- price: string;
92
- discountedPrice: string;
93
- };
94
- };
95
- convertedPriceData: {
96
- currency: string;
97
- price: number;
98
- discountedPrice: number;
99
- formatted: {
100
- price: string;
101
- discountedPrice: string;
102
- };
103
- };
104
- additionalInfoSections: [];
105
- ribbons: { text: string }[];
106
- media: { items: [] };
107
- customTextFields: [];
108
- manageVariants: boolean;
109
- productOptions: [{
110
- optionType: string;
111
- name: string;
112
- choices: [{
113
- value: string;
114
- description: string;
115
- inStock: boolean;
116
- visible: boolean;
117
- }];
118
- }];
119
- productPageUrl: {
120
- base: string;
121
- path: string;
122
- };
123
- numericId: string;
124
- inventoryItemId: string;
125
- discount: {
126
- type: string;
127
- value: number;
128
- };
129
- collectionIds: [];
130
- variants: [{
131
- id: string;
132
- choices: { Size: string };
133
- variant: {
134
- priceData: {
135
- currency: string;
136
- price: number;
137
- discountedPrice: number;
138
- formatted: {
139
- price: string;
140
- discountedPrice: string;
141
- };
142
- };
143
- convertedPriceData: {
144
- currency: string;
145
- price: number;
146
- discountedPrice: number;
147
- formatted: {
148
- price: string;
149
- discountedPrice: string;
150
- };
151
- };
152
- weight: number;
153
- sku: string;
154
- visible: boolean;
155
- };
156
- }];
157
- lastUpdated: string;
158
- ribbon: string;
159
- brand: string;
160
- };
161
- }
162
-
163
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,74 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- "order": {
7
- "totals": {
8
- "subtotal": "10",
9
- "shipping": "3",
10
- "tax": "3",
11
- "discount": "1",
12
- "total": "15"
13
- },
14
- "billingInfo": {
15
- "paymentMethod": "PayPal",
16
- "paymentProviderTransactionId": "tx_1806",
17
- "address": {
18
- "fullName": {
19
- "firstName": "John",
20
- "lastName": "Smith"
21
- },
22
- "country": "US",
23
- "city": "New York",
24
- "zipCode": "92544",
25
- "phone": "+972 555234555",
26
- "email": "Ivanushka@example.com"
27
- }
28
- },
29
- "shippingInfo": {
30
- "deliveryOption": "Express",
31
- "estimatedDeliveryTime": "Today",
32
- "shippingRegion": "Domestic",
33
- "shipmentDetails": {
34
- "address": {
35
- "fullName": {
36
- "firstName": "John",
37
- "lastName": "Smith"
38
- },
39
- "country": "US",
40
- "city": "New York",
41
- "zipCode": "92544",
42
- "phone": "+972 555234555",
43
- "email": "Ivanushka@example.com"
44
- },
45
- "tax": "1",
46
- "priceData": {
47
- "taxIncludedInPrice": false,
48
- "price": "3"
49
- }
50
- }
51
- },
52
- "paymentStatus": "PAID",
53
- "lineItems": [
54
- {
55
- "quantity": 2,
56
- "discount": "1",
57
- "tax": "1",
58
- "name": "my product",
59
- "productId": "a1f9d337-f831-4529-31e6-67db8fd4e1aa",
60
- "lineItemType": "PHYSICAL",
61
- "weight": "15",
62
- "sku": "12345678",
63
- "priceData": {
64
- "taxIncludedInPrice": false,
65
- "price": "5"
66
- }
67
- }
68
- ],
69
- "channelInfo": {
70
- "type": "WEB"
71
- }
72
- }
73
- }
74
- }
@@ -1,109 +0,0 @@
1
- {
2
- "http": "POST https://www.wixapis.com/stores/v2/orders",
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
- "estimatedDeliveryTime": "Today",
40
- "shipmentDetails": {
41
- "address": {
42
- "fullName": {
43
- "firstName": "John",
44
- "lastName": "Smith"
45
- },
46
- "country": "US",
47
- "city": "New York",
48
- "zipCode": "92544",
49
- "phone": "+972 555234555",
50
- "email": "Ivanushka@example.com"
51
- },
52
- "discount": "0",
53
- "tax": "1",
54
- "priceData": {
55
- "taxIncludedInPrice": false,
56
- "price": "3"
57
- }
58
- }
59
- },
60
- "read": false,
61
- "archived": false,
62
- "paymentStatus": "PAID",
63
- "fulfillmentStatus": "NOT_FULFILLED",
64
- "lineItems": [
65
- {
66
- "index": 1,
67
- "quantity": 2,
68
- "name": "my product",
69
- "productId": "a1f9d337-f831-4529-31e6-67db8fd4e1aa",
70
- "lineItemType": "PHYSICAL",
71
- "options": [],
72
- "customTextFields": [],
73
- "weight": "15",
74
- "sku": "12345678",
75
- "discount": "1",
76
- "tax": "1",
77
- "priceData": {
78
- "taxIncludedInPrice": false,
79
- "price": "5",
80
- "totalPrice": "10"
81
- }
82
- }
83
- ],
84
- "activities": [
85
- {
86
- "type": "ORDER_PLACED",
87
- "timestamp": "2020-03-18T16:47:59.222Z"
88
- },
89
- {
90
- "type": "ORDER_PAID",
91
- "timestamp": "2020-03-18T16:47:59.244Z"
92
- }
93
- ],
94
- "fulfillments": [],
95
- "discount": {
96
- "value": "1"
97
- },
98
- "buyerLanguage": "en",
99
- "channelInfo": {
100
- "type": "WEB"
101
- },
102
- "enteredBy": {
103
- "id": "e85274cf-047a-4989-baff-dac5e0c3971d",
104
- "identityType": "USER"
105
- },
106
- "lastUpdated": "2020-03-18T16:47:59.244Z"
107
- }
108
- }
109
- }
@@ -1,110 +0,0 @@
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
- "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
- "name": "my product",
70
- "productId": "a1f9d337-f831-4529-31e6-67db8fd4e1aa",
71
- "lineItemType": "PHYSICAL",
72
- "options": [],
73
- "customTextFields": [],
74
- "weight": "15",
75
- "sku": "12345678",
76
- "discount": "1",
77
- "tax": "1",
78
- "priceData": {
79
- "taxIncludedInPrice": false,
80
- "price": "5",
81
- "totalPrice": "10"
82
- }
83
- }
84
- ],
85
- "activities": [
86
- {
87
- "type": "ORDER_PLACED",
88
- "timestamp": "2020-03-18T16:47:59.222Z"
89
- },
90
- {
91
- "type": "ORDER_PAID",
92
- "timestamp": "2020-03-18T16:47:59.244Z"
93
- }
94
- ],
95
- "fulfillments": [],
96
- "discount": {
97
- "value": "1"
98
- },
99
- "buyerLanguage": "en",
100
- "channelInfo": {
101
- "type": "WEB"
102
- },
103
- "enteredBy": {
104
- "id": "e85274cf-047a-4989-baff-dac5e0c3971d",
105
- "identityType": "USER"
106
- },
107
- "lastUpdated": "2020-03-18T16:47:59.244Z"
108
- }
109
- }
110
- }
@@ -1,43 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- "product": {
7
- "name": "T-shirt",
8
- "productType": "physical",
9
- "priceData": {
10
- "price": 10.5
11
- },
12
- "costAndProfitData": {
13
- "itemCost": 7
14
- },
15
- "description": "nice summer t-shirt",
16
- "sku": "123df",
17
- "visible": false,
18
- "ribbon": "Sale",
19
- "brand": "Nice",
20
- "weight": 0.2,
21
- "discount": {
22
- "type": "AMOUNT",
23
- "value": 1
24
- },
25
- "manageVariants": true,
26
- "productOptions": [
27
- {
28
- "name": "Size",
29
- "choices": [
30
- {
31
- "value": "S",
32
- "description": "S"
33
- },
34
- {
35
- "value": "L",
36
- "description": "L"
37
- }
38
- ]
39
- }
40
- ]
41
- }
42
- }
43
- }
@@ -1,180 +0,0 @@
1
- {
2
- "http": "POST https://www.wixapis.com/stores/v1/products",
3
- "code": 200,
4
- "body": {
5
- "product": {
6
- "id": "4224c24b-5a58-4d14-8793-623e812fa377",
7
- "name": "T-shirt",
8
- "slug": "t-shirt",
9
- "visible": false,
10
- "productType": "physical",
11
- "description": "nice summer t-shirt",
12
- "weightRange": {
13
- "minValue": 0,
14
- "maxValue": 0.2
15
- },
16
- "stock": {
17
- "trackInventory": false,
18
- "inStock": true,
19
- "inventoryStatus": "IN_STOCK"
20
- },
21
- "price": {
22
- "currency": "USD",
23
- "price": 10.5,
24
- "discountedPrice": 9.5,
25
- "formatted": {
26
- "price": "$10.50",
27
- "discountedPrice": "$9.50"
28
- }
29
- },
30
- "priceData": {
31
- "currency": "USD",
32
- "price": 10.5,
33
- "discountedPrice": 9.5,
34
- "formatted": {
35
- "price": "$10.50",
36
- "discountedPrice": "$9.50"
37
- }
38
- },
39
- "convertedPriceData": {
40
- "currency": "USD",
41
- "price": 10.5,
42
- "discountedPrice": 9.5,
43
- "formatted": {
44
- "price": "$10.50",
45
- "discountedPrice": "$9.50"
46
- }
47
- },
48
- "priceRange": {
49
- "minValue": 10.5,
50
- "maxValue": 10.5
51
- },
52
- "costRange": {
53
- "minValue": 0,
54
- "maxValue": 7
55
- },
56
- "additionalInfoSections": [],
57
- "ribbons": [
58
- {
59
- "text": "Sale"
60
- }
61
- ],
62
- "media": {
63
- "items": []
64
- },
65
- "customTextFields": [],
66
- "manageVariants": true,
67
- "productOptions": [
68
- {
69
- "optionType": "drop_down",
70
- "name": "Size",
71
- "choices": [
72
- {
73
- "value": "S",
74
- "description": "S",
75
- "inStock": true,
76
- "visible": true
77
- },
78
- {
79
- "value": "L",
80
- "description": "L",
81
- "inStock": true,
82
- "visible": true
83
- }
84
- ]
85
- }
86
- ],
87
- "productPageUrl": {
88
- "base": "https://wixsite.com/examplestore",
89
- "path": "/product-page/t-shirt"
90
- },
91
- "numericId": "1657626871550000",
92
- "inventoryItemId": "bddb3db4-a5a7-b2eb-786c-9dc17ed05c88",
93
- "discount": {
94
- "type": "AMOUNT",
95
- "value": 1
96
- },
97
- "collectionIds": [
98
- "00000000-000000-000000-000000000001"
99
- ],
100
- "variants": [
101
- {
102
- "id": "05519a6e-222b-413a-957c-0ef7a32779b5",
103
- "choices": {
104
- "Size": "S"
105
- },
106
- "variant": {
107
- "priceData": {
108
- "currency": "USD",
109
- "price": 10.5,
110
- "discountedPrice": 9.5,
111
- "formatted": {
112
- "price": "$10.50",
113
- "discountedPrice": "$9.50"
114
- }
115
- },
116
- "convertedPriceData": {
117
- "currency": "USD",
118
- "price": 10.5,
119
- "discountedPrice": 9.5,
120
- "formatted": {
121
- "price": "$10.50",
122
- "discountedPrice": "$9.50"
123
- }
124
- },
125
- "costAndProfitData": {
126
- "itemCost": 7,
127
- "formattedItemCost": "$7.00",
128
- "profit": 2.5,
129
- "formattedProfit": "$2.50",
130
- "profitMargin": 0.2632
131
- },
132
- "weight": 0.2,
133
- "sku": "123df",
134
- "visible": false
135
- }
136
- },
137
- {
138
- "id": "0318a3d8-f31c-4ba3-98c7-387571a2eac4",
139
- "choices": {
140
- "Size": "L"
141
- },
142
- "variant": {
143
- "priceData": {
144
- "currency": "USD",
145
- "price": 10.5,
146
- "discountedPrice": 9.5,
147
- "formatted": {
148
- "price": "$10.50",
149
- "discountedPrice": "$9.50"
150
- }
151
- },
152
- "convertedPriceData": {
153
- "currency": "USD",
154
- "price": 10.5,
155
- "discountedPrice": 9.5,
156
- "formatted": {
157
- "price": "$10.50",
158
- "discountedPrice": "$9.50"
159
- }
160
- },
161
- "costAndProfitData": {
162
- "itemCost": 7,
163
- "formattedItemCost": "$7.00",
164
- "profit": 2.5,
165
- "formattedProfit": "$2.50",
166
- "profitMargin": 0.2632
167
- },
168
- "weight": 0.2,
169
- "sku": "123df",
170
- "visible": false
171
- }
172
- }
173
- ],
174
- "lastUpdated": "2022-07-12T11:54:31.550Z",
175
- "createdDate": "2022-07-12T11:54:31.550Z",
176
- "ribbon": "Sale",
177
- "brand": "Nice"
178
- }
179
- }
180
- }