effective_orders 6.5.9 → 6.6.0
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/datatables/admin/effective_orders_datatable.rb +2 -0
- data/app/datatables/effective_orders_datatable.rb +2 -0
- data/app/mailers/effective/orders_mailer.rb +2 -2
- data/app/models/effective/order.rb +9 -4
- data/db/migrate/01_create_effective_orders.rb.erb +3 -0
- data/lib/effective_orders/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: 4e804f4ca70a3cb57e200abd2dc81f3148db743f3f76680dd3368f34a631d355
|
4
|
+
data.tar.gz: d88242d6315a34d6fe4aca05f44b8a0445e688cea8265439659d7be693010f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc681292de818d3248e8cf757a80ffe1efa097685036ded498c6f322a0181e175d069f85b551139cd1f52253dd866da3f3c3708aa3bcb6f436ccb634814bc853
|
7
|
+
data.tar.gz: fe83a4ee4de83547f88e18b75d30996c884d7edb3721161cf64b180ead5b7780da27857f6ba342d7657242cd73655461d824f6f1780e1157563f3ac94440e555
|
@@ -44,6 +44,8 @@ module Admin
|
|
44
44
|
order.purchased_at&.strftime('%F %H:%M') || ('pending refund' if order.pending_refund?) || ("pending #{order.payment_provider}" if order.deferred?) || 'not purchased'
|
45
45
|
end
|
46
46
|
|
47
|
+
col :purchased_by, search: :string
|
48
|
+
|
47
49
|
if attributes[:user_id].blank?
|
48
50
|
col :user, search: :string
|
49
51
|
col :billing_name, visible: false
|
@@ -21,8 +21,8 @@ module Effective
|
|
21
21
|
subject = subject_for(__method__, "Order Receipt: ##{@order.to_param}", resource, opts)
|
22
22
|
headers = headers_for(resource, opts)
|
23
23
|
|
24
|
-
# Just
|
25
|
-
mail(to: @order.
|
24
|
+
# Just to the purchaser. Not everyone.
|
25
|
+
mail(to: @order.emails.first, cc: @order.cc.presence, subject: subject, **headers)
|
26
26
|
end
|
27
27
|
|
28
28
|
# This is sent when an admin creates a new order or /admin/orders/new
|
@@ -31,13 +31,17 @@ module Effective
|
|
31
31
|
# If we want to use orders in a has_many way
|
32
32
|
belongs_to :parent, polymorphic: true, optional: true
|
33
33
|
|
34
|
-
|
34
|
+
# This is user the order is for
|
35
|
+
belongs_to :user, polymorphic: true, optional: true, validate: false
|
35
36
|
accepts_nested_attributes_for :user, allow_destroy: false, update_only: true
|
36
37
|
|
37
38
|
# When an organization is present, any user with role :billing in that organization can purchase this order
|
38
39
|
belongs_to :organization, polymorphic: true, optional: true, validate: false
|
39
40
|
accepts_nested_attributes_for :organization, allow_destroy: false, update_only: true
|
40
41
|
|
42
|
+
# When purchased, this is the user that purchased it.
|
43
|
+
belongs_to :purchased_by, polymorphic: true, optional: true, validate: false
|
44
|
+
|
41
45
|
has_many :order_items, -> { order(:id) }, inverse_of: :order, dependent: :delete_all
|
42
46
|
accepts_nested_attributes_for :order_items, allow_destroy: true, reject_if: :all_blank
|
43
47
|
|
@@ -75,7 +79,7 @@ module Effective
|
|
75
79
|
|
76
80
|
serialize :payment, Hash
|
77
81
|
|
78
|
-
scope :deep, -> { includes(:addresses, :user, :organization, order_items: :purchasable) }
|
82
|
+
scope :deep, -> { includes(:addresses, :user, :purchased_by, :organization, order_items: :purchasable) }
|
79
83
|
scope :sorted, -> { order(:id) }
|
80
84
|
|
81
85
|
scope :purchased, -> { where(state: EffectiveOrders::PURCHASED) }
|
@@ -605,9 +609,10 @@ module Effective
|
|
605
609
|
state: EffectiveOrders::PURCHASED,
|
606
610
|
skip_buyer_validations: skip_buyer_validations,
|
607
611
|
|
608
|
-
payment: payment_to_h(payment.presence || 'none'),
|
609
612
|
purchased_at: (purchased_at.presence || Time.zone.now),
|
613
|
+
purchased_by: (purchased_by.presence || current_user),
|
610
614
|
|
615
|
+
payment: payment_to_h(payment.presence || 'none'),
|
611
616
|
payment_provider: (provider.presence || 'none'),
|
612
617
|
payment_card: (card.presence || 'none')
|
613
618
|
)
|
@@ -707,7 +712,7 @@ module Effective
|
|
707
712
|
|
708
713
|
# These are all the emails we send all notifications to
|
709
714
|
def emails
|
710
|
-
([email] + [user.try(:email)] + Array(organization.try(:billing_emails))).map(&:presence).compact.uniq
|
715
|
+
([purchased_by.try(:email)] + [email] + [user.try(:email)] + Array(organization.try(:billing_emails))).map(&:presence).compact.uniq
|
711
716
|
end
|
712
717
|
|
713
718
|
# Doesn't control anything. Purely for the flash messaging
|
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: 6.
|
4
|
+
version: 6.6.0
|
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: 2023-
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|