dscf-marketplace 0.3.95 → 0.3.97
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d54a0f098c2df4fc4d326830ffe7d2588525c39bd8de35c908670dd73f9a0505
|
4
|
+
data.tar.gz: dea5a11311daf7e2c3084960c8d9273bd86b57b388c3dd3216c737bb80680d11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63336500de36d23b2c800012b2bbb72b2caa83e6969fef17dd319d036acac916902fe2358ad77a7dad8a8559b2115052347011cc8426fee3c47b695c7fdcc510
|
7
|
+
data.tar.gz: c0b63b4808ac8c914eb0ace252dbff343febf9f93b2335ea7d9d6bb7d85144fd8f83e42e8258e1170e3f6019cfbdea5286adca47fcaf8fb908898cfeabc012c3
|
@@ -24,7 +24,31 @@ module Dscf
|
|
24
24
|
|
25
25
|
def accept
|
26
26
|
@obj = find_record
|
27
|
-
|
27
|
+
|
28
|
+
fulfillment_type = params[:fulfillment_type]
|
29
|
+
dropoff_address_id = params[:dropoff_address_id]
|
30
|
+
|
31
|
+
# Validate fulfillment_type
|
32
|
+
unless fulfillment_type.present? && Dscf::Marketplace::Order.fulfillment_types.keys.include?(fulfillment_type)
|
33
|
+
render_error("Invalid or missing fulfillment_type", status: :unprocessable_entity)
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
37
|
+
dropoff_address = nil
|
38
|
+
if dropoff_address_id.present?
|
39
|
+
dropoff_address = Dscf::Core::Address.find_by(id: dropoff_address_id) if defined?(Dscf::Core::Address)
|
40
|
+
unless dropoff_address && dropoff_address.user_id == current_user.id
|
41
|
+
render_error("Invalid dropoff_address_id", status: :unprocessable_entity)
|
42
|
+
return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if fulfillment_type == "delivery" && dropoff_address.nil?
|
47
|
+
render_error("dropoff_address_id required for delivery", status: :unprocessable_entity)
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
if @obj.accept!(fulfillment_type: fulfillment_type, dropoff_address: dropoff_address)
|
28
52
|
render_success("quotations.success.accepted", data: @obj)
|
29
53
|
else
|
30
54
|
render_error("quotations.errors.accept_failed")
|
@@ -70,7 +70,7 @@ module Dscf
|
|
70
70
|
update_columns(status: "expired") if valid_until <= Time.current
|
71
71
|
end
|
72
72
|
|
73
|
-
def accept!
|
73
|
+
def accept!(options = {})
|
74
74
|
return false unless sent?
|
75
75
|
return false if within_validity_period? == false
|
76
76
|
|
@@ -81,17 +81,11 @@ module Dscf
|
|
81
81
|
request_for_quotation.update!(status: "selected", selected_quotation: self)
|
82
82
|
|
83
83
|
# Create order from accepted quotation
|
84
|
-
create_order_from_quotation
|
84
|
+
create_order_from_quotation(options)
|
85
85
|
|
86
86
|
true
|
87
87
|
end
|
88
88
|
|
89
|
-
def create_order_from_quotation
|
90
|
-
return if order.present?
|
91
|
-
|
92
|
-
Order.create_from_quotation(self)
|
93
|
-
end
|
94
|
-
|
95
89
|
def reject!
|
96
90
|
return false unless sent?
|
97
91
|
|
@@ -123,16 +117,21 @@ module Dscf
|
|
123
117
|
quotation_items.exists? && quotation_items.all? { |item| item.unit_price.present? }
|
124
118
|
end
|
125
119
|
|
126
|
-
def create_order_from_quotation
|
120
|
+
def create_order_from_quotation(options = {})
|
127
121
|
return if order.present?
|
128
122
|
|
123
|
+
fulfillment_type = options[:fulfillment_type] || "self_pickup"
|
124
|
+
dropoff_address = options[:dropoff_address]
|
125
|
+
|
129
126
|
order = Dscf::Marketplace::Order.create!(
|
130
127
|
order_type: :rfq_based,
|
131
|
-
status: :
|
128
|
+
status: :processing,
|
129
|
+
fulfillment_type: fulfillment_type,
|
132
130
|
quotation: self,
|
133
131
|
user: request_for_quotation.user, # Keep for backward compatibility
|
134
132
|
ordered_by: request_for_quotation.user,
|
135
133
|
ordered_to: business,
|
134
|
+
dropoff_address: dropoff_address,
|
136
135
|
total_amount: total_price
|
137
136
|
)
|
138
137
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dscf-marketplace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.97
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asrat
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|