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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab6f69061e5e0f80602dddeacb33887d68f21174664099fd9578f198e68ae6b3
4
- data.tar.gz: 8a8b1e988f3bfad11aa3d3523df0ec70cfbf6b40305f2ddde6a0442d8ce21ff1
3
+ metadata.gz: 3cf7ce0a12c623c5befab2e887f6f5f28d922ed8a6b2ab0a40f3bc02f32f93eb
4
+ data.tar.gz: 1aff775c474842bf4412d15bc5c627a6684afeea44f6e79636398abd12f72ba6
5
5
  SHA512:
6
- metadata.gz: 4dc07e89f8c0ed9958999cd4aff3eca8310013f7657266396ac3231347f9b8f11c3c5a40966c3dfd448e20c7fc47fc28db33c6b6683849977cb0843bca7376b4
7
- data.tar.gz: c340641404557bc77b19f8e1b666291842d86e85dfd6f4e309af235bc9382c6a71563e5ef99c43cbfc0b983aed09034f6b194a38c8b9137209f89c1ad7801921
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 = :cash)
39
+ def self.create_from_quotation(quotation, dropoff_address = nil, payment_method = nil)
40
40
  return nil unless quotation.accepted?
41
41
 
42
- order = create!(
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 = :cash)
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
- order = create!(
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,
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.4.4".freeze
3
+ VERSION = "0.4.5".freeze
4
4
  end
5
5
  end
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
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-06 00:00:00.000000000 Z
10
+ date: 2025-10-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails