dscf-marketplace 0.4.4 → 0.4.5
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/models/dscf/marketplace/order.rb +12 -8
- data/lib/dscf/marketplace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf7ce0a12c623c5befab2e887f6f5f28d922ed8a6b2ab0a40f3bc02f32f93eb
|
4
|
+
data.tar.gz: 1aff775c474842bf4412d15bc5c627a6684afeea44f6e79636398abd12f72ba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f34897815559dfb2ae6acb376a8a7da8ce9dc04cc7a5d13198b8a82f51e1aeec06ace786adc16d288fba0434f54cc89a771aec39ba94a4990a477af206a990
|
7
|
+
data.tar.gz: 21f7fb3efb503de32bcaffaff5aa5baabbc445ac870880aed18c88dc29a5971da89e33c2953b58c267e3e6bc2ac3e19e54cb5a654b62c7856ead7df76ec4ce0c
|
@@ -36,21 +36,23 @@ module Dscf::Marketplace
|
|
36
36
|
%w[quotation listing user ordered_by ordered_to delivery_order dropoff_address order_items]
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.create_from_quotation(quotation, dropoff_address = nil, payment_method =
|
39
|
+
def self.create_from_quotation(quotation, dropoff_address = nil, payment_method = nil)
|
40
40
|
return nil unless quotation.accepted?
|
41
41
|
|
42
|
-
|
42
|
+
attributes = {
|
43
43
|
order_type: :rfq_based,
|
44
44
|
status: :processing,
|
45
45
|
fulfillment_type: dropoff_address.present? ? :delivery : :self_pickup,
|
46
|
-
payment_method: payment_method,
|
47
46
|
quotation: quotation,
|
48
47
|
user: quotation.request_for_quotation.user, # Keep for backward compatibility
|
49
48
|
ordered_by: quotation.request_for_quotation.user,
|
50
49
|
ordered_to: quotation.business,
|
51
50
|
dropoff_address: dropoff_address,
|
52
51
|
total_amount: quotation.total_price
|
53
|
-
|
52
|
+
}
|
53
|
+
attributes[:payment_method] = payment_method if payment_method.present?
|
54
|
+
|
55
|
+
order = create!(attributes)
|
54
56
|
|
55
57
|
quotation.quotation_items.each do |item|
|
56
58
|
order.order_items.create!(
|
@@ -66,21 +68,23 @@ module Dscf::Marketplace
|
|
66
68
|
order
|
67
69
|
end
|
68
70
|
|
69
|
-
def self.create_from_listing(listing, user, quantity, dropoff_address = nil, payment_method =
|
71
|
+
def self.create_from_listing(listing, user, quantity, dropoff_address = nil, payment_method = nil)
|
70
72
|
return nil unless listing.status == "active" && quantity <= listing.quantity
|
71
73
|
|
72
|
-
|
74
|
+
attributes = {
|
73
75
|
order_type: :direct_listing,
|
74
76
|
status: :pending,
|
75
77
|
fulfillment_type: dropoff_address.present? ? :delivery : :self_pickup,
|
76
|
-
payment_method: payment_method,
|
77
78
|
listing: listing,
|
78
79
|
user: user, # Keep for backward compatibility
|
79
80
|
ordered_by: user,
|
80
81
|
ordered_to: listing.business,
|
81
82
|
dropoff_address: dropoff_address,
|
82
83
|
total_amount: listing.price * quantity
|
83
|
-
|
84
|
+
}
|
85
|
+
attributes[:payment_method] = payment_method if payment_method.present?
|
86
|
+
|
87
|
+
order = create!(attributes)
|
84
88
|
|
85
89
|
order.order_items.create!(
|
86
90
|
listing: listing,
|
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.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asrat
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-10-
|
10
|
+
date: 2025-10-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|