@things-factory/integration-sellercraft 4.2.0 → 4.2.3

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 (23) hide show
  1. package/dist-server/constants/order-status-mapping.js +6 -2
  2. package/dist-server/constants/order-status-mapping.js.map +1 -1
  3. package/dist-server/constants/platform.js +2 -1
  4. package/dist-server/constants/platform.js.map +1 -1
  5. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +2 -2
  6. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
  7. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js +5 -3
  8. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
  9. package/dist-server/routers/sellercraft-router.js +26 -11
  10. package/dist-server/routers/sellercraft-router.js.map +1 -1
  11. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +155 -1
  12. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
  13. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js +22 -6
  14. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
  15. package/package.json +3 -3
  16. package/server/constants/order-status-mapping.ts +6 -2
  17. package/server/constants/platform.ts +2 -1
  18. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts +1 -1
  19. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +3 -3
  20. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts +8 -6
  21. package/server/routers/sellercraft-router.ts +27 -12
  22. package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +158 -3
  23. package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +34 -6
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ORDER_STATUS = void 0;
4
4
  exports.ORDER_STATUS = {
5
5
  pending: 'PAYMENT_PENDING',
6
- processing: 'CONFIRMED',
6
+ processing: 'PROCESSING',
7
7
  completed: 'DELIVERED',
8
- cancelled: 'CANCELLED'
8
+ cancelled: 'CANCELLED',
9
+ canceled: 'CANCELLED',
10
+ refunded: 'REFUND_COMPLETE',
11
+ failed: 'SHIPMENT_LOST_OR_DAMAGED',
12
+ refund: 'REFUND_COMPLETE'
9
13
  };
10
14
  //# sourceMappingURL=order-status-mapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,iBAAiB;IAC1B,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;CACvB,CAAA"}
