comee_core 0.1.51 → 0.1.52
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.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/products_controller.rb +14 -0
- data/app/serializers/comee/core/master_price_serializer.rb +9 -0
- data/app/services/comee/core/customer_order_service.rb +5 -2
- data/app/services/comee/core/quotation_request_service.rb +18 -2
- data/config/routes.rb +6 -1
- data/lib/comee/core/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff1dfff0aa073499bc32fea5072e424c330b9615d213dc26270262438b26e9e5
|
4
|
+
data.tar.gz: a87394329564dc44da058bbc4205f28abdb5a50e34d3ebe424cf2dc591877f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf59f0b900a8d46b84a029c69208e71e135a2d9d8992f616474898129859178c1c524ec1558459ff8c0b43fcc4a685df54b2fd32b7855c98a580d3eb135617c
|
7
|
+
data.tar.gz: e93a6583da3c90075e23b7e71a488bae640908a8ee1281bab2db02157b7855bbca65a8151bec3bd7d494eace4aba3ae22dedc7178db21b178856f6d9efb84507
|
@@ -17,11 +17,25 @@ module Comee
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def master_prices
|
21
|
+
data = MasterPrice.where(product_id: price_params[:product_ids])
|
22
|
+
render json: {success: true, data: serialize(data)}
|
23
|
+
end
|
24
|
+
|
25
|
+
def client_prices
|
26
|
+
data = ClientPrice.where(product_id: price_params[:product_ids])
|
27
|
+
render json: {success: true, data: serialize(data)}
|
28
|
+
end
|
29
|
+
|
20
30
|
private
|
21
31
|
|
22
32
|
def model_params
|
23
33
|
params.required(:payload).permit(:code, :name, :description, :parent_id, :thumbnail_image, :preferred_units, images: [])
|
24
34
|
end
|
35
|
+
|
36
|
+
def price_params
|
37
|
+
params.require(:payload).permit(product_ids: [])
|
38
|
+
end
|
25
39
|
end
|
26
40
|
end
|
27
41
|
end
|
@@ -44,7 +44,7 @@ module Comee
|
|
44
44
|
.or(UnitConversion.where("from_id = ? AND to_id = ?", new_unit_id, unit_id))
|
45
45
|
|
46
46
|
unless conversions.count.positive?
|
47
|
-
units = Unit.where(id: [unit_id, new_unit_id])
|
47
|
+
units = Unit.where(id: [unit_id, new_unit_id])
|
48
48
|
raise(StandardError, "There is no conversion factor between #{units[0].code} and #{units[1].code}.")
|
49
49
|
end
|
50
50
|
|
@@ -112,7 +112,10 @@ module Comee
|
|
112
112
|
raise(StandardError, "Customer order should be in submitted or awaiting confirmation state.")
|
113
113
|
end
|
114
114
|
|
115
|
-
|
115
|
+
if order.customer_order_items.count.zero? ||
|
116
|
+
order.customer_order_items.all?(&:canceled?)
|
117
|
+
raise(StandardError, "Customer order does not have any items.")
|
118
|
+
end
|
116
119
|
|
117
120
|
sales_order = nil
|
118
121
|
CustomerOrder.transaction do
|
@@ -60,8 +60,24 @@ module Comee
|
|
60
60
|
raise(StandardError, "RFQ should be in awaiting_confirmation state.")
|
61
61
|
end
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
data = rfq.quotation_request_items.each_with_object([]) do |item, res|
|
64
|
+
res << {
|
65
|
+
client_id: rfq.client_id,
|
66
|
+
product_id: item.product_id,
|
67
|
+
unit_id: item.unit_id,
|
68
|
+
price: item.price,
|
69
|
+
discount: 0,
|
70
|
+
valid_from: item.valid_from,
|
71
|
+
valid_to: item.valid_to,
|
72
|
+
status: ClientPrice.statuses[:current]
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
ClientPrice.transaction do
|
77
|
+
ClientPrice.insert_all!(data)
|
78
|
+
rfq.status = QuotationRequest.statuses[:confirmed]
|
79
|
+
rfq.save!
|
80
|
+
end
|
65
81
|
rfq
|
66
82
|
end
|
67
83
|
end
|
data/config/routes.rb
CHANGED
@@ -9,7 +9,12 @@ Comee::Core::Engine.routes.draw do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
resources :suppliers
|
12
|
-
resources :products
|
12
|
+
resources :products do
|
13
|
+
collection do
|
14
|
+
post "master_prices"
|
15
|
+
post "client_prices"
|
16
|
+
end
|
17
|
+
end
|
13
18
|
resources :lookups
|
14
19
|
resources :quotation_requests do
|
15
20
|
collection do
|
data/lib/comee/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comee_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
@@ -353,6 +353,7 @@ files:
|
|
353
353
|
- app/serializers/comee/core/external_rfq_serializer.rb
|
354
354
|
- app/serializers/comee/core/item_status_serializer.rb
|
355
355
|
- app/serializers/comee/core/lookup_serializer.rb
|
356
|
+
- app/serializers/comee/core/master_price_serializer.rb
|
356
357
|
- app/serializers/comee/core/product_serializer.rb
|
357
358
|
- app/serializers/comee/core/product_type_serializer.rb
|
358
359
|
- app/serializers/comee/core/purchase_order_item_serializer.rb
|