effective_products 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/stamp.rb +19 -13
- data/app/views/effective/stamps/_fields.html.haml +1 -5
- data/lib/effective_products/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: 8126cdc9fd87848c7da280fb0e2ecc23cd4c83beb1f5efbb07aa2b0d7ebdbb1f
|
4
|
+
data.tar.gz: 71481f64c82b4a422bfc7b348e286cf8099c50adf6b897774e3a4ea76890f43e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c894fff91b9dc09933d3ed0d461c7698f33f5f8f45ed964ec07d622a7a78bf42650cc9a283522984f7a6e1df7bb705ea3a4fed4310ada9c6828128c688e753
|
7
|
+
data.tar.gz: 36ebdab52e77a293f8f5905a6cb1b0a531442bdb5f7303d57937c452d09a0fd650663c6a5042f19f50271a8c816312391a9b5ae124ebf3696b4da08d7c28fb03
|
@@ -72,15 +72,15 @@ module Effective
|
|
72
72
|
validates :shipping_address, presence: true, unless: -> { category == 'Digital-only' }
|
73
73
|
|
74
74
|
validate(if: -> { name.present? && name_confirmation.present? }) do
|
75
|
-
|
75
|
+
errors.add(:name_confirmation, "doesn't match name") unless name == name_confirmation
|
76
76
|
end
|
77
77
|
|
78
78
|
validate(if: -> { category.present? }) do
|
79
|
-
|
79
|
+
errors.add(:category, "is not included") unless EffectiveProducts.stamp_categories.include?(category)
|
80
80
|
end
|
81
81
|
|
82
82
|
validate(if: -> { admin_action }) do
|
83
|
-
|
83
|
+
errors.add(:owner_id, "must have a membership") unless owner && owner.try(:membership).present?
|
84
84
|
end
|
85
85
|
|
86
86
|
def to_s
|
@@ -114,19 +114,25 @@ module Effective
|
|
114
114
|
|
115
115
|
# This is the Admin Save and Mark Paid action
|
116
116
|
def mark_paid!
|
117
|
-
|
118
|
-
raise('expected an user with a membership category') unless owner && owner.try(:membership).present?
|
117
|
+
assign_attributes(admin_action: true)
|
119
118
|
|
120
|
-
category = owner
|
119
|
+
category = owner&.membership&.categories&.first
|
121
120
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
if category.present?
|
122
|
+
assign_attributes(
|
123
|
+
price: category.stamp_fee,
|
124
|
+
tax_exempt: category.stamp_fee_tax_exempt,
|
125
|
+
qb_item_name: category.stamp_fee_qb_item_name
|
126
|
+
)
|
127
|
+
end
|
127
128
|
|
128
|
-
submitted!
|
129
|
-
|
129
|
+
submitted! # Will fail with invalid owner membership anyway
|
130
|
+
|
131
|
+
if category.present?
|
132
|
+
Effective::Order.new(items: self, user: owner).mark_as_purchased!
|
133
|
+
end
|
134
|
+
|
135
|
+
true
|
130
136
|
end
|
131
137
|
|
132
138
|
end
|
@@ -5,11 +5,7 @@
|
|
5
5
|
= f.text_field :name_confirmation, hint: 'must match name'
|
6
6
|
|
7
7
|
- collection = local_assigns[:parent].try(:stamp_categories) || EffectiveProducts.stamp_categories
|
8
|
-
|
9
|
-
- if collection.length == 1
|
10
|
-
= f.hidden_field :category, value: collection.first
|
11
|
-
- else
|
12
|
-
= f.select :category, collection
|
8
|
+
= f.select :category, collection
|
13
9
|
|
14
10
|
%h4 Shipping address
|
15
11
|
= effective_address_fields(f, :shipping)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_products
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|