@things-factory/integration-sellercraft 4.2.7 → 4.2.10

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 (28) hide show
  1. package/dist-server/constants/order-status-mapping.js +5 -1
  2. package/dist-server/constants/order-status-mapping.js.map +1 -1
  3. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js +5 -2
  4. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js.map +1 -1
  5. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +10 -3
  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 +0 -15
  8. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
  9. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js +1 -1
  10. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js.map +1 -1
  11. package/dist-server/routers/sellercraft-router.js +136 -88
  12. package/dist-server/routers/sellercraft-router.js.map +1 -1
  13. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +273 -237
  14. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
  15. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js +19 -1
  16. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
  17. package/dist-server/service/marketplace-channel/marketplace-channel.js +5 -0
  18. package/dist-server/service/marketplace-channel/marketplace-channel.js.map +1 -1
  19. package/package.json +3 -3
  20. package/server/constants/order-status-mapping.ts +5 -0
  21. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts +6 -2
  22. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +10 -3
  23. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts +0 -16
  24. package/server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.ts +1 -1
  25. package/server/routers/sellercraft-router.ts +131 -91
  26. package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +325 -286
  27. package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +20 -1
  28. package/server/service/marketplace-channel/marketplace-channel.ts +4 -0
@@ -14,7 +14,7 @@ export class MarketplaceChannelProductMutation {
14
14
  const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})
15
15
  const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig
16
16
 
17
- const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find()
17
+ const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find({ where: { isActive: true } })
18
18
 
19
19
  for (var i = 0; i < channels.length; i++) {
20
20
  var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channels[i].channelId
@@ -164,6 +164,25 @@ export class MarketplaceChannelProductMutation {
164
164
  }
165
165
  })
166
166
 
167
+ if (store.platform == 'magento') {
168
+ let newList = []
169
+ for (let np of mappedProducts) {
170
+ if (np.productId == np.variations[0].variationId) {
171
+ let vars = mappedProducts
172
+ .filter(e => e.productId == np.productId)
173
+ .map(e => {
174
+ return e.variations[0]
175
+ })
176
+ np.variations = vars
177
+ if (np.variations.length > 1) {
178
+ np.variations = np.variations.filter(v => v.variationId != np.productId)
179
+ }
180
+ newList.push(np)
181
+ }
182
+ }
183
+ mappedProducts = newList
184
+ }
185
+
167
186
  try {
168
187
  mappedCategories = mappedCategories.map(category => {
169
188
  if (mappedCategories.filter(e => e.parent == category.categoryId).length > 0) {
@@ -40,6 +40,10 @@ export class MarketplaceChannel {
40
40
  @Field()
41
41
  channelId: string
42
42
 
43
+ @Column({ default: true })
44
+ @Field()
45
+ isActive: boolean
46
+
43
47
  @CreateDateColumn()
44
48
  @Field({ nullable: true })
45
49
  createdAt?: Date