effective_orders 6.21.3 → 6.21.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 342b57d2357589ac84b7b8864e75a4948d662bbcf899cafb9dcd1134c16d4a16
4
- data.tar.gz: e1b3942a707ac68de5e7c883b3ee178621146ae9faf9825f0774e75c8351c547
3
+ metadata.gz: 39ce34f3c38a2b137ae5d6277b766bab2215e1ef14271dc9ae26ced61897216a
4
+ data.tar.gz: b27f892799caee6f152f14f6dc3757ca910a1db2568b146736c3aa877c226f15
5
5
  SHA512:
6
- metadata.gz: 432194cc453ba1b16415e4efa6c68560ee075440acaa010c53c407dd4716a1e7cab7943fb0b9267e24dd950f0f40bf86788943aa6b26f34dd291ae6cc3dbe154
7
- data.tar.gz: d0009c4d688f25c982557dd58e6c750c585745c9ece99e176a4a108ac4bb24b844a7bfa01d7538bcd2bca792bcdd56ca4f0d45807f0049d45e07cc70562b9a3a
6
+ metadata.gz: 496a570f6ce2aa2fa1182c5b341761abb9183ea2da79e6d1e465b8c81bab11590edb529c385c825407258827ab703dfaba7c63da6d8680ccd6e607b2550bff90
7
+ data.tar.gz: c26a9381da40a34dcfc49dd08c933dc86caf75bc29a80876905081806e04df5ea31b7af64abb9c74aa446cefe1adbf328817b91c4c17f2d458aa5d89a24b6c93
@@ -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 && EffectiveOrders.send_order_receipt_to_buyer
24
+ if email && EffectiveOrders.send_order_receipt_to_buyer && !@order.skip_order_emails?
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."
@@ -612,7 +612,6 @@ module Effective
612
612
  present_order_items.map { |oi| oi.quantity }.sum
613
613
  end
614
614
 
615
-
616
615
  def skip_buyer_validations?
617
616
  EffectiveResources.truthy?(skip_buyer_validations)
618
617
  end
@@ -628,7 +627,9 @@ module Effective
628
627
  self.addresses.clear if addresses.any? { |address| address.valid? == false }
629
628
  save!
630
629
 
631
- after_commit { send_payment_request_to_buyer! } if send_payment_request_to_buyer?
630
+ if send_payment_request_to_buyer?
631
+ after_commit { send_payment_request_to_buyer! }
632
+ end
632
633
 
633
634
  true
634
635
  end
@@ -877,8 +878,16 @@ module Effective
877
878
  (emails + [cc.presence]).compact.uniq.to_sentence
878
879
  end
879
880
 
881
+ def skip_order_emails?
882
+ return true if purchased? && free? && !EffectiveOrders.send_order_receipts_when_free
883
+ return true if purchased? && free? && OrderEmail.new(self).event_all_waitlisted?
884
+ false
885
+ end
886
+
880
887
  def send_order_emails!
881
- if purchased_or_deferred? && (!free? || EffectiveOrders.send_order_receipts_when_free)
888
+ return false if skip_order_emails?
889
+
890
+ if purchased_or_deferred?
882
891
  EffectiveOrders.send_email(:order_email, self) if EffectiveOrders.send_order_receipt_to_buyer
883
892
  EffectiveOrders.send_email(:order_email_to_admin, self) if EffectiveOrders.send_order_receipt_to_admin
884
893
  end
@@ -43,6 +43,7 @@ module Effective
43
43
 
44
44
  def subject
45
45
  if event.present? && order.purchased_or_deferred?
46
+ return "Receipt - Order ##{order.to_param}" if order.purchased? && order.delayed_payment_date_past?
46
47
  return "Confirmation - #{event}" if event_none_waitlisted?
47
48
  return "Confirmation & Waitlist - #{event}" if event_some_waitlisted?
48
49
  return "Waitlist - #{event}" if event_all_waitlisted?
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.21.3'.freeze
2
+ VERSION = '6.21.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.21.3
4
+ version: 6.21.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect