effective_orders 4.4.0 → 4.4.1
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/effective/concerns/purchase.rb +1 -1
- data/app/models/effective/order.rb +0 -5
- data/app/models/effective/order_item.rb +4 -3
- data/app/views/effective/orders/_fields.html.haml +0 -3
- data/app/views/effective/orders/_order_items.html.haml +2 -2
- data/app/views/effective/orders/_order_payment_details.html.haml +1 -1
- data/app/views/effective/orders/_order_terms_and_conditions_fields.html.haml +2 -1
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +3 -4
- data/config/effective_orders.rb +0 -8
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.rb +2 -7
- metadata +2 -3
- data/app/views/effective/orders/_order_user_fields.html.haml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf23a88730117604f503a6f3e21faba53a1c476dbbd4195ef966b2aa87a0c85
|
4
|
+
data.tar.gz: 90920a87a7d90d46bac4cf459f3010a1e7d95899e5fd6c69c0ca8990a58acc53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199027ed41a806c19cfd3a7762b6c75d2ea6f1ce26f1545a90a7e8b2c3425d357ff99a9eae1cde269f66a40a7ee4fd4cda9a5a14728cb072bf477482b69d3d20
|
7
|
+
data.tar.gz: 717ee3e9b5c79c3ca741037ca5a39e8560ed5f8f545ffec60177e7139511080fbcad6fd11e760f8288aa57efc4cfafe581ec24d9ddb346a6ce655d680f287593
|
@@ -27,7 +27,7 @@ module Effective
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def order_declined(payment:, provider:, card: 'none', message: nil, declined_url: nil)
|
30
|
-
@order.decline!(payment: payment, provider: provider, card: card)
|
30
|
+
@order.decline!(payment: payment, provider: provider, card: card)
|
31
31
|
|
32
32
|
flash[:danger] = message.presence || 'Payment was unsuccessful. Your credit card was declined by the payment processor. Please try again.'
|
33
33
|
|
@@ -84,11 +84,6 @@ module Effective
|
|
84
84
|
validates :tax_rate, presence: { message: "can't be determined based on billing address" }
|
85
85
|
validates :tax, presence: true
|
86
86
|
|
87
|
-
unless EffectiveOrders.skip_user_validation
|
88
|
-
validates :billing_name, presence: true
|
89
|
-
validates :user, associated: true
|
90
|
-
end
|
91
|
-
|
92
87
|
if EffectiveOrders.billing_address
|
93
88
|
validates :billing_address, presence: true
|
94
89
|
end
|
@@ -5,9 +5,6 @@ module Effective
|
|
5
5
|
belongs_to :order, class_name: 'Effective::Order'
|
6
6
|
belongs_to :purchasable, polymorphic: true
|
7
7
|
|
8
|
-
delegate :purchased_download_url, to: :purchasable
|
9
|
-
delegate :purchased?, :declined?, to: :order
|
10
|
-
|
11
8
|
# Attributes
|
12
9
|
# name :string
|
13
10
|
# quantity :integer
|
@@ -30,6 +27,10 @@ module Effective
|
|
30
27
|
(quantity || 0) > 1 ? "#{quantity}x #{name}" : name
|
31
28
|
end
|
32
29
|
|
30
|
+
def purchased_download_url
|
31
|
+
purchasable&.purchased_download_url
|
32
|
+
end
|
33
|
+
|
33
34
|
def subtotal
|
34
35
|
price * quantity
|
35
36
|
end
|
@@ -9,9 +9,6 @@
|
|
9
9
|
.effective-order-change-items
|
10
10
|
= link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-secondary'
|
11
11
|
|
12
|
-
- if EffectiveOrders.collect_user_fields.present? && form.object.user.present?
|
13
|
-
= render 'effective/orders/order_user_fields', form: form, user: form.object.user
|
14
|
-
|
15
12
|
- num_addresses = [EffectiveOrders.billing_address, EffectiveOrders.shipping_address].count(true)
|
16
13
|
|
17
14
|
- if num_addresses > 0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present?
|
1
|
+
- include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? }
|
2
2
|
- include_quantity_column = order.order_items.any? { |order_item| order_item.quantity > 1 }
|
3
3
|
|
4
4
|
.effective-order-items
|
@@ -19,7 +19,7 @@
|
|
19
19
|
%td.quantity= item.quantity
|
20
20
|
- if include_download_column
|
21
21
|
%td.download
|
22
|
-
- if item.
|
22
|
+
- if item.purchased_download_url.present?
|
23
23
|
= link_to 'download', item.purchased_download_url
|
24
24
|
- else
|
25
25
|
= '-'
|
@@ -2,6 +2,7 @@
|
|
2
2
|
%h2 Terms and Conditions
|
3
3
|
|
4
4
|
- terms = EffectiveOrders.terms_and_conditions_label
|
5
|
+
- label = terms.respond_to?(:call) ? instance_exec(form.object, &terms) : terms
|
5
6
|
|
6
7
|
= form.check_box :terms_and_conditions, required: true,
|
7
|
-
label: (
|
8
|
+
label: (label.presence || 'I accept the terms and conditions.').html_safe
|
@@ -9,11 +9,10 @@
|
|
9
9
|
|
10
10
|
= f.text_field :payment_card,
|
11
11
|
label: 'Payment card type, cheque or transaction number',
|
12
|
-
|
13
|
-
hint: 'Full credit card numbers should not be entered here, or anywhere.'
|
12
|
+
hint: 'Do not enter credit card numbers here, or anywhere.'
|
14
13
|
|
15
14
|
= f.text_area :payment,
|
16
|
-
label: 'Additional details',
|
15
|
+
label: 'Additional payment details',
|
17
16
|
input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
|
18
17
|
|
19
18
|
= f.check_box :send_mark_as_paid_email_to_buyer,
|
@@ -22,5 +21,5 @@
|
|
22
21
|
|
23
22
|
= f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
|
24
23
|
|
25
|
-
= f.submit order_checkout_label(:mark_as_paid)
|
24
|
+
= f.submit order_checkout_label(:mark_as_paid), center: true
|
26
25
|
|
data/config/effective_orders.rb
CHANGED
@@ -54,14 +54,6 @@ EffectiveOrders.setup do |config|
|
|
54
54
|
# Use effective_obfuscation gem to change order.id into a seemingly random 10-digit number
|
55
55
|
config.obfuscate_order_ids = false
|
56
56
|
|
57
|
-
# If set, the orders#new screen will render effective/orders/_order_user_fields to capture this User Info
|
58
|
-
# The partial can be overridden to customize the form, but the following fields are also fed into strong_paramters
|
59
|
-
config.collect_user_fields = []
|
60
|
-
#config.collect_user_fields = [:first_name, :last_name] # Must be valid fields on the User object
|
61
|
-
|
62
|
-
# Don't validate_associated :user when saving an Order
|
63
|
-
config.skip_user_validation = false
|
64
|
-
|
65
57
|
# If set, the orders#new screen will render effective/orders/_order_note_fields to capture any Note info
|
66
58
|
config.collect_note = false
|
67
59
|
config.collect_note_required = false
|
data/lib/effective_orders.rb
CHANGED
@@ -39,9 +39,6 @@ module EffectiveOrders
|
|
39
39
|
mattr_accessor :shipping_address
|
40
40
|
mattr_accessor :use_address_full_name
|
41
41
|
|
42
|
-
mattr_accessor :collect_user_fields
|
43
|
-
mattr_accessor :skip_user_validation
|
44
|
-
|
45
42
|
mattr_accessor :collect_note
|
46
43
|
mattr_accessor :collect_note_required
|
47
44
|
mattr_accessor :collect_note_message
|
@@ -92,7 +89,6 @@ module EffectiveOrders
|
|
92
89
|
:note, :terms_and_conditions, :confirmed_checkout,
|
93
90
|
billing_address: EffectiveAddresses.permitted_params,
|
94
91
|
shipping_address: EffectiveAddresses.permitted_params,
|
95
|
-
user_attributes: (EffectiveOrders.collect_user_fields || []),
|
96
92
|
subscripter: [:stripe_plan_id, :stripe_token]
|
97
93
|
]
|
98
94
|
end
|
@@ -138,20 +134,20 @@ module EffectiveOrders
|
|
138
134
|
end
|
139
135
|
|
140
136
|
def self.single_payment_processor?
|
141
|
-
[
|
137
|
+
[moneris?, paypal?, stripe?].select { |enabled| enabled }.length == 1
|
142
138
|
end
|
143
139
|
|
144
140
|
# The Effective::Order.payment_provider value must be in this collection
|
145
141
|
def self.payment_providers
|
146
142
|
[
|
147
143
|
('cheque' if cheque? || mark_as_paid?),
|
144
|
+
('credit card' if mark_as_paid?),
|
148
145
|
('free' if free?),
|
149
146
|
('moneris' if moneris?),
|
150
147
|
('paypal' if paypal?),
|
151
148
|
('pretend' if pretend?),
|
152
149
|
('refund' if refund?),
|
153
150
|
('stripe' if stripe?),
|
154
|
-
('credit card' if mark_as_paid?),
|
155
151
|
('other' if mark_as_paid?),
|
156
152
|
'none'
|
157
153
|
].compact
|
@@ -162,7 +158,6 @@ module EffectiveOrders
|
|
162
158
|
return false if require_shipping_address
|
163
159
|
return false if collect_note
|
164
160
|
return false if terms_and_conditions
|
165
|
-
return false if collect_user_fields.present?
|
166
161
|
true
|
167
162
|
end
|
168
163
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.1
|
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: 2020-04-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -201,7 +201,6 @@ files:
|
|
201
201
|
- app/views/effective/orders/_order_payment_details.html.haml
|
202
202
|
- app/views/effective/orders/_order_shipping.html.haml
|
203
203
|
- app/views/effective/orders/_order_terms_and_conditions_fields.html.haml
|
204
|
-
- app/views/effective/orders/_order_user_fields.html.haml
|
205
204
|
- app/views/effective/orders/_orders_table.html.haml
|
206
205
|
- app/views/effective/orders/cheque/_form.html.haml
|
207
206
|
- app/views/effective/orders/cheque/pay_by_cheque.html.haml
|