effective_orders 5.1.7 → 5.1.11
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 +6 -1
- data/app/views/admin/orders/_datatable_actions.html.haml +1 -1
- data/app/views/effective/orders/_order_actions.html.haml +1 -1
- data/app/views/effective/orders/_order_notes.html.haml +2 -2
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +8 -3
- data/config/routes.rb +1 -1
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.rb +10 -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: d4ceb232058ad48722e375f9ada63ee99219ca2c6e4171ebc4be851dc5218518
|
4
|
+
data.tar.gz: a7ec1aabca5e20e22d834a6d9bca6a3efc277f2b2aabc03f888d274145fbaa80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d04a7b6902627945ecfae1c56b2133a3dba96b586a6f8eea8b61327de03c84c6e6cddbd374eff1b21d0030625014c5ab0471fb96ea7a37058373853d5be189c4
|
7
|
+
data.tar.gz: 95d763d0f61864d12fc6fde4a27f884af573ac218ea0f4947f7c00e8410308c6fd42d996519eb4b5872d19d79c67ca6ce68c5be1316468be451cf96a5f721213
|
@@ -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
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
- if order.purchased?
|
8
8
|
= dropdown_link_to 'Email receipt to buyer', effective_orders.send_buyer_receipt_order_path(order),
|
9
|
-
data: { confirm: "Send receipt to #{order.emails_send_to}?" }
|
9
|
+
data: { method: :post, confirm: "Send receipt to #{order.emails_send_to}?" }
|
10
10
|
|
11
11
|
- if order.pending? || order.confirmed? || order.deferred?
|
12
12
|
= dropdown_link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
|
@@ -5,7 +5,7 @@
|
|
5
5
|
- if order.purchased?
|
6
6
|
= link_to 'E-mail Receipt', effective_orders.send_buyer_receipt_order_path(order),
|
7
7
|
class: 'btn btn-secondary',
|
8
|
-
data: { confirm: "Send receipt to #{order.emails_send_to}?" }
|
8
|
+
data: { method: :post, confirm: "Send receipt to #{order.emails_send_to}?" }
|
9
9
|
|
10
10
|
- if order.persisted? && EffectiveResources.authorized?(controller, :admin, :effective_orders)
|
11
11
|
- if order.pending? || order.confirmed? || order.deferred?
|
@@ -1,9 +1,14 @@
|
|
1
1
|
.card
|
2
2
|
.card-body
|
3
|
-
%h2
|
3
|
+
%h2
|
4
|
+
Admin:
|
5
|
+
= order.refund? ? 'Complete Refund' : 'Mark as Paid'
|
4
6
|
|
5
7
|
= effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
|
6
|
-
|
8
|
+
- if order.refund?
|
9
|
+
= f.hidden_field :purchased_at, value: Time.zone.now
|
10
|
+
- else
|
11
|
+
= f.date_field :purchased_at, required: true
|
7
12
|
|
8
13
|
= f.select :payment_provider, EffectiveOrders.payment_providers, required: true
|
9
14
|
|
@@ -21,4 +26,4 @@
|
|
21
26
|
|
22
27
|
= f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
|
23
28
|
|
24
|
-
= f.submit order_checkout_label(:
|
29
|
+
= f.submit 'Admin: ' + order_checkout_label(order.refund? ? :refund : :mark_as_paid)
|
data/config/routes.rb
CHANGED
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.11
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|