effective_orders 6.18.1 → 6.18.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/order.rb +19 -4
- data/app/views/effective/orders/_checkout_step2.html.haml +6 -2
- data/app/views/effective/orders/_order_deferred.html.haml +1 -1
- data/app/views/effective/orders/delayed/_form.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: db369e138fd81a06777542fe77c48ac02e78afce689814c6e077e2d5dca7eb70
|
4
|
+
data.tar.gz: 3bf2190e5199a568bba9dd26900193f589cc5260ebf4a042192f72e0154b340d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c3b27cecbb229a85f3dd4bb68e78869ac4fd7a9d25973fad201660efd9ce7af79b834c9ca4c19011a9c379ea4abcb01ceb84721f777ff4fb65ff3d8cbdf305
|
7
|
+
data.tar.gz: 470be08bf37435f36f12e31c7118f70545821f1a52357a9c7cc5e51143a50a73cff32b18497cbedb122d63fca021cabb1f2acfa27c62235c05f787ce8e8dcd5a
|
@@ -154,12 +154,13 @@ module Effective
|
|
154
154
|
scope :pending_refunds, -> { not_purchased.where('total < ?', 0) }
|
155
155
|
|
156
156
|
scope :delayed, -> { where(delayed_payment: true).where.not(delayed_payment_date: nil) }
|
157
|
+
scope :delayed_payment_provider, -> { where(payment_provider: EffectiveOrders.delayed_providers) }
|
157
158
|
scope :delayed_payment_date_past, -> { delayed.where(arel_table[:delayed_payment_date].lteq(Time.zone.today)) }
|
158
159
|
scope :delayed_payment_date_upcoming, -> { delayed.where(arel_table[:delayed_payment_date].gt(Time.zone.today)) }
|
159
160
|
|
160
161
|
# Used by the rake effective_orders:purchase_delayed_orders task
|
161
162
|
scope :delayed_ready_to_purchase, -> {
|
162
|
-
delayed.deferred.delayed_payment_date_past.where(delayed_payment_purchase_ran_at: nil)
|
163
|
+
delayed.deferred.delayed_payment_provider.delayed_payment_date_past.where(delayed_payment_purchase_ran_at: nil)
|
163
164
|
}
|
164
165
|
|
165
166
|
# effective_reports
|
@@ -196,7 +197,8 @@ module Effective
|
|
196
197
|
validates :delayed_payment_date, presence: true, if: -> { delayed_payment? }
|
197
198
|
validates :delayed_payment_date, absence: true, unless: -> { delayed_payment? }
|
198
199
|
|
199
|
-
|
200
|
+
# deluxe_delayed
|
201
|
+
with_options(if: -> { delayed? && deferred? && delayed_payment_provider? }) do
|
200
202
|
validates :delayed_payment_intent, presence: { message: 'please provide your card information' }
|
201
203
|
validates :delayed_payment_total, presence: true
|
202
204
|
end
|
@@ -248,7 +250,7 @@ module Effective
|
|
248
250
|
validates :payment_provider, presence: true
|
249
251
|
|
250
252
|
validate do
|
251
|
-
unless
|
253
|
+
unless deferred_payment_provider? || delayed_payment_provider?
|
252
254
|
errors.add(:payment_provider, "unknown deferred payment provider")
|
253
255
|
end
|
254
256
|
end
|
@@ -475,6 +477,10 @@ module Effective
|
|
475
477
|
false
|
476
478
|
end
|
477
479
|
|
480
|
+
def purchased_or_deferred?
|
481
|
+
purchased? || deferred?
|
482
|
+
end
|
483
|
+
|
478
484
|
def purchased_with_credit_card?
|
479
485
|
purchased? && EffectiveOrders.credit_card_payment_providers.include?(payment_provider)
|
480
486
|
end
|
@@ -542,6 +548,14 @@ module Effective
|
|
542
548
|
def refund?
|
543
549
|
total.to_i < 0
|
544
550
|
end
|
551
|
+
|
552
|
+
def delayed_payment_provider?
|
553
|
+
payment_provider.present? && EffectiveOrders.delayed_providers.include?(payment_provider)
|
554
|
+
end
|
555
|
+
|
556
|
+
def deferred_payment_provider?
|
557
|
+
payment_provider.present? && EffectiveOrders.deferred_providers.include?(payment_provider)
|
558
|
+
end
|
545
559
|
|
546
560
|
# A new order is created.
|
547
561
|
# If the delayed_payment and delayed_payment date are set, it's a delayed order
|
@@ -554,6 +568,7 @@ module Effective
|
|
554
568
|
def delayed_ready_to_purchase?
|
555
569
|
return false unless delayed?
|
556
570
|
return false unless deferred?
|
571
|
+
return false unless delayed_payment_provider?
|
557
572
|
return false unless delayed_payment_intent.present?
|
558
573
|
return false if delayed_payment_date_upcoming?
|
559
574
|
return false if delayed_payment_purchase_ran_at.present? # We ran before and probably failed
|
@@ -562,7 +577,7 @@ module Effective
|
|
562
577
|
end
|
563
578
|
|
564
579
|
def delayed_payment_info
|
565
|
-
return unless delayed? && deferred?
|
580
|
+
return unless delayed? && deferred? && delayed_payment_provider?
|
566
581
|
return unless delayed_payment_date_upcoming?
|
567
582
|
|
568
583
|
"Your #{delayed_payment_method} will be charged $#{'%0.2f' % total_to_f} on #{delayed_payment_date.strftime('%F')}"
|
@@ -12,6 +12,10 @@
|
|
12
12
|
- if EffectiveOrders.delayed? && order.delayed_payment_date_upcoming?
|
13
13
|
= render partial: '/effective/orders/delayed/form', locals: provider_locals
|
14
14
|
|
15
|
+
- if EffectiveOrders.deferred? && !controller_path.include?('admin/') && !local_assigns[:skip_deferred]
|
16
|
+
%p.my-4.text-center - or -
|
17
|
+
= render partial: '/effective/orders/deferred/form', locals: provider_locals
|
18
|
+
|
15
19
|
- elsif EffectiveOrders.free? && order.free?
|
16
20
|
= render partial: '/effective/orders/free/form', locals: provider_locals
|
17
21
|
|
@@ -41,8 +45,8 @@
|
|
41
45
|
%p.my-4.text-center - or -
|
42
46
|
= render partial: '/effective/orders/deferred/form', locals: provider_locals
|
43
47
|
|
44
|
-
- if EffectiveResources.authorized?(controller, :admin, :effective_orders) && controller_path.include?('admin/')
|
45
|
-
- if EffectiveOrders.delayed? && order.delayed? && order.deferred?
|
48
|
+
- if EffectiveResources.authorized?(controller, :admin, :effective_orders) && controller_path.include?('admin/')
|
49
|
+
- if EffectiveOrders.delayed? && order.delayed? && order.deferred? && order.delayed_payment_provider?
|
46
50
|
.effective-order-admin-purchase-actions
|
47
51
|
= render partial: '/effective/orders/delayed/form_purchase', locals: provider_locals
|
48
52
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
%tbody
|
8
8
|
%tr
|
9
9
|
%td
|
10
|
-
- if order.delayed?
|
10
|
+
- if order.delayed? && order.delayed_payment_provider?
|
11
11
|
%p Your #{order.delayed_payment_method} will be charged on #{order.delayed_payment_date.strftime('%F')}
|
12
12
|
- else
|
13
13
|
%p Waiting for payment by #{order.payment_provider}.
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
- provider_locals = { order: order, deferred_url: deferred_url, declined_url: declined_url }
|
19
19
|
|
20
|
-
- if order.deferred? && order.delayed?
|
20
|
+
- if order.deferred? && order.delayed? && order.delayed_payment_provider?
|
21
21
|
%p Your existing #{order.delayed_payment_method} will be charged on the payment date.
|
22
22
|
|
23
23
|
= collapse('Change my card info') do
|
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.18.
|
4
|
+
version: 6.18.3
|
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:
|
11
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|