1
+ {"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,iBAAiB;IAC1B,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,iBAAiB;CAC1B,CAAA"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PLATFORM = void 0;
4
4
  exports.PLATFORM = {
5
- WCM: 'woocommerce'
5
+ WCM: 'woocommerce',
6
+ MGT: 'magento'
6
7
  };
7
8
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../server/constants/platform.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,GAAG,EAAE,aAAa;CACnB,CAAA"}
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../server/constants/platform.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,SAAS;CACf,CAAA"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* https://docs.sellercraft.co/docs/api-integrations/b3A6MTY4NjQxODU-initiate-order-shipment */
2
+ /* https://docs.sellercraft.co/docs/api-integrations/b3A6MjQzODQ4OTg-ingest-channel-order */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ingestChannelOrder = void 0;
5
5
  const constants_1 = require("../../../constants");
@@ -49,7 +49,7 @@ function ingestChannelOrder() {
49
49
  phone_1: order.billPhone1,
50
50
  phone_2: order.billPhone2
51
51
  },
52
- order_items: order.orderItems.map(orderItem => {
52
+ order_items: order.mappedOrderItems.map(orderItem => {
53
53
  return {
54
54
  native_item_id: orderItem.id.toString(),
55
55
  native_variant_id: orderItem.variationId.toString(),
@@ -1 +1 @@
1
- {"version":3,"file":"ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE;oBACzB,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe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ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,4FAA4F;;;AAE5F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE;oBACzB,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,mBAAmB,EAAE,KAAK,CAAC,aAAa;oBACxC,kBAAkB,EAAE,KAAK,CAAC,YAAY;oBACtC,OAAO,EAAE,EAAE;oBACX,gBAAgB,EAAE;wBAChB,UAAU,EAAE,KAAK,CAAC,aAAa;wBAC/B,SAAS,EAAE,KAAK,CAAC,YAAY;wBAC7B,MAAM,EAAE,KAAK,CAAC,YAAY;wBAC1B,MAAM,EAAE,KAAK,CAAC,YAAY;wBAC1B,MAAM,EAAE,KAAK,CAAC,YAAY;wBAC1B,MAAM,EAAE,KAAK,CAAC,YAAY;wBAC1B,MAAM,EAAE,KAAK,CAAC,YAAY;wBAC1B,IAAI,EAAE,KAAK,CAAC,QAAQ;wBACpB,WAAW,EA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AK,CAAE,YAAY;4BACnC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gCACtC,OAAO;oCACL,iBAAiB,EAAE,MAAM,CAAC,IAAI;oCAC9B,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;oCACjD,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;iCAChD,CAAA;4BACH,CAAC,CAAC;4BACF,kBAAkB,EAAE,wBAAY,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;yBACpD,CAAA;oBACH,CAAC,CAAC;iBACH,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;aACxB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA9ED,gDA8EC"}
@@ -17,9 +17,11 @@ function ingestChannelProduct() {
17
17
  is_enabled: variant.isEnabled || true,
18
18
  is_sellable: variant.isSellable || true,
19
19
  is_deleted: false,
20
- variant_attributes: (variant === null || variant === void 0 ? void 0 : variant.attributes.map(attribute => {
21
- return Object.assign(Object.assign({}, attribute), { native_attribute_id: attribute.native_attribute_id.toString() });
22
- })) || [],
20
+ variant_attributes: (variant === null || variant === void 0 ? void 0 : variant.attributes)
21
+ ? variant === null || variant === void 0 ? void 0 : variant.attributes.map(attribute => {
22
+ return Object.assign(Object.assign({}, attribute), { native_attribute_id: attribute.native_attribute_id.toString() });
23
+ })
24
+ : [],
23
25
  stock_locked: (variant === null || variant === void 0 ? void 0 : variant.stockLocked) ? variant.stockLocked : 0,
24
26
  native_stock_reported: (variant === null || variant === void 0 ? void 0 : variant.stockReported) ? variant.stockReported : 0,
25
27
  price_full: variant.fullPrice || 0,
@@ -1 +1 @@
1
- {"version":3,"file":"ingest-channel-product.js","sourceRoot":"","s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"ingest-channel-product.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,SAAgB,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,yBAAyB;QAC/B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;YAExB,IAAI,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACvC,IAAI,iBAAiB,GAAU,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;oBAC9D,OAAO;wBACL,UAAU,EAAE,OAAO,CAAC,YAAY;wBAChC,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;wBACjD,KAAK,EAAE,OAAO,CAAC,IAAI;wBACnB,UAAU,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;wBACrC,WAAW,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;wBACvC,UAAU,EAAE,KAAK;wBACjB,kBAAkB,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU;4BACrC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gCAClC,uCACK,SAAS,KACZ,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAC9D;4BACH,CAAC,CAAC;4BACJ,CAAC,CAAC,EAAE;wBACN,YAAY,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;wBAC5D,qBAAqB,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CA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CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AAzFD,oDAyFC"}
@@ -36,14 +36,16 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
36
36
  accessKey: store.shop.credential.consumer_key,
37
37
  accessSecret: store.shop.credential.consumer_secret,
38
38
  storeURL: store.shop.credential.store_url,
39
- platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
39
+ platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
40
+ accessToken: store.shop.credential.access_token
40
41
  };
41
- if (requestBody[i].native_variant_id) {
42
+ if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
42
43
  const req = {
43
44
  costPrice: requestBody[i].full_price,
44
45
  sellPrice: requestBody[i].sale_price,
45
46
  productId: requestBody[i].native_product_id,
46
- variationId: requestBody[i].native_variant_id
47
+ variationId: requestBody[i].native_variant_id,
48
+ variationSku: requestBody[i].sku
47
49
  };
48
50
  result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationPrice(mappedStore, req);
49
51
  }
@@ -51,7 +53,8 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
51
53
  const req = {
52
54
  costPrice: requestBody[i].full_price,
53
55
  sellPrice: requestBody[i].sale_price,
54
- productId: requestBody[i].native_product_id
56
+ productId: requestBody[i].native_product_id,
57
+ variationSku: requestBody[i].sku
55
58
  };
56
59
  result = await integration_marketplace_1.StoreAPI.updateStoreProductPrice(mappedStore, req);
57
60
  }
@@ -85,20 +88,25 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async
85
88
  accessKey: store.shop.credential.consumer_key,
86
89
  accessSecret: store.shop.credential.consumer_secret,
87
90
  storeURL: store.shop.credential.store_url,
88
- platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
91
+ platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
92
+ accessToken: store.shop.credential.access_token
89
93
  };
90
- if (requestBody[i].native_variant_id) {
94
+ if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
91
95
  const req = {
92
96
  qty: requestBody[i].stock,
93
97
  itemId: requestBody[i].native_product_id,
94
- variationId: requestBody[i].native_variant_id
98
+ variationId: requestBody[i].native_variant_id,
99
+ distributors: requestBody[i].distributors || [],
100
+ variationSku: requestBody[i].sku
95
101
  };
96
102
  result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(mappedStore, req);
97
103
  }
98
104
  else {
99
105
  const req = {
100
106
  qty: requestBody[i].stock,
101
- itemId: requestBody[i].native_product_id
107
+ itemId: requestBody[i].native_product_id,
108
+ distributors: requestBody[i].distributors || [],
109
+ variationSku: requestBody[i].sku
102
110
  };
103
111
  result = await integration_marketplace_1.StoreAPI.updateStoreProductStock(mappedStore, req);
104
112
  }
@@ -131,9 +139,15 @@ exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (
131
139
  accessKey: store.shop.credential.consumer_key,
132
140
  accessSecret: store.shop.credential.consumer_secret,
133
141
  storeURL: store.shop.credential.store_url,
134
- platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
142
+ platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
143
+ accessToken: store.shop.credential.access_token
144
+ };
145
+ const reqBody = {
146
+ orderId: requestBody.native_order_id,
147
+ status: requestBody.order_status,
148
+ carrier: requestBody === null || requestBody === void 0 ? void 0 : requestBody.shipper_last_mile,
149
+ trackingNo: requestBody === null || requestBody === void 0 ? void 0 : requestBody.tracking_number
135
150
  };
136
- const reqBody = { orderId: requestBody.native_order_id, status: requestBody.order_status };
137
151
  result = await integration_marketplace_1.StoreAPI.updateOrderStatus(mappedStore, reqBody);
138
152
  debug(result);
139
153
  context.status = 200;
@@ -162,7 +176,8 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', as
162
176
  accessKey: store.shop.credential.consumer_key,
163
177
  accessSecret: store.shop.credential.consumer_secret,
164
178
  storeURL: store.shop.credential.store_url,
165
- platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
179
+ platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
180
+ accessToken: store.shop.credential.access_token
166
181
  };
167
182
  let { product_sku: productSku, native_product_id: itemId, variants } = requestBody;
168
183
  variants.map(variant => {
@@ -1 +1 @@
1
- {"version":3,"file":"sellercraft-router.js","sourceRoot":"","sources":["../../server/routers/sellercraft-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAE/B,6CAA4C;AAC5C,qFAAkE;AAClE,4CAAuC;AAEvC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2DAA2D,CAAC,CAAA;AAE9E,QAAA,iBAAiB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE7C,yBAAiB,CAAC,IAAI,CAAC,yCAAyC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACxF,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;IACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,mCAAmC,CAAA;IAEvF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAE5C,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAA;IAEvE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;IAExC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,IAAI,KAAK,GAAQ,EAAE,CAAA,CAAC,sBAAsB;QAC1C,IAAI,MAAM,CAAA;QAEV,qJAAqJ;QACrJ,IAAI,QAAQ,GAAG,GAAG,aAAa,eAAe,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;QAC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15 +69,145 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
69
69
  createdAt: order.orderCreatedAt,
70
70
  updatedAt: order.orderUpdatedAt,
71
71
  charges: [
72
+ {
73
+ name: 'CHARGES_MARKETING',
74
+ grossAmount: 0,
75
+ nettAmount: 0
76
+ },
77
+ {
78
+ name: 'CLAIMS_DAMAGE',
79
+ grossAmount: 0,
80
+ nettAmount: 0
81
+ },
82
+ {
83
+ name: 'CLAIMS_LOST',
84
+ grossAmount: 0,
85
+ nettAmount: 0
86
+ },
87
+ {
88
+ name: 'COMMISSION_PLATFORM',
89
+ grossAmount: 0,
90
+ nettAmount: 0
91
+ },
92
+ {
93
+ name: 'DEPOSIT_PRESALE',
94
+ grossAmount: 0,
95
+ nettAmount: 0
96
+ },
97
+ {
98
+ name: 'FEE_MISCELLANEOUS',
99
+ grossAmount: 0,
100
+ nettAmount: 0
101
+ },
102
+ {
103
+ name: 'FEE_TRANSACTION',
104
+ grossAmount: 0,
105
+ nettAmount: 0
106
+ },
72
107
  {
73
108
  name: 'PRICE_NORMAL_SELLING',
74
109
  grossAmount: total,
75
110
  nettAmount: subtotal
76
111
  },
112
+ {
113
+ name: 'PRICE_RECOMMENDED_RETAIL',
114
+ grossAmount: 0,
115
+ nettAmount: 0
116
+ },
117
+ {
118
+ name: 'PROMOTIONS_CUSTOMER_RECEIVED',
119
+ grossAmount: 0,
120
+ nettAmount: 0
121
+ },
122
+ {
123
+ name: 'PROMOTIONS_REBATE_PLATFORM',
124
+ grossAmount: 0,
125
+ nettAmount: 0
126
+ },
127
+ {
128
+ name: 'PROMOTIONS_REBATE_SELLER',
129
+ grossAmount: 0,
130
+ nettAmount: 0
131
+ },
132
+ {
133
+ name: 'REVERSAL_CHARGES_MARKETING',
134
+ grossAmount: 0,
135
+ nettAmount: 0
136
+ },
137
+ {
138
+ name: 'REVERSAL_COMMISSION',
139
+ grossAmount: 0,
140
+ nettAmount: 0
141
+ },
142
+ {
143
+ name: 'REVERSAL_FEE_MISCELLANEOUS',
144
+ grossAmount: 0,
145
+ nettAmount: 0
146
+ },
147
+ {
148
+ name: 'REVERSAL_PROMOTIONS_CUSTOMER_RECEIVED',
149
+ grossAmount: 0,
150
+ nettAmount: 0
151
+ },
152
+ {
153
+ name: 'REVERSAL_SELLER_RETURN_REFUND_AMOUNT',
154
+ grossAmount: 0,
155
+ nettAmount: 0
156
+ },
157
+ {
158
+ name: 'REVERSAL_SHIPPING_CUSTOMER_PAID',
159
+ grossAmount: 0,
160
+ nettAmount: 0
161
+ },
162
+ {
163
+ name: 'REVERSAL_SHIPPING_REBATE_PLATFORM',
164
+ grossAmount: 0,
165
+ nettAmount: 0
166
+ },
167
+ {
168
+ name: 'REVERSAL_SHIPPING_SELLER_PAID',
169
+ grossAmount: 0,
170
+ nettAmount: 0
171
+ },
172
+ {
173
+ name: 'SHIPPING_COST_TOTAL',
174
+ grossAmount: 0,
175
+ nettAmount: 0
176
+ },
177
+ {
178
+ name: 'SHIPPING_CUSTOMER_PAID',
179
+ grossAmount: 0,
180
+ nettAmount: 0
181
+ },
182
+ {
183
+ name: 'SHIPPING_REBATE_PLATFORM',
184
+ grossAmount: 0,
185
+ nettAmount: 0
186
+ },
187
+ {
188
+ name: 'SHIPPING_SELLER_PAID',
189
+ grossAmount: 0,
190
+ nettAmount: 0
191
+ },
77
192
  {
78
193
  name: 'TAXES',
79
194
  grossAmount: totalTax,
80
195
  nettAmount: subtotalTax
196
+ },
197
+ {
198
+ name: 'VOUCHERS_CUSTOMER_RECEIVED',
199
+ grossAmount: 0,
200
+ nettAmount: 0
201
+ },
202
+ {
203
+ name: 'VOUCHERS_REBATE_PLATFORM',
204
+ grossAmount: 0,
205
+ nettAmount: 0
206
+ },
207
+ {
208
+ name: 'VOUCHERS_REBATE_SELLER',
209
+ grossAmount: 0,
210
+ nettAmount: 0
81
211
  }
82
212
  ],
83
213
  slaExpiresAt,
@@ -123,7 +253,8 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
123
253
  mappedOrderItems,
124
254
  channelShopId,
125
255
  organisationId,
126
- status
256
+ status,
257
+ charges: getOrderCharges(mappedOrderItems)
127
258
  };
128
259
  });
129
260
  if (mappedOrderResult.length > 0) {
@@ -147,4 +278,27 @@ MarketplaceChannelOrderMutation = __decorate([
147
278
  (0, type_graphql_1.Resolver)()
148
279
  ], MarketplaceChannelOrderMutation);
149
280
  exports.MarketplaceChannelOrderMutation = MarketplaceChannelOrderMutation;
281
+ function getOrderCharges(mappedOrderItems) {
282
+ let chargesList = [];
283
+ for (let i = 0; i < mappedOrderItems.length; i++) {
284
+ for (let j = 0; j < mappedOrderItems[i].charges.length; j++) {
285
+ let charge = mappedOrderItems[i].charges[j];
286
+ let foundCharge = chargesList.find(cl => cl.name == charge.name);
287
+ if (foundCharge) {
288
+ foundCharge.grossAmount = foundCharge.grossAmount + charge.grossAmount;
289
+ foundCharge.nettAmount = foundCharge.nettAmount + charge.nettAmount;
290
+ chargesList = chargesList.filter(cl => cl.name != charge.name);
291
+ }
292
+ else {
293
+ foundCharge = {
294
+ name: charge.name,
295
+ grossAmount: charge.grossAmount,
296
+ nettAmount: charge.nettAmount
297
+ };
298
+ }
299
+ chargesList.push(foundCharge);
300
+ }
301
+ }
302
+ return chargesList;
303
+ }
150
304
  //# sourceMappingURL=marketplace-channel-order-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"marketplace-channel-order-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA2D;AAC3D,qCAAuC;AAEvC,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAE1C,KAAK,CAAC,+BAA+B,CAClB,QAAgB,EAClB,MAAc,EACtB,OAAY;QAEnB,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAA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A3KY,0EAA+B"}
1
+ {"version":3,"file":"marketplace-channel-order-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA2D;AAC3D,qCAAuC;AAEvC,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAE1C,KAAK,CAAC,+BAA+B,CAClB,QAAgB,EAClB,MAAc,EACtB,OAAY;QAEnB,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,EAAE,CAAA;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBACzD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,EAAE,MAAM;iBACpB;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE;gBACvB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;aACjC;YACD,IAAI,aAAa,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;YAChD,IAAI,KAAK,GAAG,aAAa,CAAC,KAAK,CAAA;YAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CA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,MAAM,CAAC,UAAU;iBAC9B,CAAA;aACF;YACD,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;SAC9B;KACF;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
@@ -51,10 +51,26 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
51
51
  let organisationId = shops[j].account_id;
52
52
  let channelShopId = shops[j].channel_shop_id;
53
53
  var sellercraftStore = Object.assign(Object.assign({}, store), { platform: 'sellercraftChannelIntegration' });
54
- const productResult = await integration_marketplace_1.StoreAPI.getStoreProducts(store, {});
55
- const categoryResult = await integration_marketplace_1.StoreAPI.getStoreProductCategories(store, {});
56
- let mappedProducts = productResult.results.map(item => {
57
- let { categoryId, itemId: productId, name, brand, isVerified, images, attributes, variations } = item;
54
+ const productResult = [];
55
+ let totalPages = 1;
56
+ var limit = 50;
57
+ for (let page = 0; page < totalPages; page++) {
58
+ const { results, total } = await integration_marketplace_1.StoreAPI.getStoreProducts(store, {
59
+ pagination: { page, limit }
60
+ });
61
+ totalPages = Math.ceil(total / limit);
62
+ productResult.push(...results);
63
+ }
64
+ const categoryResult = [];
65
+ let totalPagesCategory = 1;
66
+ var limitCategory = 100;
67
+ for (let page = 0; page < totalPagesCategory; page++) {
68
+ const { results, total } = await integration_marketplace_1.StoreAPI.getStoreProductCategories(store, { pagination: { page, limitCategory } });
69
+ totalPagesCategory = Math.ceil(total / limitCategory);
70
+ categoryResult.push(...results);
71
+ }
72
+ let mappedProducts = productResult.map(item => {
73
+ let { categoryId, itemId: productId, parentId, name, brand, isVerified, images, attributes, variations } = item;
58
74
  variations = variations.map(variation => {
59
75
  let { variationSku, variationId, name, isEnabled: isEnabled, isEnabled: isSellable, attributes, stockLocked, qty: stockReported, costPrice: fullPrice, sellPrice: priceDiscounted, length, width, height, weight } = variation;
60
76
  return {
@@ -98,7 +114,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
98
114
  channelCode: channels[i].channelCode,
99
115
  channelCountry: shops[j].country_code,
100
116
  categoryId,
101
- productId,
117
+ productId: parentId || productId,
102
118
  name,
103
119
  brand,
104
120
  isVerified,
@@ -107,7 +123,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
107
123
  variations
108
124
  };
109
125
  });
110
- let mappedCategories = categoryResult.results.map(category => {
126
+ let mappedCategories = categoryResult.map(category => {
111
127
  let { id: categoryId, name: categoryName, parent, isActive } = category;
112
128
  return {
113
129
  categoryId,
@@ -1 +1 @@
1
- {"version":3,"file":"marketplace-channel-product-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,qCAAuC;AAEvC,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE5C,KAAK,CAAC,iCAAiC,CAAQ,OAAY;QACzD,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,EAAE,CAAA;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBACzD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,EAAE,MAAM;iBACpB;aACF,CAAC,CAAA;YAEF,IAA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M,sEAAgC,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAA;aAC5G;YAED,OAAO,IAAI,CAAA;SACZ;IACH,CAAC;CACF,CAAA;AApJC;IADC,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACY,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;0FAmJ7C;AArJU,iCAAiC;IAD7C,IAAA,uBAAQ,GAAE;GACE,iCAAiC,CAsJ7C;AAtJY,8EAAiC"}
1
+ {"version":3,"file":"marketplace-channel-product-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,qCAAuC;AAEvC,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE5C,KAAK,CAAC,iCAAiC,CAAQ,OAAY;QACzD,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,EAAE,CAAA;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBACzD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-sellercraft",
3
- "version": "4.2.0",
3
+ "version": "4.2.3",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -31,7 +31,7 @@
31
31
  "@things-factory/context-ui": "^4.1.40",
32
32
  "@things-factory/grist-ui": "^4.1.40",
33
33
  "@things-factory/i18n-base": "^4.1.40",
34
- "@things-factory/integration-marketplace": "^4.2.0",
34
+ "@things-factory/integration-marketplace": "^4.2.3",
35
35
  "@things-factory/integration-ui": "^4.1.40",
36
36
  "@things-factory/more-ui": "^4.1.40",
37
37
  "@things-factory/resource-ui": "^4.1.40",
@@ -51,5 +51,5 @@
51
51
  "nock": "^13.0.2",
52
52
  "should": "^13.2.3"
53
53
  },
54
- "gitHead": "ea20ff47ca0caa48313ae9d7c527e866f7eb1571"
54
+ "gitHead": "38faf657cf86a08d942c4ada9b36b2f62fb94cce"
55
55
  }
@@ -1,6 +1,10 @@
1
1
  export const ORDER_STATUS = {
2
2
  pending: 'PAYMENT_PENDING',
3
- processing: 'CONFIRMED',
3
+ processing: 'PROCESSING',
4
4
  completed: 'DELIVERED',
5
- cancelled: 'CANCELLED'
5
+ cancelled: 'CANCELLED',
6
+ canceled: 'CANCELLED',
7
+ refunded: 'REFUND_COMPLETE',
8
+ failed: 'SHIPMENT_LOST_OR_DAMAGED',
9
+ refund: 'REFUND_COMPLETE'
6
10
  }
@@ -1,3 +1,4 @@
1
1
  export const PLATFORM = {
2
- WCM: 'woocommerce'
2
+ WCM: 'woocommerce',
3
+ MGT: 'magento'
3
4
  }
@@ -33,4 +33,4 @@ function mapCategories(categories) {
33
33
  }
34
34
  })
35
35
  return categories
36
- }
36
+ }
@@ -1,4 +1,4 @@
1
- /* https://docs.sellercraft.co/docs/api-integrations/b3A6MTY4NjQxODU-initiate-order-shipment */
1
+ /* https://docs.sellercraft.co/docs/api-integrations/b3A6MjQzODQ4OTg-ingest-channel-order */
2
2
 
3
3
  import { ORDER_STATUS } from '../../../constants'
4
4
 
@@ -49,7 +49,7 @@ export function ingestChannelOrder() {
49
49
  phone_1: order.billPhone1,
50
50
  phone_2: order.billPhone2
51
51
  },
52
- order_items: order.orderItems.map(orderItem => {
52
+ order_items: order.mappedOrderItems.map(orderItem => {
53
53
  return {
54
54
  native_item_id: orderItem.id.toString(),
55
55
  native_variant_id: orderItem.variationId.toString(),
@@ -73,7 +73,7 @@ export function ingestChannelOrder() {
73
73
  })
74
74
 
75
75
  return {
76
- payload: [ ...newOrders ]
76
+ payload: [...newOrders]
77
77
  }
78
78
  },
79
79
  normalize(res) {
@@ -16,12 +16,14 @@ export function ingestChannelProduct() {
16
16
  is_enabled: variant.isEnabled || true,
17
17
  is_sellable: variant.isSellable || true,
18
18
  is_deleted: false, // default
19
- variant_attributes: variant?.attributes.map(attribute => {
20
- return {
21
- ...attribute,
22
- native_attribute_id: attribute.native_attribute_id.toString()
23
- }
24
- }) || [],
19
+ variant_attributes: variant?.attributes
20
+ ? variant?.attributes.map(attribute => {
21
+ return {
22
+ ...attribute,
23
+ native_attribute_id: attribute.native_attribute_id.toString()
24
+ }
25
+ })
26
+ : [],
25
27
  stock_locked: variant?.stockLocked ? variant.stockLocked : 0,
26
28
  native_stock_reported: variant?.stockReported ? variant.stockReported : 0,
27
29
  price_full: variant.fullPrice || 0,
@@ -39,22 +39,25 @@ sellercraftRouter.post('/sellercraft/store/update-product-price', async (context
39
39
  accessKey: store.shop.credential.consumer_key,
40
40
  accessSecret: store.shop.credential.consumer_secret,
41
41
  storeURL: store.shop.credential.store_url,
42
- platform: PLATFORM[`${store.shop.org_prefix}`]
42
+ platform: PLATFORM[`${store.shop.org_prefix}`],
43
+ accessToken: store.shop.credential.access_token
43
44
  }
44
45
 
45
- if (requestBody[i].native_variant_id) {
46
+ if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
46
47
  const req = {
47
48
  costPrice: requestBody[i].full_price,
48
49
  sellPrice: requestBody[i].sale_price,
49
50
  productId: requestBody[i].native_product_id,
50
- variationId: requestBody[i].native_variant_id
51
+ variationId: requestBody[i].native_variant_id,
52
+ variationSku: requestBody[i].sku
51
53
  }
52
54
  result = await StoreAPI.updateStoreProductVariationPrice(mappedStore, req)
53
55
  } else {
54
56
  const req = {
55
57
  costPrice: requestBody[i].full_price,
56
58
  sellPrice: requestBody[i].sale_price,
57
- productId: requestBody[i].native_product_id
59
+ productId: requestBody[i].native_product_id,
60
+ variationSku: requestBody[i].sku
58
61
  }
59
62
  result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
60
63
  }
@@ -95,20 +98,25 @@ sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context
95
98
  accessKey: store.shop.credential.consumer_key,
96
99
  accessSecret: store.shop.credential.consumer_secret,
97
100
  storeURL: store.shop.credential.store_url,
98
- platform: PLATFORM[`${store.shop.org_prefix}`]
101
+ platform: PLATFORM[`${store.shop.org_prefix}`],
102
+ accessToken: store.shop.credential.access_token
99
103
  }
100
104
 
101
- if (requestBody[i].native_variant_id) {
105
+ if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
102
106
  const req = {
103
107
  qty: requestBody[i].stock,
104
108
  itemId: requestBody[i].native_product_id,
105
- variationId: requestBody[i].native_variant_id
109
+ variationId: requestBody[i].native_variant_id,
110
+ distributors: requestBody[i].distributors || [], // for Magento
111
+ variationSku: requestBody[i].sku
106
112
  }
107
113
  result = await StoreAPI.updateStoreProductVariationStock(mappedStore, req)
108
114
  } else {
109
115
  const req = {
110
116
  qty: requestBody[i].stock,
111
- itemId: requestBody[i].native_product_id
117
+ itemId: requestBody[i].native_product_id,
118
+ distributors: requestBody[i].distributors || [], // for Magento
119
+ variationSku: requestBody[i].sku
112
120
  }
113
121
  result = await StoreAPI.updateStoreProductStock(mappedStore, req)
114
122
  }
@@ -147,10 +155,16 @@ sellercraftRouter.post('/sellercraft/store/update-order-status', async (context,
147
155
  accessKey: store.shop.credential.consumer_key,
148
156
  accessSecret: store.shop.credential.consumer_secret,
149
157
  storeURL: store.shop.credential.store_url,
150
- platform: PLATFORM[`${store.shop.org_prefix}`]
158
+ platform: PLATFORM[`${store.shop.org_prefix}`],
159
+ accessToken: store.shop.credential.access_token
151
160
  }
152
161
 
153
- const reqBody = { orderId: requestBody.native_order_id, status: requestBody.order_status }
162
+ const reqBody = {
163
+ orderId: requestBody.native_order_id,
164
+ status: requestBody.order_status,
165
+ carrier: requestBody?.shipper_last_mile,
166
+ trackingNo: requestBody?.tracking_number
167
+ }
154
168
 
155
169
  result = await StoreAPI.updateOrderStatus(mappedStore, reqBody)
156
170
  debug(result)
@@ -186,9 +200,10 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
186
200
  accessKey: store.shop.credential.consumer_key,
187
201
  accessSecret: store.shop.credential.consumer_secret,
188
202
  storeURL: store.shop.credential.store_url,
189
- platform: PLATFORM[`${store.shop.org_prefix}`]
203
+ platform: PLATFORM[`${store.shop.org_prefix}`],
204
+ accessToken: store.shop.credential.access_token
190
205
  }
191
-
206
+
192
207
  let { product_sku: productSku, native_product_id: itemId, variants } = requestBody
193
208
 
194
209
  variants.map(variant => {
@@ -108,15 +108,145 @@ export class MarketplaceChannelOrderMutation {
108
108
  createdAt: order.orderCreatedAt,
109
109
  updatedAt: order.orderUpdatedAt,
110
110
  charges: [
111
+ {
112
+ name: 'CHARGES_MARKETING',
113
+ grossAmount: 0,
114
+ nettAmount: 0
115
+ },
116
+ {
117
+ name: 'CLAIMS_DAMAGE',
118
+ grossAmount: 0,
119
+ nettAmount: 0
120
+ },
121
+ {
122
+ name: 'CLAIMS_LOST',
123
+ grossAmount: 0,
124
+ nettAmount: 0
125
+ },
126
+ {
127
+ name: 'COMMISSION_PLATFORM',
128
+ grossAmount: 0,
129
+ nettAmount: 0
130
+ },
131
+ {
132
+ name: 'DEPOSIT_PRESALE',
133
+ grossAmount: 0,
134
+ nettAmount: 0
135
+ },
136
+ {
137
+ name: 'FEE_MISCELLANEOUS',
138
+ grossAmount: 0,
139
+ nettAmount: 0
140
+ },
141
+ {
142
+ name: 'FEE_TRANSACTION',
143
+ grossAmount: 0,
144
+ nettAmount: 0
145
+ },
111
146
  {
112
147
  name: 'PRICE_NORMAL_SELLING',
113
148
  grossAmount: total,
114
149
  nettAmount: subtotal
115
150
  },
151
+ {
152
+ name: 'PRICE_RECOMMENDED_RETAIL',
153
+ grossAmount: 0,
154
+ nettAmount: 0
155
+ },
156
+ {
157
+ name: 'PROMOTIONS_CUSTOMER_RECEIVED',
158
+ grossAmount: 0,
159
+ nettAmount: 0
160
+ },
161
+ {
162
+ name: 'PROMOTIONS_REBATE_PLATFORM',
163
+ grossAmount: 0,
164
+ nettAmount: 0
165
+ },
166
+ {
167
+ name: 'PROMOTIONS_REBATE_SELLER',
168
+ grossAmount: 0,
169
+ nettAmount: 0
170
+ },
171
+ {
172
+ name: 'REVERSAL_CHARGES_MARKETING',
173
+ grossAmount: 0,
174
+ nettAmount: 0
175
+ },
176
+ {
177
+ name: 'REVERSAL_COMMISSION',
178
+ grossAmount: 0,
179
+ nettAmount: 0
180
+ },
181
+ {
182
+ name: 'REVERSAL_FEE_MISCELLANEOUS',
183
+ grossAmount: 0,
184
+ nettAmount: 0
185
+ },
186
+ {
187
+ name: 'REVERSAL_PROMOTIONS_CUSTOMER_RECEIVED',
188
+ grossAmount: 0,
189
+ nettAmount: 0
190
+ },
191
+ {
192
+ name: 'REVERSAL_SELLER_RETURN_REFUND_AMOUNT',
193
+ grossAmount: 0,
194
+ nettAmount: 0
195
+ },
196
+ {
197
+ name: 'REVERSAL_SHIPPING_CUSTOMER_PAID',
198
+ grossAmount: 0,
199
+ nettAmount: 0
200
+ },
201
+ {
202
+ name: 'REVERSAL_SHIPPING_REBATE_PLATFORM',
203
+ grossAmount: 0,
204
+ nettAmount: 0
205
+ },
206
+ {
207
+ name: 'REVERSAL_SHIPPING_SELLER_PAID',
208
+ grossAmount: 0,
209
+ nettAmount: 0
210
+ },
211
+ {
212
+ name: 'SHIPPING_COST_TOTAL',
213
+ grossAmount: 0,
214
+ nettAmount: 0
215
+ },
216
+ {
217
+ name: 'SHIPPING_CUSTOMER_PAID',
218
+ grossAmount: 0,
219
+ nettAmount: 0
220
+ },
221
+ {
222
+ name: 'SHIPPING_REBATE_PLATFORM',
223
+ grossAmount: 0,
224
+ nettAmount: 0
225
+ },
226
+ {
227
+ name: 'SHIPPING_SELLER_PAID',
228
+ grossAmount: 0,
229
+ nettAmount: 0
230
+ },
116
231
  {
117
232
  name: 'TAXES',
118
233
  grossAmount: totalTax,
119
234
  nettAmount: subtotalTax
235
+ },
236
+ {
237
+ name: 'VOUCHERS_CUSTOMER_RECEIVED',
238
+ grossAmount: 0,
239
+ nettAmount: 0
240
+ },
241
+ {
242
+ name: 'VOUCHERS_REBATE_PLATFORM',
243
+ grossAmount: 0,
244
+ nettAmount: 0
245
+ },
246
+ {
247
+ name: 'VOUCHERS_REBATE_SELLER',
248
+ grossAmount: 0,
249
+ nettAmount: 0
120
250
  }
121
251
  ],
122
252
  slaExpiresAt,
@@ -129,11 +259,11 @@ export class MarketplaceChannelOrderMutation {
129
259
  for (let i = 0; i < oi.qty; i++) {
130
260
  mappedOrderItems.push({
131
261
  ...oi,
132
- id: `${oi.id}-${i+1}`
262
+ id: `${oi.id}-${i + 1}`
133
263
  })
134
264
  }
135
265
  })
136
-
266
+
137
267
  return {
138
268
  custFirstName,
139
269
  custLastName,
@@ -167,7 +297,8 @@ export class MarketplaceChannelOrderMutation {
167
297
  mappedOrderItems,
168
298
  channelShopId,
169
299
  organisationId,
170
- status
300
+ status,
301
+ charges: getOrderCharges(mappedOrderItems)
171
302
  }
172
303
  })
173
304
 
@@ -180,3 +311,27 @@ export class MarketplaceChannelOrderMutation {
180
311
  }
181
312
  }
182
313
  }
314
+
315
+ function getOrderCharges(mappedOrderItems) {
316
+ let chargesList = []
317
+
318
+ for (let i = 0; i < mappedOrderItems.length; i++) {
319
+ for (let j = 0; j < mappedOrderItems[i].charges.length; j++) {
320
+ let charge = mappedOrderItems[i].charges[j]
321
+ let foundCharge = chargesList.find(cl => cl.name == charge.name)
322
+ if (foundCharge) {
323
+ foundCharge.grossAmount = foundCharge.grossAmount + charge.grossAmount
324
+ foundCharge.nettAmount = foundCharge.nettAmount + charge.nettAmount
325
+ chargesList = chargesList.filter(cl => cl.name != charge.name)
326
+ } else {
327
+ foundCharge = {
328
+ name: charge.name,
329
+ grossAmount: charge.grossAmount,
330
+ nettAmount: charge.nettAmount
331
+ }
332
+ }
333
+ chargesList.push(foundCharge)
334
+ }
335
+ }
336
+ return chargesList
337
+ }
@@ -48,12 +48,40 @@ export class MarketplaceChannelProductMutation {
48
48
 
49
49
  var sellercraftStore = { ...store, platform: 'sellercraftChannelIntegration' }
50
50
 
51
- const productResult = await StoreAPI.getStoreProducts(store, {})
51
+ const productResult = []
52
+ let totalPages: number = 1
53
+ var limit: number = 50
52
54
 
53
- const categoryResult = await StoreAPI.getStoreProductCategories(store, {})
55
+ for (let page = 0; page < totalPages; page++) {
56
+ const { results, total } = await StoreAPI.getStoreProducts(store, {
57
+ pagination: { page, limit }
58
+ })
59
+ totalPages = Math.ceil(total / limit)
60
+ productResult.push(...results)
61
+ }
62
+
63
+ const categoryResult = []
64
+ let totalPagesCategory: number = 1
65
+ var limitCategory: number = 100
54
66
 
55
- let mappedProducts = productResult.results.map(item => {
56
- let { categoryId, itemId: productId, name, brand, isVerified, images, attributes, variations } = item
67
+ for (let page = 0; page < totalPagesCategory; page++) {
68
+ const { results, total } = await StoreAPI.getStoreProductCategories(store, { pagination: { page, limitCategory } })
69
+ totalPagesCategory = Math.ceil(total / limitCategory)
70
+ categoryResult.push(...results)
71
+ }
72
+
73
+ let mappedProducts = productResult.map(item => {
74
+ let {
75
+ categoryId,
76
+ itemId: productId,
77
+ parentId,
78
+ name,
79
+ brand,
80
+ isVerified,
81
+ images,
82
+ attributes,
83
+ variations
84
+ } = item
57
85
 
58
86
  variations = variations.map(variation => {
59
87
  let {
@@ -116,7 +144,7 @@ export class MarketplaceChannelProductMutation {
116
144
  channelCode: channels[i].channelCode,
117
145
  channelCountry: shops[j].country_code,
118
146
  categoryId,
119
- productId,
147
+ productId: parentId || productId,
120
148
  name,
121
149
  brand,
122
150
  isVerified,
@@ -126,7 +154,7 @@ export class MarketplaceChannelProductMutation {
126
154
  }
127
155
  })
128
156
 
129
- let mappedCategories = categoryResult.results.map(category => {
157
+ let mappedCategories = categoryResult.map(category => {
130
158
  let { id: categoryId, name: categoryName, parent, isActive } = category
131
159
 
132
160
  return {