effective_orders 6.19.7 → 6.21.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/controllers/effective/concerns/purchase.rb +2 -2
- data/app/controllers/effective/providers/mark_as_paid.rb +1 -1
- data/app/datatables/admin/effective_orders_datatable.rb +3 -3
- data/app/mailers/effective/orders_mailer.rb +18 -55
- data/app/models/effective/order.rb +28 -76
- data/app/models/effective/order_email.rb +102 -0
- data/app/views/effective/order_emails/_header.html.haml +20 -0
- data/app/views/effective/order_emails/_info.html.haml +91 -0
- data/app/views/effective/order_emails/_items.html.haml +1 -0
- data/app/views/effective/order_emails/_order_email.html.haml +6 -0
- data/app/views/effective/order_emails/_signature.html.haml +12 -0
- data/app/views/effective/orders/_order_declined.html.haml +1 -1
- data/app/views/effective/orders/_order_deferred.html.haml +11 -7
- data/app/views/effective/orders/_order_items.html.haml +15 -23
- data/app/views/effective/orders/_order_payment.html.haml +1 -5
- data/app/views/effective/orders/delayed/_form.html.haml +2 -2
- data/app/views/effective/orders_mailer/order_email.html.haml +1 -0
- data/app/views/effective/orders_mailer/order_email_to_admin.html.haml +1 -0
- data/config/locales/effective_orders.en.yml +2 -2
- data/config/routes.rb +3 -3
- data/lib/effective_orders/version.rb +1 -1
- metadata +10 -8
- data/app/views/effective/orders_mailer/order_declined_to_admin.html.haml +0 -2
- data/app/views/effective/orders_mailer/order_declined_to_buyer.html.haml +0 -2
- data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +0 -2
- data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +0 -2
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +0 -13
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97151cf216b4f8b8d58f6516b4ec25670c9d3f0f0584bd2c5e148af880c29966
|
4
|
+
data.tar.gz: c662d0b7d645e8c8a73d2ce7db652a0c5b1de51a7814415d72c0d8c75dcc2ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 816cf35587e725a2c626cfe5b5b90c0aa0abcad36d876f9bc07ef5dda91433af2b61f2016d51916d589eca85f06fc0eec82793ef9116f4841b80b233a12c25bc
|
7
|
+
data.tar.gz: 3969c1bee85ab1ce17bb2181360ae55caaf3d6b6795f6541b976540622076373c8e204db7ea18d1915ac02e9566e8ef6f2a27719073ea6424398b851eb10ae68
|
@@ -21,7 +21,7 @@ module Effective
|
|
21
21
|
Effective::Cart.where(user: @order.current_user).destroy_all if @order.current_user.present?
|
22
22
|
|
23
23
|
if flash[:success].blank?
|
24
|
-
if email &&
|
24
|
+
if email && EffectiveOrders.send_order_receipt_to_buyer
|
25
25
|
flash[:success] = "Payment successful! A receipt has been sent to #{@order.email}"
|
26
26
|
else
|
27
27
|
flash[:success] = "Payment successful! An email receipt has not been sent."
|
@@ -49,7 +49,7 @@ module Effective
|
|
49
49
|
redirect_to deferred_url.gsub(':id', @order.to_param.to_s)
|
50
50
|
end
|
51
51
|
|
52
|
-
def order_delayed(payment:, payment_intent:, provider:, card: 'none', email:
|
52
|
+
def order_delayed(payment:, payment_intent:, provider:, card: 'none', email: true, deferred_url: nil)
|
53
53
|
@order.delay!(payment: payment, payment_intent: payment_intent, provider: provider, card: card, email: email)
|
54
54
|
|
55
55
|
Effective::Cart.where(user: @order.current_user).destroy_all if @order.current_user.present?
|
@@ -18,7 +18,7 @@ module Effective
|
|
18
18
|
payment: 'mark as paid',
|
19
19
|
provider: mark_as_paid_params[:payment_provider],
|
20
20
|
card: mark_as_paid_params[:payment_card],
|
21
|
-
email:
|
21
|
+
email: EffectiveResources.truthy?(mark_as_paid_params[:send_mark_as_paid_email_to_buyer]),
|
22
22
|
skip_buyer_validations: true,
|
23
23
|
purchased_url: effective_orders.admin_order_path(@order)
|
24
24
|
)
|
@@ -8,9 +8,9 @@ module Admin
|
|
8
8
|
)
|
9
9
|
|
10
10
|
bulk_action(
|
11
|
-
|
12
|
-
effective_orders.
|
13
|
-
data: { confirm: 'Send
|
11
|
+
'Send invoice email to selected purchased orders',
|
12
|
+
effective_orders.bulk_send_order_email_to_buyer_orders_path,
|
13
|
+
data: { confirm: 'Send invoice emails?' }
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
@@ -3,74 +3,35 @@ module Effective
|
|
3
3
|
include EffectiveMailer
|
4
4
|
|
5
5
|
helper EffectiveOrdersHelper
|
6
|
+
helper EffectiveEventsHelper if defined?(EffectiveEventsHelper)
|
6
7
|
|
7
|
-
|
8
|
+
# This is the new order email
|
9
|
+
# It's sent from like 15 different places in 15 different ways
|
10
|
+
# Has to be aware of events and registrations, applicants, renewals, etc
|
11
|
+
# Has to be aware of deferred payments, delayed payments, requests for payment, purchased, declined etc
|
12
|
+
def order_email(resource, opts = {})
|
8
13
|
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
9
14
|
|
10
15
|
@order = resource
|
11
|
-
|
12
|
-
headers = headers_for(resource, opts)
|
13
|
-
|
14
|
-
mail(to: mailer_admin, subject: subject, **headers)
|
15
|
-
end
|
16
|
-
|
17
|
-
def order_receipt_to_buyer(resource, opts = {})
|
18
|
-
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
19
|
-
|
20
|
-
@order = resource
|
21
|
-
subject = subject_for(__method__, "Order Receipt: ##{@order.to_param}", resource, opts)
|
22
|
-
headers = headers_for(resource, opts)
|
16
|
+
@order_email = Effective::OrderEmail.new(resource, opts)
|
23
17
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def order_declined_to_admin(resource, opts = {})
|
29
|
-
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
30
|
-
|
31
|
-
@order = resource
|
32
|
-
subject = subject_for(__method__, "Declined Order: ##{@order.to_param}", resource, opts)
|
33
|
-
headers = headers_for(resource, opts)
|
34
|
-
|
35
|
-
mail(to: mailer_admin, subject: subject, **headers)
|
36
|
-
end
|
37
|
-
|
38
|
-
def order_declined_to_buyer(resource, opts = {})
|
39
|
-
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
40
|
-
|
41
|
-
@order = resource
|
42
|
-
subject = subject_for(__method__, "Declined Order: ##{@order.to_param}", resource, opts)
|
43
|
-
headers = headers_for(resource, opts)
|
44
|
-
|
45
|
-
# Just to the purchaser. Not everyone.
|
46
|
-
mail(to: @order.emails.first, cc: @order.cc.presence, subject: subject, **headers)
|
47
|
-
end
|
48
|
-
|
49
|
-
# This is sent when an admin creates a new order or /admin/orders/new
|
50
|
-
# Or when Pay by Cheque or Pay by Phone (deferred payments)
|
51
|
-
# Or uses the order action Send Payment Request
|
52
|
-
def payment_request_to_buyer(resource, opts = {})
|
53
|
-
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
54
|
-
|
55
|
-
@order = resource
|
56
|
-
subject = subject_for(__method__, "Payment request - Order ##{@order.to_param}", resource, opts)
|
57
|
-
headers = headers_for(resource, opts)
|
18
|
+
subject = subject_for(__method__, @order_email.subject, @order, opts)
|
19
|
+
headers = headers_for(@order, opts)
|
58
20
|
|
59
|
-
mail(to: @
|
21
|
+
mail(to: @order_email.to, cc: @order_email.cc, subject: subject, **headers)
|
60
22
|
end
|
61
23
|
|
62
|
-
#
|
63
|
-
|
64
|
-
def pending_order_invoice_to_buyer(resource, opts = {})
|
24
|
+
# Same as above but sent to admin
|
25
|
+
def order_email_to_admin(resource, opts = {})
|
65
26
|
raise('expected an Effective::Order') unless resource.kind_of?(Effective::Order)
|
66
27
|
|
67
28
|
@order = resource
|
68
|
-
|
69
|
-
headers = headers_for(resource, opts)
|
29
|
+
@order_email = Effective::OrderEmail.new(resource)
|
70
30
|
|
71
|
-
|
31
|
+
subject = subject_for(__method__, @order_email.subject, @order, opts)
|
32
|
+
headers = headers_for(@order, opts)
|
72
33
|
|
73
|
-
mail(to:
|
34
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
74
35
|
end
|
75
36
|
|
76
37
|
# This is sent to admin when someone Accepts Refund
|
@@ -84,6 +45,8 @@ module Effective
|
|
84
45
|
mail(to: mailer_admin, subject: subject, **headers)
|
85
46
|
end
|
86
47
|
|
48
|
+
#### OLD EMAILS ####
|
49
|
+
|
87
50
|
# Sent by the invoice.payment_succeeded webhook event
|
88
51
|
def subscription_payment_succeeded(resource, opts = {})
|
89
52
|
raise('expected an Effective::Customer') unless resource.kind_of?(Effective::Customer)
|
@@ -46,6 +46,7 @@ module Effective
|
|
46
46
|
attr_accessor :send_payment_request_to_buyer # Set by Admin::Orders#new. Should the payment request email be sent after creating an order?
|
47
47
|
attr_accessor :send_mark_as_paid_email_to_buyer # Set by Admin::Orders#mark_as_paid
|
48
48
|
attr_accessor :skip_buyer_validations # Set by Admin::Orders#create
|
49
|
+
attr_accessor :mailer_preview # Set by the mailer preview. Disabled delayed payment validations
|
49
50
|
|
50
51
|
# If we want to use orders in a has_many way
|
51
52
|
belongs_to :parent, polymorphic: true, optional: true
|
@@ -251,7 +252,7 @@ module Effective
|
|
251
252
|
validates :payment_provider, presence: true
|
252
253
|
|
253
254
|
validate do
|
254
|
-
unless deferred_payment_provider? || delayed_payment_provider?
|
255
|
+
unless deferred_payment_provider? || delayed_payment_provider? || mailer_preview
|
255
256
|
errors.add(:payment_provider, "unknown deferred payment provider")
|
256
257
|
end
|
257
258
|
end
|
@@ -421,16 +422,16 @@ module Effective
|
|
421
422
|
elsif purchased?
|
422
423
|
'Receipt'
|
423
424
|
elsif refund? && (pending? || confirmed?)
|
424
|
-
'Pending
|
425
|
+
'Pending refund'
|
425
426
|
elsif (pending? || confirmed?)
|
426
|
-
'Pending
|
427
|
+
'Pending order'
|
427
428
|
else
|
428
429
|
'Order'
|
429
430
|
end
|
430
431
|
end
|
431
432
|
|
432
433
|
def total_label
|
433
|
-
purchased? ? 'Total
|
434
|
+
purchased? ? 'Total paid' : 'Total due'
|
434
435
|
end
|
435
436
|
|
436
437
|
def payment_method
|
@@ -611,41 +612,6 @@ module Effective
|
|
611
612
|
present_order_items.map { |oi| oi.quantity }.sum
|
612
613
|
end
|
613
614
|
|
614
|
-
def send_order_receipt_to_admin?
|
615
|
-
return false if free? && !EffectiveOrders.send_order_receipts_when_free
|
616
|
-
EffectiveOrders.send_order_receipt_to_admin
|
617
|
-
end
|
618
|
-
|
619
|
-
def send_order_receipt_to_buyer?
|
620
|
-
return false if free? && !EffectiveOrders.send_order_receipts_when_free
|
621
|
-
EffectiveOrders.send_order_receipt_to_buyer
|
622
|
-
end
|
623
|
-
|
624
|
-
def send_order_declined_to_admin?
|
625
|
-
return false if free? && !EffectiveOrders.send_order_receipts_when_free
|
626
|
-
EffectiveOrders.send_order_declined_to_admin
|
627
|
-
end
|
628
|
-
|
629
|
-
def send_order_declined_to_buyer?
|
630
|
-
return false if free? && !EffectiveOrders.send_order_receipts_when_free
|
631
|
-
EffectiveOrders.send_order_declined_to_buyer
|
632
|
-
end
|
633
|
-
|
634
|
-
def send_payment_request_to_buyer?
|
635
|
-
return false if free? && !EffectiveOrders.send_order_receipts_when_free
|
636
|
-
return false if refund?
|
637
|
-
|
638
|
-
EffectiveResources.truthy?(send_payment_request_to_buyer)
|
639
|
-
end
|
640
|
-
|
641
|
-
def send_refund_notification_to_admin?
|
642
|
-
return false unless refund?
|
643
|
-
EffectiveOrders.send_refund_notification_to_admin
|
644
|
-
end
|
645
|
-
|
646
|
-
def send_mark_as_paid_email_to_buyer?
|
647
|
-
EffectiveResources.truthy?(send_mark_as_paid_email_to_buyer)
|
648
|
-
end
|
649
615
|
|
650
616
|
def skip_buyer_validations?
|
651
617
|
EffectiveResources.truthy?(skip_buyer_validations)
|
@@ -662,7 +628,7 @@ module Effective
|
|
662
628
|
self.addresses.clear if addresses.any? { |address| address.valid? == false }
|
663
629
|
save!
|
664
630
|
|
665
|
-
if send_payment_request_to_buyer
|
631
|
+
if EffectiveResources.truthy?(send_payment_request_to_buyer)
|
666
632
|
after_commit { send_payment_request_to_buyer! }
|
667
633
|
end
|
668
634
|
|
@@ -752,7 +718,7 @@ module Effective
|
|
752
718
|
raise(e)
|
753
719
|
end
|
754
720
|
|
755
|
-
|
721
|
+
send_order_emails! if email
|
756
722
|
after_commit { sync_quickbooks!(skip: skip_quickbooks) }
|
757
723
|
|
758
724
|
true
|
@@ -777,9 +743,9 @@ module Effective
|
|
777
743
|
|
778
744
|
# This was submitted via the deluxe_delayed provider checkout
|
779
745
|
# This is a special case of a deferred provider. We require the payment_intent and payment info
|
780
|
-
def delay!(payment:, payment_intent:, provider:, card:, email:
|
746
|
+
def delay!(payment:, payment_intent:, provider:, card:, email: true, validate: true)
|
781
747
|
raise('expected payment intent to be a String') unless payment_intent.kind_of?(String)
|
782
|
-
raise('expected a delayed payment provider') unless EffectiveOrders.delayed_providers.include?(provider)
|
748
|
+
raise('expected a delayed payment provider') unless EffectiveOrders.delayed_providers.include?(provider) || mailer_preview
|
783
749
|
raise('expected a delayed payment order with a delayed_payment_date') unless delayed_payment? && delayed_payment_date.present?
|
784
750
|
|
785
751
|
assign_attributes(
|
@@ -832,7 +798,7 @@ module Effective
|
|
832
798
|
|
833
799
|
raise "Failed to defer order: #{error || errors.full_messages.to_sentence}" unless error.nil?
|
834
800
|
|
835
|
-
|
801
|
+
send_order_emails! if email
|
836
802
|
|
837
803
|
true
|
838
804
|
end
|
@@ -873,7 +839,7 @@ module Effective
|
|
873
839
|
|
874
840
|
raise "Failed to decline order: #{error || errors.full_messages.to_sentence}" unless error.nil?
|
875
841
|
|
876
|
-
|
842
|
+
send_order_emails! if email
|
877
843
|
|
878
844
|
true
|
879
845
|
end
|
@@ -913,44 +879,30 @@ module Effective
|
|
913
879
|
(emails + [cc.presence]).compact.uniq.to_sentence
|
914
880
|
end
|
915
881
|
|
916
|
-
def
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
def send_declined_notifications!
|
923
|
-
send_order_declined_to_admin! if send_order_declined_to_admin?
|
924
|
-
send_order_declined_to_buyer! if send_order_declined_to_buyer?
|
925
|
-
end
|
926
|
-
|
927
|
-
def send_order_declined_to_admin!
|
928
|
-
EffectiveOrders.send_email(:order_declined_to_admin, self) if declined?
|
929
|
-
end
|
930
|
-
|
931
|
-
def send_order_declined_to_buyer!
|
932
|
-
EffectiveOrders.send_email(:order_declined_to_buyer, self) if declined?
|
933
|
-
end
|
882
|
+
def send_order_emails!
|
883
|
+
if purchased_or_deferred? && (!free? || EffectiveOrders.send_order_receipts_when_free)
|
884
|
+
EffectiveOrders.send_email(:order_email, self) if EffectiveOrders.send_order_receipt_to_buyer
|
885
|
+
EffectiveOrders.send_email(:order_email_to_admin, self) if EffectiveOrders.send_order_receipt_to_admin
|
886
|
+
end
|
934
887
|
|
935
|
-
|
936
|
-
|
937
|
-
|
888
|
+
if declined?
|
889
|
+
EffectiveOrders.send_email(:order_email, self) if EffectiveOrders.send_order_declined_to_buyer
|
890
|
+
EffectiveOrders.send_email(:order_email_to_admin, self) if EffectiveOrders.send_order_declined_to_admin
|
891
|
+
end
|
938
892
|
|
939
|
-
|
940
|
-
|
893
|
+
if refund?
|
894
|
+
EffectiveOrders.send_email(:refund_notification_to_admin, self) if EffectiveOrders.send_refund_notification_to_admin
|
895
|
+
end
|
941
896
|
end
|
942
|
-
alias_method :send_buyer_receipt!, :send_order_receipt_to_buyer!
|
943
897
|
|
898
|
+
# Admin datatable action
|
944
899
|
def send_payment_request_to_buyer!
|
945
|
-
EffectiveOrders.send_email(:
|
946
|
-
end
|
947
|
-
|
948
|
-
def send_pending_order_invoice_to_buyer!
|
949
|
-
EffectiveOrders.send_email(:pending_order_invoice_to_buyer, self) unless purchased?
|
900
|
+
EffectiveOrders.send_email(:order_email, self, payment_request: true) unless (purchased? || refund?)
|
950
901
|
end
|
951
902
|
|
952
|
-
|
953
|
-
|
903
|
+
# Admin datatable action
|
904
|
+
def send_order_email_to_buyer!
|
905
|
+
EffectiveOrders.send_email(:order_email, self) if purchased_or_deferred?
|
954
906
|
end
|
955
907
|
|
956
908
|
protected
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# a PORO to handle all the email logic for an order
|
3
|
+
|
4
|
+
module Effective
|
5
|
+
class OrderEmail
|
6
|
+
attr_accessor :order
|
7
|
+
attr_accessor :opts
|
8
|
+
|
9
|
+
def initialize(order, opts = {})
|
10
|
+
raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
|
11
|
+
raise('expected a Hash of options') unless opts.kind_of?(Hash)
|
12
|
+
|
13
|
+
@order = order
|
14
|
+
@opts = opts
|
15
|
+
end
|
16
|
+
|
17
|
+
# Just to the purchaser. Not everyone.
|
18
|
+
def to
|
19
|
+
return order.emails if payment_request?
|
20
|
+
order.emails.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def cc
|
24
|
+
order.cc.presence
|
25
|
+
end
|
26
|
+
|
27
|
+
# The very first line of the email body
|
28
|
+
def header
|
29
|
+
if event.present? && order.purchased_or_deferred?
|
30
|
+
return "Your tickets have been confirmed!" if event_none_waitlisted?
|
31
|
+
return "Some of your tickets have been confirmed, but some are on the waitlist" if event_some_waitlisted?
|
32
|
+
return "Your tickets are on the waitlist!" if event_all_waitlisted?
|
33
|
+
end
|
34
|
+
|
35
|
+
return "Request for payment" if payment_request?
|
36
|
+
return "Order waiting on payment" if order.deferred?
|
37
|
+
return "Your order has been purchased!" if order.purchased?
|
38
|
+
return "Your order was declined by the payment processor" if order.declined?
|
39
|
+
|
40
|
+
# Fallback
|
41
|
+
"Order: ##{order.to_param}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def subject
|
45
|
+
if event.present? && order.purchased_or_deferred?
|
46
|
+
return "Confirmation - #{event}" if event_none_waitlisted?
|
47
|
+
return "Confirmation & Waitlist - #{event}" if event_some_waitlisted?
|
48
|
+
return "Waitlist - #{event}" if event_all_waitlisted?
|
49
|
+
end
|
50
|
+
|
51
|
+
if event.present? && order.declined?
|
52
|
+
return "Declined payment - #{event} - Order ##{order.to_param}" if order.declined?
|
53
|
+
end
|
54
|
+
|
55
|
+
return "Payment request - Order ##{order.to_param}" if payment_request?
|
56
|
+
return "Waiting on payment - Order ##{order.to_param}" if order.deferred?
|
57
|
+
return "Declined payment - Order ##{order.to_param}" if order.declined?
|
58
|
+
return "Receipt - Order ##{order.to_param}" if order.purchased?
|
59
|
+
|
60
|
+
# Fallback
|
61
|
+
"Order ##{order.to_param}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def payment_request?
|
65
|
+
opts[:payment_request] == true
|
66
|
+
end
|
67
|
+
|
68
|
+
def event
|
69
|
+
order.purchasables.find { |purchasable| purchasable.class.name == "Effective::EventRegistrant" }.try(:event)
|
70
|
+
end
|
71
|
+
|
72
|
+
def event_registration
|
73
|
+
order.purchasables.find { |purchasable| purchasable.class.name == "Effective::EventRegistrant" }.try(:event_registration)
|
74
|
+
end
|
75
|
+
|
76
|
+
def event_registrants
|
77
|
+
order.purchasables.select { |purchasable| purchasable.class.name == "Effective::EventRegistrant" }
|
78
|
+
end
|
79
|
+
|
80
|
+
def event_addons
|
81
|
+
order.purchasables.select { |purchasable| purchasable.class.name == "Effective::EventAddon" }
|
82
|
+
end
|
83
|
+
|
84
|
+
def event_none_waitlisted?
|
85
|
+
return false unless event_registrants.present?
|
86
|
+
event_registrants.none? { |er| er.waitlisted_not_promoted? }
|
87
|
+
end
|
88
|
+
|
89
|
+
def event_some_waitlisted?
|
90
|
+
return false unless event_registrants.present?
|
91
|
+
|
92
|
+
event_registrants.find { |er| er.waitlisted_not_promoted? }.present? &&
|
93
|
+
event_registrants.find { |er| !er.waitlisted_not_promoted? }.present?
|
94
|
+
end
|
95
|
+
|
96
|
+
def event_all_waitlisted?
|
97
|
+
return false unless event_registrants.present?
|
98
|
+
event_registrants.all? { |er| er.waitlisted_not_promoted? }
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.order-emails-header
|
2
|
+
%h1= order_email.header
|
3
|
+
|
4
|
+
- if order.purchased?
|
5
|
+
%p
|
6
|
+
%strong Thank you!
|
7
|
+
|
8
|
+
- elsif order.declined?
|
9
|
+
%p
|
10
|
+
Please
|
11
|
+
= link_to('checkout your order again', effective_orders.order_url(order))
|
12
|
+
or contact us if the problem persists.
|
13
|
+
|
14
|
+
- if (event = order_email.event).present?
|
15
|
+
%h2= event.title
|
16
|
+
%p= effective_events_event_schedule(event)
|
17
|
+
|
18
|
+
- if event.rich_text_confirmation_email.present?
|
19
|
+
%hr
|
20
|
+
.event-rich-text= event.rich_text_confirmation_email.to_s.html_safe
|
@@ -0,0 +1,91 @@
|
|
1
|
+
- if order.delayed? && order.deferred? && order.delayed_payment_date_upcoming?
|
2
|
+
%hr
|
3
|
+
|
4
|
+
%p
|
5
|
+
%strong Important
|
6
|
+
|
7
|
+
- if order_email.event_all_waitlisted?
|
8
|
+
%p
|
9
|
+
Your tickets are currently on the waitlist. Should your registration request be accepted, you will receive an event confirmation email letting you know you should plan to attend, along with your payment details. Thank you for your interest – we look forward to seeing you at an event soon!
|
10
|
+
|
11
|
+
- elsif order_email.event_some_waitlisted?
|
12
|
+
%p
|
13
|
+
Some of your tickets are currently on the waitlist. Should your waitlisted tickets be accepted, you will receive a new event confirmation email letting you know you of the update, along with your payment details. Thank you for your interest – we look forward to seeing you at an event soon!
|
14
|
+
|
15
|
+
- elsif order.payment_provider == 'deluxe_delayed'
|
16
|
+
%ul
|
17
|
+
%li Your credit card will be charged on <strong>#{order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
|
18
|
+
%li Changes and cancellations must be made before this date.
|
19
|
+
%li A receipt will be sent after the transaction is completed.
|
20
|
+
|
21
|
+
- elsif order.payment_provider == 'cheque'
|
22
|
+
%ul
|
23
|
+
%li Please submit your cheque payment within 30 days of the invoice date.
|
24
|
+
%li You have until payment is received or until <strong>#{order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>, whichever is first, to make changes and cancellations.
|
25
|
+
%li A receipt will be sent after payment has been received.
|
26
|
+
|
27
|
+
- elsif order.payment_provider == 'phone'
|
28
|
+
%ul
|
29
|
+
%li Please phone us to submit payment by credit card within 30 days of the invoice date.
|
30
|
+
%li You have until payment is received or until <strong>#{order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>, whichever is first, to make changes and cancellations.
|
31
|
+
%li A receipt will be sent after payment has been received.
|
32
|
+
|
33
|
+
- elsif order.payment_provider == 'etransfer'
|
34
|
+
%ul
|
35
|
+
%li Please submit your etransfer payment within 30 days of the invoice date.
|
36
|
+
%li You have until payment is received or until <strong>#{order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>, whichever is first, to make changes and cancellations.
|
37
|
+
%li A receipt will be sent after payment has been received.
|
38
|
+
|
39
|
+
- else
|
40
|
+
- providers = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', or', two_words_connector: ' or ')
|
41
|
+
%ul
|
42
|
+
- if providers.present?
|
43
|
+
%li When we receive your #{providers} we will mark your order paid.
|
44
|
+
%li You have until payment is received or until <strong>#{order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>, whichever is first, to make changes and cancellations.
|
45
|
+
%li A receipt will be sent after payment has been received.
|
46
|
+
|
47
|
+
|
48
|
+
- elsif order.deferred?
|
49
|
+
%hr
|
50
|
+
|
51
|
+
%p
|
52
|
+
%strong Important
|
53
|
+
|
54
|
+
- if order.payment_provider == 'deluxe_delayed'
|
55
|
+
%ul
|
56
|
+
%li Your credit card will be automatically charged.
|
57
|
+
%li A receipt will be sent after the transaction is completed.
|
58
|
+
- elsif order.payment_provider == 'cheque'
|
59
|
+
%ul
|
60
|
+
%li Please submit your cheque within 30 days of the invoice date.
|
61
|
+
%li A receipt will be sent after payment has been received.
|
62
|
+
- elsif order.payment_provider == 'phone'
|
63
|
+
%ul
|
64
|
+
%li Please phone us to submit payment within 30 days of the invoice date.
|
65
|
+
%li A receipt will be sent after payment has been received.
|
66
|
+
- elsif order.payment_provider == 'etransfer'
|
67
|
+
%ul
|
68
|
+
%li Please submit your etransfer within 30 days of the invoice date.
|
69
|
+
%li A receipt will be sent after payment has been received.
|
70
|
+
- else
|
71
|
+
- providers = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', or', two_words_connector: ' or ')
|
72
|
+
%ul
|
73
|
+
- if providers.present?
|
74
|
+
%li When we receive your #{providers} we will mark your order paid.
|
75
|
+
%li A receipt will be sent after payment has been received.
|
76
|
+
|
77
|
+
|
78
|
+
- elsif order_email.payment_request?
|
79
|
+
%hr
|
80
|
+
|
81
|
+
%p
|
82
|
+
%strong Important
|
83
|
+
|
84
|
+
- providers = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', and', two_words_connector: ', and ')
|
85
|
+
%ul
|
86
|
+
%li Please #{link_to('click here', effective_orders.order_url(@order))} to review your order and pay online.
|
87
|
+
- if providers.present?
|
88
|
+
%li We accept credit card, #{providers}.
|
89
|
+
%li A receipt will be sent after payment has been received.
|
90
|
+
|
91
|
+
%hr
|
@@ -0,0 +1 @@
|
|
1
|
+
= render(order, no_order_actions: true)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- # This is the order email
|
2
|
+
= render('effective/order_emails/header', order_email: order_email, order: order)
|
3
|
+
= render('effective/order_emails/info', order_email: order_email, order: order)
|
4
|
+
= render('effective/order_emails/items', order_email: order_email, order: order)
|
5
|
+
= render('effective/order_emails/signature', order_email: order_email, order: order)
|
6
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%hr
|
2
|
+
|
3
|
+
- event = order_email.event
|
4
|
+
- event_registration = order_email.event_registration
|
5
|
+
|
6
|
+
%p{style: "text-align: center;"}
|
7
|
+
- if event.present? && event_registration.present? && order.delayed_payment_date_upcoming? && order.deferred?
|
8
|
+
= link_to('View or modify your registration', effective_events.event_event_registration_url(event, event_registration))
|
9
|
+
- elsif event.present? && event_registration.present?
|
10
|
+
= link_to('View your registration', effective_events.event_event_registration_url(event, event_registration))
|
11
|
+
- else
|
12
|
+
= link_to('View your order', effective_orders.order_url(order))
|
@@ -3,21 +3,25 @@
|
|
3
3
|
%table.table
|
4
4
|
%thead
|
5
5
|
%tr
|
6
|
-
%th Payment
|
6
|
+
%th Payment method
|
7
7
|
%tbody
|
8
8
|
%tr
|
9
9
|
%td
|
10
|
-
- if order.
|
11
|
-
|
10
|
+
- if order.total == 0
|
11
|
+
Your total due is $0. Should your order total change, you will receive a new invoice, along with your payment details.
|
12
|
+
|
13
|
+
- elsif order.delayed? && order.payment_provider == "deluxe_delayed"
|
14
|
+
Your #{order.delayed_payment_method} will automatically be charged on #{order.delayed_payment_date.strftime("%A, %B %d, %Y")}.
|
15
|
+
|
12
16
|
- else
|
13
|
-
|
17
|
+
Waiting for payment by #{order.payment_provider}.
|
14
18
|
|
15
19
|
- if order.payment_provider == "etransfer" && (EffectiveOrders.etransfer[:success] rescue false).present?
|
16
|
-
|
20
|
+
= EffectiveOrders.etransfer[:success].html_safe
|
17
21
|
|
18
22
|
- if order.payment_provider == "cheque" && (EffectiveOrders.cheque[:success] rescue false).present?
|
19
|
-
|
23
|
+
= EffectiveOrders.cheque[:success].html_safe
|
20
24
|
|
21
25
|
- if order.payment_provider == "phone" && (EffectiveOrders.phone[:success] rescue false).present?
|
22
|
-
|
26
|
+
= EffectiveOrders.phone[:success].html_safe
|
23
27
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.effective-order-items
|
2
|
-
%table.table
|
2
|
+
%table.table{style: "margin-bottom: 20px;"}
|
3
3
|
%thead
|
4
4
|
%tr
|
5
5
|
%th.quantity Qty
|
@@ -14,16 +14,20 @@
|
|
14
14
|
%td.item
|
15
15
|
= item.name.html_safe
|
16
16
|
|
17
|
+
- if item.purchasable.class.name == 'Effective::EventRegistrant'
|
18
|
+
= item.purchasable.try(:responses) || item.purchasable.try(:notes)
|
19
|
+
|
17
20
|
- if order.purchased? && item.purchased_download_url.present?
|
18
21
|
= link_to 'Download', item.purchased_download_url
|
19
22
|
|
20
23
|
%td.price= price_to_currency(item.subtotal)
|
21
24
|
|
22
|
-
%table.table
|
23
25
|
%tfoot
|
24
26
|
%tr
|
25
|
-
%
|
26
|
-
|
27
|
+
%td{colspan: 3}= " ".html_safe
|
28
|
+
|
29
|
+
%tr
|
30
|
+
%th.subtotal{colspan: 2} Subtotal
|
27
31
|
%td.price.subtotal-price= price_to_currency(order.subtotal)
|
28
32
|
|
29
33
|
- if order.tax_rate.blank?
|
@@ -31,42 +35,30 @@
|
|
31
35
|
|
32
36
|
- elsif order.tax_rate.present? && order.surcharge_percent.to_f > 0.0
|
33
37
|
%tr
|
34
|
-
%th
|
35
|
-
%td.tax #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)})
|
38
|
+
%th.tax{colspan: 2} #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)})
|
36
39
|
%td.price.tax-price= price_to_currency(order.tax)
|
37
40
|
|
38
41
|
%tr.single-line
|
39
|
-
%th
|
40
|
-
%td.amount-owing Amount owing before Credit Card Processing Fee
|
42
|
+
%th.amount-owing{colspan: 2} Amount owing before Credit Card Processing Fee
|
41
43
|
%td.price.amount-owing-price= price_to_currency(order.amount_owing)
|
42
44
|
|
43
45
|
%tr
|
44
|
-
%th
|
45
|
-
%td
|
46
|
-
%td
|
47
|
-
|
48
|
-
%tr
|
49
|
-
%th
|
50
|
-
%td.surcharge Credit Card Processing Fee (#{rate_to_percentage(order.surcharge_percent)}) on #{price_to_currency(order.amount_owing)}
|
46
|
+
%th.surcharge{colspan: 2} Credit Card Processing Fee (#{rate_to_percentage(order.surcharge_percent)}) on #{price_to_currency(order.amount_owing)}
|
51
47
|
%td.price.surcharge-price= price_to_currency(order.surcharge)
|
52
48
|
|
53
49
|
%tr
|
54
|
-
%th
|
55
|
-
%td.surcharge-tax #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)}) on Credit Card Processing Fee
|
50
|
+
%th.surcharge-tax{colspan: 2} #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)}) on Credit Card Processing Fee
|
56
51
|
%td.price.surcharge-tax-price= price_to_currency(order.surcharge_tax)
|
57
52
|
|
58
53
|
%tr.double-line
|
59
|
-
%th
|
60
|
-
%td.total Total amount charged to credit card
|
54
|
+
%th.total{colspan: 2} Total amount charged to credit card
|
61
55
|
%td.price.total-price= price_to_currency(order.total)
|
62
56
|
|
63
57
|
- elsif order.tax_rate.present? && !(order.surcharge_percent.to_f > 0.0)
|
64
58
|
%tr
|
65
|
-
%th
|
66
|
-
%td.tax #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)})
|
59
|
+
%th.tax{colspan: 2} #{EffectiveOrders.tax_label} (#{rate_to_percentage(order.tax_rate)})
|
67
60
|
%td.price.tax-price= price_to_currency(order.tax)
|
68
61
|
|
69
62
|
%tr.single-line
|
70
|
-
%th
|
71
|
-
%td.total= order.total_label
|
63
|
+
%th.total{colspan: 2}= order.total_label
|
72
64
|
%td.price.total-price= price_to_currency(order.total)
|
@@ -3,11 +3,7 @@
|
|
3
3
|
%table.table
|
4
4
|
%thead
|
5
5
|
%tr
|
6
|
-
%th
|
7
|
-
%th Date Paid
|
8
|
-
%th Payment Method
|
6
|
+
%th Payment method
|
9
7
|
%tbody
|
10
8
|
%tr
|
11
|
-
%td= price_to_currency(order.total)
|
12
|
-
%td= order.purchased_at.in_time_zone(Time.zone).strftime('%b %d, %Y')
|
13
9
|
%td= order.payment_method
|
@@ -9,11 +9,11 @@
|
|
9
9
|
The payment date for this order
|
10
10
|
|
11
11
|
- if order.delayed_payment_date_upcoming?
|
12
|
-
is in #{distance} from now on #{order.delayed_payment_date.strftime(
|
12
|
+
is in #{distance} from now on #{order.delayed_payment_date.strftime("%A, %B %d, %Y")}
|
13
13
|
- elsif order.delayed_payment_date_today?
|
14
14
|
was today
|
15
15
|
- else
|
16
|
-
was #{distance} ago on #{order.delayed_payment_date.strftime(
|
16
|
+
was #{distance} ago on #{order.delayed_payment_date.strftime("%A, %B %d, %Y")}
|
17
17
|
|
18
18
|
- provider_locals = { order: order, deferred_url: deferred_url, declined_url: declined_url }
|
19
19
|
|
@@ -0,0 +1 @@
|
|
1
|
+
= render('effective/order_emails/order_email', order_email: @order_email, order: @order)
|
@@ -0,0 +1 @@
|
|
1
|
+
= render('effective/order_emails/order_email', order_email: @order_email, order: @order)
|
@@ -6,8 +6,8 @@ en:
|
|
6
6
|
activerecord:
|
7
7
|
actions:
|
8
8
|
effective/order:
|
9
|
-
|
10
|
-
|
9
|
+
send_order_email_to_buyer: 'Send order email'
|
10
|
+
send_order_email_to_buyer_confirm: 'Send order email to @resource.emails_send_to?'
|
11
11
|
|
12
12
|
datatables:
|
13
13
|
admin/report_transactions_datatable: 'Report: Individual Transactions'
|
data/config/routes.rb
CHANGED
@@ -7,7 +7,7 @@ EffectiveOrders::Engine.routes.draw do
|
|
7
7
|
get :purchased
|
8
8
|
get :deferred
|
9
9
|
get :declined
|
10
|
-
post :
|
10
|
+
post :send_order_email_to_buyer
|
11
11
|
|
12
12
|
post :cheque
|
13
13
|
post :deluxe # 1-off payment and purchase
|
@@ -25,7 +25,7 @@ EffectiveOrders::Engine.routes.draw do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
collection do
|
28
|
-
post :
|
28
|
+
post :bulk_send_order_email_to_buyer
|
29
29
|
|
30
30
|
post :moneris_postback
|
31
31
|
post :paypal_postback
|
@@ -56,7 +56,7 @@ EffectiveOrders::Engine.routes.draw do
|
|
56
56
|
resources :orders do
|
57
57
|
member do
|
58
58
|
post :send_payment_request
|
59
|
-
post :
|
59
|
+
post :send_order_email_to_buyer
|
60
60
|
|
61
61
|
delete :void
|
62
62
|
post :unvoid
|
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.21.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: 2025-02-
|
11
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- app/models/effective/deluxe_api.rb
|
255
255
|
- app/models/effective/item_name.rb
|
256
256
|
- app/models/effective/order.rb
|
257
|
+
- app/models/effective/order_email.rb
|
257
258
|
- app/models/effective/order_item.rb
|
258
259
|
- app/models/effective/product.rb
|
259
260
|
- app/models/effective/sold_out_validator.rb
|
@@ -283,6 +284,11 @@ files:
|
|
283
284
|
- app/views/effective/customers/_form.html.haml
|
284
285
|
- app/views/effective/customers/edit.html.haml
|
285
286
|
- app/views/effective/customers/update.js.erb
|
287
|
+
- app/views/effective/order_emails/_header.html.haml
|
288
|
+
- app/views/effective/order_emails/_info.html.haml
|
289
|
+
- app/views/effective/order_emails/_items.html.haml
|
290
|
+
- app/views/effective/order_emails/_order_email.html.haml
|
291
|
+
- app/views/effective/order_emails/_signature.html.haml
|
286
292
|
- app/views/effective/orders/_checkout_actions.html.haml
|
287
293
|
- app/views/effective/orders/_checkout_step1.html.haml
|
288
294
|
- app/views/effective/orders/_checkout_step2.html.haml
|
@@ -333,13 +339,9 @@ files:
|
|
333
339
|
- app/views/effective/orders/show.html.haml
|
334
340
|
- app/views/effective/orders/stripe/_element.html.haml
|
335
341
|
- app/views/effective/orders/stripe/_form.html.haml
|
336
|
-
- app/views/effective/orders_mailer/
|
337
|
-
- app/views/effective/orders_mailer/
|
342
|
+
- app/views/effective/orders_mailer/order_email.html.haml
|
343
|
+
- app/views/effective/orders_mailer/order_email_to_admin.html.haml
|
338
344
|
- app/views/effective/orders_mailer/order_error.html.haml
|
339
|
-
- app/views/effective/orders_mailer/order_receipt_to_admin.html.haml
|
340
|
-
- app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml
|
341
|
-
- app/views/effective/orders_mailer/payment_request_to_buyer.html.haml
|
342
|
-
- app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml
|
343
345
|
- app/views/effective/orders_mailer/refund_notification_to_admin.html.haml
|
344
346
|
- app/views/effective/orders_mailer/subscription_canceled.html.haml
|
345
347
|
- app/views/effective/orders_mailer/subscription_created.html.haml
|
@@ -1,13 +0,0 @@
|
|
1
|
-
%p.effective-orders-receipt-info Request for Payment
|
2
|
-
|
3
|
-
%p
|
4
|
-
An order has been created on your behalf for the following items.
|
5
|
-
Please remit payment at your earliest convenience.
|
6
|
-
|
7
|
-
%p #{link_to('Click here', effective_orders.order_url(@order))} to review your order and pay online with a credit card.
|
8
|
-
|
9
|
-
- if EffectiveOrders.deferred_providers.present?
|
10
|
-
- providers = EffectiveOrders.deferred_providers.to_sentence()
|
11
|
-
%p We also accept #{providers}. We will mark your order paid upon receiving it.
|
12
|
-
|
13
|
-
= render(@order, no_order_actions: true)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
%p.effective-orders-receipt-info Pending order created
|
2
|
-
|
3
|
-
%p We have received notice of your intention to purchase the following items.
|
4
|
-
|
5
|
-
- if @order.delayed?
|
6
|
-
%p{style: "margin-bottom: 4px; font-weight: bold;"} Please note:
|
7
|
-
%ul{style: "margin-top: 0;"}
|
8
|
-
%li Your credit card will be charged on <strong>#{@order.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
|
9
|
-
%li Changes and cancellations must be made before this date.
|
10
|
-
%li A receipt will be sent after the transaction is completed.
|
11
|
-
|
12
|
-
- elsif @order.deferred?
|
13
|
-
%p Please remit payment at your earliest convenience.
|
14
|
-
|
15
|
-
- if EffectiveOrders.deferred_providers.present?
|
16
|
-
- providers = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', or', two_words_connector: ' or ')
|
17
|
-
%p When we receive your #{providers} we will mark your order paid.
|
18
|
-
|
19
|
-
= render(@order, no_order_actions: true)
|
20
|
-
|
21
|
-
%hr
|
22
|
-
%p{style: "text-align: center;"}
|
23
|
-
= link_to('View your order', effective_orders.order_url(@order))
|