effective_orders 5.1.8 → 5.1.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aebed7dcf8c4b8c6e754b4425d407020ab7e3078baa82e0e5ddb10d748041d74
|
4
|
+
data.tar.gz: a834e0574e803ad7af2e568395814a3fc7e2b129953dcc37e52bea17bae1a963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4162e7ec6328b52f4dc36b3a79199966980948cc8dbb9612a460105e4f9682c70586424be157baf897b07f501bff158499e80f3c77ea7f229b3351fa9bc9d61
|
7
|
+
data.tar.gz: 27eff0b3035f2dbaf1e426aa7337a933b8f90ef44e88da04eac4fab0ba77f3d7d8ea3695b6bd3cf6e7d42f933f5186868076e45fb25c66717b1d8e423401883d
|
@@ -72,7 +72,7 @@ module Effective
|
|
72
72
|
before_validation { assign_user_address }
|
73
73
|
|
74
74
|
before_validation(if: -> { confirmed_checkout }) do
|
75
|
-
|
75
|
+
assign_attributes(state: EffectiveOrders::CONFIRMED) if pending?
|
76
76
|
end
|
77
77
|
|
78
78
|
before_save(if: -> { state_was == EffectiveOrders::PURCHASED }) do
|
@@ -143,6 +143,7 @@ module Effective
|
|
143
143
|
scope :confirmed, -> { where(state: EffectiveOrders::CONFIRMED) }
|
144
144
|
scope :deferred, -> { where(state: EffectiveOrders::DEFERRED) }
|
145
145
|
scope :declined, -> { where(state: EffectiveOrders::DECLINED) }
|
146
|
+
scope :abandoned, -> { where(state: EffectiveOrders::ABANDONED) }
|
146
147
|
scope :refunds, -> { purchased.where('total < ?', 0) }
|
147
148
|
|
148
149
|
# Effective::Order.new()
|
@@ -334,6 +335,10 @@ module Effective
|
|
334
335
|
state == EffectiveOrders::DECLINED
|
335
336
|
end
|
336
337
|
|
338
|
+
def abandoned?
|
339
|
+
state == EffectiveOrders::ABANDONED
|
340
|
+
end
|
341
|
+
|
337
342
|
def purchasables
|
338
343
|
order_items.map { |order_item| order_item.purchasable }
|
339
344
|
end
|
@@ -5,7 +5,10 @@
|
|
5
5
|
= order.refund? ? 'Complete Refund' : 'Mark as Paid'
|
6
6
|
|
7
7
|
= effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
|
8
|
-
|
8
|
+
- if order.refund?
|
9
|
+
= f.hidden_field :purchased_at, value: Time.zone.now
|
10
|
+
- else
|
11
|
+
= f.date_field :purchased_at, required: true
|
9
12
|
|
10
13
|
= f.select :payment_provider, EffectiveOrders.payment_providers, required: true
|
11
14
|
|
@@ -23,4 +26,4 @@
|
|
23
26
|
|
24
27
|
= f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
|
25
28
|
|
26
|
-
= f.submit order_checkout_label(order.refund? ? :refund : :mark_as_paid)
|
29
|
+
= f.submit 'Admin: ' + order_checkout_label(order.refund? ? :refund : :mark_as_paid)
|
data/lib/effective_orders.rb
CHANGED
@@ -10,7 +10,16 @@ module EffectiveOrders
|
|
10
10
|
DEFERRED = 'deferred' # Deferred providers. Cheque or Phone was selected.
|
11
11
|
PURCHASED = 'purchased' # Purchased by provider
|
12
12
|
DECLINED = 'declined' # Declined by provider
|
13
|
-
|
13
|
+
ABANDONED = 'abandoned' # Not set by this gem. Can be set outside it.
|
14
|
+
|
15
|
+
STATES = {
|
16
|
+
PENDING => PENDING,
|
17
|
+
CONFIRMED => CONFIRMED,
|
18
|
+
DEFERRED => DEFERRED,
|
19
|
+
PURCHASED => PURCHASED,
|
20
|
+
DECLINED => DECLINED,
|
21
|
+
ABANDONED => ABANDONED
|
22
|
+
}
|
14
23
|
|
15
24
|
# Subscription statuses (as per stripe)
|
16
25
|
ACTIVE = 'active'
|
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: 5.1.
|
4
|
+
version: 5.1.9
|
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: 2021-09-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|