effective_orders 6.12.3 → 6.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_orders_helper.rb +1 -1
- data/app/models/concerns/acts_as_purchasable_parent.rb +12 -1
- data/app/models/effective/order.rb +18 -2
- data/app/views/effective/orders/_order_deferred.html.haml +1 -1
- data/app/views/effective/orders/delayed/_form.html.haml +13 -7
- data/app/views/effective/orders/delayed/_form_purchase.html.haml +1 -1
- 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: 6d365ebd0599f72ed9c5bbf7e9e9f26284647135153befe60799452b87fc1e0c
|
4
|
+
data.tar.gz: 913c9fa4e2d528382652c297d6806fb827c79974baebb9890ddd1854449f98d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5fde239931a219f5e15a29a085dd4f056f12174fb4e6331b5b05369d8798518781e7eddae549edb3d3e8d34a9a8a18896a6a271fa0883a15161f75766cad95b
|
7
|
+
data.tar.gz: 2b0daaa3d6a0b0111efe48cac3db3d2b0073a3a8ed3b51ec5e9beaeaadaee604ae515cdc5c309b33c8a4ad28598bfcbdd3c6f345aa95052543588f31dcc1a6bc
|
@@ -39,8 +39,19 @@ module ActsAsPurchasableParent
|
|
39
39
|
end
|
40
40
|
|
41
41
|
included do
|
42
|
-
has_many :orders, -> { order(:id) }, as: :parent, class_name: 'Effective::Order'
|
42
|
+
has_many :orders, -> { order(:id) }, as: :parent, class_name: 'Effective::Order'
|
43
|
+
|
43
44
|
accepts_nested_attributes_for :orders
|
45
|
+
|
46
|
+
before_destroy do
|
47
|
+
orders.each do |order|
|
48
|
+
raise('unable to destroy a purchasable_parent with purchased orders') if order.purchased?
|
49
|
+
order.voided? ? order.save! : order.void!
|
50
|
+
end
|
51
|
+
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
44
55
|
end
|
45
56
|
|
46
57
|
end
|
@@ -548,13 +548,20 @@ module Effective
|
|
548
548
|
return false unless delayed?
|
549
549
|
return false unless deferred?
|
550
550
|
return false unless delayed_payment_intent.present?
|
551
|
-
return false if
|
551
|
+
return false if delayed_payment_date_upcoming?
|
552
552
|
return false if delayed_payment_purchase_ran_at.present? # We ran before and probably failed
|
553
553
|
|
554
554
|
true
|
555
555
|
end
|
556
556
|
|
557
|
-
def
|
557
|
+
def delayed_payment_info
|
558
|
+
return unless delayed? && deferred?
|
559
|
+
return unless delayed_payment_date_upcoming?
|
560
|
+
|
561
|
+
"Your #{delayed_payment_method} will be charged on #{delayed_payment_date.strftime('%F')} for the full amount of $#{'%0.2f' % total_to_f}"
|
562
|
+
end
|
563
|
+
|
564
|
+
def delayed_payment_date_upcoming?
|
558
565
|
return false unless delayed?
|
559
566
|
delayed_payment_date > Time.zone.now.to_date
|
560
567
|
end
|
@@ -832,6 +839,15 @@ module Effective
|
|
832
839
|
unvoided!(skip_buyer_validations: true)
|
833
840
|
end
|
834
841
|
|
842
|
+
def deluxe_delayed_purchase!
|
843
|
+
raise('expected a delayed order') unless delayed?
|
844
|
+
raise('expected a deferred order') unless deferred?
|
845
|
+
raise('expected delayed payment intent') unless delayed_payment_intent.present?
|
846
|
+
raise('expected a deluxe_delayed payment provider') unless payment_provider == 'deluxe_delayed'
|
847
|
+
|
848
|
+
Effective::DeluxeApi.new().purchase_delayed_orders!(self)
|
849
|
+
end
|
850
|
+
|
835
851
|
# These are all the emails we send all notifications to
|
836
852
|
def emails
|
837
853
|
([purchased_by.try(:email)] + [email] + [user.try(:email)] + Array(organization.try(:billing_emails))).map(&:presence).compact.uniq
|
@@ -8,6 +8,6 @@
|
|
8
8
|
%tr
|
9
9
|
%td
|
10
10
|
- if order.delayed?
|
11
|
-
Your #{order.delayed_payment_method} will be charged on #{order.delayed_payment_date.strftime('%F')}
|
11
|
+
Your #{order.delayed_payment_method} will be charged on #{order.delayed_payment_date.strftime('%F')}
|
12
12
|
- else
|
13
13
|
Waiting for payment by #{order.payment_provider}
|
@@ -8,18 +8,24 @@
|
|
8
8
|
|
9
9
|
The payment date for this order
|
10
10
|
|
11
|
-
- if order.
|
11
|
+
- if order.delayed_payment_date_upcoming?
|
12
12
|
is in #{distance} from now on #{order.delayed_payment_date.strftime('%F')}
|
13
13
|
- elsif order.delayed_payment_date_today?
|
14
14
|
was today
|
15
15
|
- else
|
16
16
|
was #{distance} ago on #{order.delayed_payment_date.strftime('%F')}
|
17
|
+
|
18
|
+
- provider_locals = { order: order, deferred_url: deferred_url, declined_url: declined_url }
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
representing your card information. The full amount will be charged on the payment date.
|
20
|
+
- if order.deferred? && order.delayed?
|
21
|
+
%p Your existing #{order.delayed_payment_method} will be charged on the payment date.
|
21
22
|
|
22
|
-
|
23
|
+
= collapse('Change my card info') do
|
24
|
+
- EffectiveOrders.delayed_providers.each do |provider|
|
25
|
+
= render partial: "/effective/orders/#{provider}/form", locals: provider_locals
|
26
|
+
- else
|
27
|
+
%p
|
28
|
+
Please enter your card information so it can be charged on the payment date.
|
23
29
|
|
24
|
-
|
25
|
-
|
30
|
+
- EffectiveOrders.delayed_providers.each do |provider|
|
31
|
+
= render partial: "/effective/orders/#{provider}/form", locals: provider_locals
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
The payment date for this order
|
15
15
|
|
16
|
-
- if order.
|
16
|
+
- if order.delayed_payment_date_upcoming?
|
17
17
|
is in #{distance} from now on #{order.delayed_payment_date.strftime('%F')}
|
18
18
|
- elsif order.delayed_payment_date_today?
|
19
19
|
was today
|
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.12.
|
4
|
+
version: 6.12.4
|
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: 2024-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|