effective_orders 4.6.2 → 4.6.3
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: '0619b2dc6fc02860fcf6100f107133d2bb47133cb43eb03e60905a1932acca06'
|
4
|
+
data.tar.gz: a2cb49a3e9fba575b7f95941b64f58b02bd81e4030b4ddb14130ea2fb3f041f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b39ed3047b11b55ddb153a4465c3c31e11304cef618eb70ed1eb237f522e1ddd7267cd1507b7a2c25ee737dc3f31654940c676a9ef4419565f7b776f4a5622c
|
7
|
+
data.tar.gz: 36a94c2eb539e2beb23996fb97d14b2befe62ae9154cd1cd578cac1bf9f886f0a9c3eca05f453b92d4bd4fdf6c17f84c621cce270732e70360cb272ee1db6ddd
|
@@ -64,13 +64,13 @@ module Effective
|
|
64
64
|
|
65
65
|
# Always step1
|
66
66
|
def edit
|
67
|
-
@order ||= Effective::Order.find(params[:id])
|
67
|
+
@order ||= Effective::Order.not_purchased.find(params[:id])
|
68
68
|
EffectiveOrders.authorize!(self, :edit, @order)
|
69
69
|
end
|
70
70
|
|
71
71
|
# Confirms the order from existing order
|
72
72
|
def update
|
73
|
-
@order ||= Effective::Order.find(params[:id])
|
73
|
+
@order ||= Effective::Order.not_purchased.find(params[:id])
|
74
74
|
EffectiveOrders.authorize!(self, :update, @order)
|
75
75
|
|
76
76
|
@order.assign_attributes(checkout_params)
|
@@ -106,7 +106,7 @@ module Effective
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def send_buyer_receipt
|
109
|
-
@order = Effective::Order.find(params[:id])
|
109
|
+
@order = Effective::Order.purchased.find(params[:id])
|
110
110
|
EffectiveOrders.authorize!(self, :show, @order)
|
111
111
|
|
112
112
|
if @order.send_order_receipt_to_buyer!
|
@@ -73,7 +73,7 @@ module Effective
|
|
73
73
|
end
|
74
74
|
|
75
75
|
before_save(if: -> { state_was == EffectiveOrders::PURCHASED }) do
|
76
|
-
raise
|
76
|
+
raise EffectiveOrders::AlreadyPurchasedException.new('cannot unpurchase an order') unless purchased?
|
77
77
|
end
|
78
78
|
|
79
79
|
# Order validations
|
@@ -330,6 +330,8 @@ module Effective
|
|
330
330
|
# It skips any address or bad user validations
|
331
331
|
# It's basically the same as save! on a new order, except it might send the payment request to buyer
|
332
332
|
def pending!
|
333
|
+
return false if purchased?
|
334
|
+
|
333
335
|
self.state = EffectiveOrders::PENDING
|
334
336
|
self.addresses.clear if addresses.any? { |address| address.valid? == false }
|
335
337
|
save!
|
@@ -340,6 +342,7 @@ module Effective
|
|
340
342
|
|
341
343
|
# Used by admin checkout only
|
342
344
|
def confirm!
|
345
|
+
return false if purchased?
|
343
346
|
update!(state: EffectiveOrders::CONFIRMED)
|
344
347
|
end
|
345
348
|
|