effective_orders 5.2.1 → 5.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_orders_datatable.rb +4 -1
- data/app/datatables/effective_orders_datatable.rb +4 -1
- data/app/models/effective/order.rb +17 -8
- data/app/views/effective/orders/_checkout_step2.html.haml +2 -1
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.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: cc1c2f6fea7135b9b7578bef447c14f3485fd68cef06a2c441c17c08fcce5628
|
4
|
+
data.tar.gz: eedc4248429fafb164669fb64a03b0119ae2bbd806847a8022670c0da947ffc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7955c3e945f81015f7f3958cd70ccb80dc55fc935c7e29043a4f2b2174c700c42f9bf32dc322b3743cc2ec5d1b1c38682a24dfcf6322cd631315b63d99b049
|
7
|
+
data.tar.gz: 06e6e17294699a973be1d3b34a6cf0a5d97623e9e9523e9a618113f783bd7ffbefce7d2dd8ec113139feb35d69d120130ca6adb8c917c18f598439adf83012ae
|
@@ -93,7 +93,10 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
|
93
93
|
end
|
94
94
|
|
95
95
|
if attributes[:user_id].present?
|
96
|
-
|
96
|
+
user_klass = (attributes[:user_type].constantize if attributes[:user_type].present?)
|
97
|
+
user_klass ||= current_user.class
|
98
|
+
|
99
|
+
user = user_klass.find(attributes[:user_id])
|
97
100
|
scope = scope.where(user: user)
|
98
101
|
end
|
99
102
|
|
@@ -62,7 +62,10 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
62
62
|
end
|
63
63
|
|
64
64
|
collection do
|
65
|
-
|
65
|
+
user_klass = (attributes[:user_type].constantize if attributes[:user_type].present?)
|
66
|
+
user_klass ||= current_user.class
|
67
|
+
|
68
|
+
user = user_klass.find(attributes[:user_id])
|
66
69
|
|
67
70
|
scope = Effective::Order.all.deep.where(user: user)
|
68
71
|
|
@@ -459,13 +459,16 @@ module Effective
|
|
459
459
|
self.payment = payment_to_h(payment) if self.payment.blank?
|
460
460
|
|
461
461
|
begin
|
462
|
-
|
462
|
+
EffectiveResources.transaction do
|
463
463
|
run_purchasable_callbacks(:before_purchase)
|
464
|
+
|
464
465
|
save!
|
465
466
|
update_purchasables_purchased_order!
|
467
|
+
|
468
|
+
run_purchasable_callbacks(:after_purchase)
|
466
469
|
end
|
467
470
|
rescue => e
|
468
|
-
|
471
|
+
EffectiveResources.transaction do
|
469
472
|
save!(validate: false)
|
470
473
|
update_purchasables_purchased_order!
|
471
474
|
end
|
@@ -473,7 +476,6 @@ module Effective
|
|
473
476
|
raise(e)
|
474
477
|
end
|
475
478
|
|
476
|
-
run_purchasable_callbacks(:after_purchase)
|
477
479
|
send_order_receipts! if email
|
478
480
|
|
479
481
|
true
|
@@ -506,9 +508,11 @@ module Effective
|
|
506
508
|
skip_buyer_validations: true
|
507
509
|
)
|
508
510
|
|
509
|
-
|
511
|
+
EffectiveResources.transaction do
|
510
512
|
begin
|
513
|
+
run_purchasable_callbacks(:before_decline)
|
511
514
|
save!(validate: validate)
|
515
|
+
run_purchasable_callbacks(:after_decline)
|
512
516
|
rescue => e
|
513
517
|
self.state = state_was
|
514
518
|
|
@@ -519,8 +523,6 @@ module Effective
|
|
519
523
|
|
520
524
|
raise "Failed to decline order: #{error || errors.full_messages.to_sentence}" unless error.nil?
|
521
525
|
|
522
|
-
run_purchasable_callbacks(:after_decline)
|
523
|
-
|
524
526
|
true
|
525
527
|
end
|
526
528
|
|
@@ -637,8 +639,15 @@ module Effective
|
|
637
639
|
end
|
638
640
|
|
639
641
|
def run_purchasable_callbacks(name)
|
640
|
-
order_items.
|
641
|
-
|
642
|
+
order_items.select { |item| item.purchasable.respond_to?(name) }.each do |item|
|
643
|
+
EffectiveResources.transaction(item) { item.purchasable.public_send(name, self, item) }
|
644
|
+
end
|
645
|
+
|
646
|
+
if parent.respond_to?(name)
|
647
|
+
EffectiveResources.transaction(parent) { parent.public_send(name, self) }
|
648
|
+
end
|
649
|
+
|
650
|
+
true
|
642
651
|
end
|
643
652
|
|
644
653
|
def send_email(email, *args)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
= render partial: 'effective/orders/order', locals: { order: order }
|
2
2
|
|
3
|
-
- if
|
3
|
+
- # Show this if I'm on the effective orders checkout screen. But not on a rendered order.
|
4
|
+
- if order.persisted? && order.user == current_user && request.path.to_s.start_with?(effective_orders.order_path(order))
|
4
5
|
.effective-order-change-items
|
5
6
|
= link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow, class: 'btn btn-secondary'
|
6
7
|
|
data/lib/effective_orders.rb
CHANGED
@@ -116,7 +116,7 @@ module EffectiveOrders
|
|
116
116
|
|
117
117
|
# The Effective::Order.payment_provider value must be in this collection
|
118
118
|
def self.payment_providers
|
119
|
-
|
119
|
+
[
|
120
120
|
('cheque' if cheque?),
|
121
121
|
('credit card' if mark_as_paid?),
|
122
122
|
('free' if free?),
|
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: 5.2.
|
4
|
+
version: 5.2.5
|
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: 2021-
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|