item_builder_mwh 0.1.21 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d27673689edf403c7602e972c9b68dea4a3f22c0122c0a9badcb2deafe18b6df
4
- data.tar.gz: d93a48b95ca90754696afe36673bb8932e1d61d92d9bae41994cebeb15b67b56
3
+ metadata.gz: 5c9c6c65d5fee047753d199f8c7bd84fb8728e1c4b2663f6b51f4739cf00cb60
4
+ data.tar.gz: dd63fdff719a3efd3a6ddc2de281932dca87456811fb81b90300154eabd7f20e
5
5
  SHA512:
6
- metadata.gz: 87ca59a67d0cf7351aeb460d53e29e31c79f5c026ef84e866bdff0f3f73719a57ee32690c8886f20dc2cbf8a7cfed53e2eb3da57b147b24c049cf38eadd24b95
7
- data.tar.gz: 4db562d9bad83182d25e4fcbf3b7caaf64683841a3053a6f3576fc512380658a3398cc2afa8a9843da9bc0aef5fc882fd42145b297c7edc52e4c29a633eb5e04
6
+ metadata.gz: e56af16e87e30221e3941dc4e2219dd371718176fac6b6d81b713403aed250b5d1b78cc6e9f8e9b7955c09a0f5c7c550f038163955c213bb3098a1e804ed2ea0
7
+ data.tar.gz: a174536640d9d9c52b6f5611f1751337578af9b53648146e5c8652eed697458ff03f7704ffe12cbc36ace789df14b076ec292bbc1e192466572c01f25198413c
@@ -79,10 +79,18 @@ class ItemBuilderMwh
79
79
  end
80
80
 
81
81
  def listing_warehouse_routing_quantity
82
- warehouse_spaces = WarehouseSpace.where(item_variant_id: variant.id)
82
+ warehouse_spaces = WarehouseSpace.where(item_variant_id: variant.id, warehouse_id: wh_ids)
83
83
  warehouse_spaces.sum(:quantity)
84
84
  end
85
85
 
86
+ def wh_mappings
87
+ WarehouseMapping.where(profile_channel_association_id: listing.profile_channel_association_id)
88
+ end
89
+
90
+ def wh_ids
91
+ @wh_ids ||= wh_mappings.map{|x|x.warehouse_id}.flatten.uniq
92
+ end
93
+
86
94
  def qty_bundle
87
95
  # Quantity for bundle config
88
96
  if @bundle_variants.present?
@@ -128,9 +136,12 @@ class ItemBuilderMwh
128
136
  end
129
137
 
130
138
  def params(allocated_stock)
131
- "channel_id=#{listing.channel_id}&item_variant_id=#{listing.variant_id}
132
- &start_at=#{allocated_stock.start_at.to_date.beginning_of_day}
133
- &end_at=#{allocated_stock.end_at.to_date.end_of_day}"
139
+ {
140
+ channel_id: allocated_stock.variant_listing.channel_id,
141
+ item_variant_id: allocated_stock.variant_listing.variant_id,
142
+ start_at: allocated_stock.start_at.to_date.beginning_of_day,
143
+ end_at: allocated_stock.end_at.to_date.end_of_day
144
+ }.to_query
134
145
  end
135
146
 
136
147
  # one_alloc_rsvd_stock fungsi untuk mendapatkan satu
@@ -14,7 +14,6 @@ class ItemBuilderMwh
14
14
  include Modes
15
15
 
16
16
  QUANTITY_CHANNEL = {}.tap do |hash|
17
- hash[3] = :Lazada
18
17
  hash[2] = :Shopify
19
18
  hash[13] = :Zalora
20
19
  hash[18] = :Zilingo
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ItemBuilderMwh
4
- VERSION = '0.1.21'
4
+ VERSION = '0.1.25'
5
5
  end
@@ -47,6 +47,8 @@ class ItemBuilderMwh
47
47
  raise "Response Code is #{resp.dig("response_code")}"
48
48
  elsif resp.dig('ErrorResponse', 'Head', 'ErrorMessage') == 'E009: Access Denied'
49
49
  return nil
50
+ elsif resp.dig('ErrorResponse').present?
51
+ return nil
50
52
  end
51
53
  success_handle(resp)
52
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_builder_mwh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ivander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-06 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler