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: 07ed479ba56ebd55dae9b20168feec83435c0264cf7b00738a4438aa5104024e
4
- data.tar.gz: 5756b29a14db32c53571fe75991285ed9864864e9a245b2b051886a68ed19229
3
+ metadata.gz: '0619b2dc6fc02860fcf6100f107133d2bb47133cb43eb03e60905a1932acca06'
4
+ data.tar.gz: a2cb49a3e9fba575b7f95941b64f58b02bd81e4030b4ddb14130ea2fb3f041f3
5
5
  SHA512:
6
- metadata.gz: 8de08c2426a57c57176a585131e211242fad9cb9f3bb18bac6216375798388e951021f6a58354be3c0810c3fa59b9d4b8f4505aae9f24b6377b34c0db8793a3d
7
- data.tar.gz: 9a9bba6683d48272c12f4e509617afa99f1721bc53bd448e3689b07782d9b6e8a31cf28b29a031bf0be00ce621f0405eef56d2ca06c1323ec4f306d8a3852c53
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 Exception.new('cannot change state of purchased order') unless purchased?
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.6.2'.freeze
2
+ VERSION = '4.6.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.2
4
+ version: 4.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect