effective_orders 6.7.2 → 6.8.0

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: cf1784e619c52695ef3be94dfd8ed164c5c6b0f81e2a853239ba5963e916ee14
4
- data.tar.gz: ef0eeb3c19bd456a8d806dfb0ea2963b06b0a2786ce2e7d0f0071c261ed61162
3
+ metadata.gz: f83eb44947b1c5f4f906f04822df9860f892727a02146f33e03eb468ffe65ea6
4
+ data.tar.gz: 726acb095ff327c25c438eacaec1db6cfa551207582a4d82a7a677e809b5087f
5
5
  SHA512:
6
- metadata.gz: dba9ec63003ed63c5b40ea9aae431c42ea55d11eb496acfe9154e07e5ecdc5ab41f7b37be0b6ab1d65747bc7515b77fc342cb841491c714aab238d7c5d0f182b
7
- data.tar.gz: 5b809f63ee1cb262688f69f274b79519711b7a8fc5eec2028fdc76aa1fcb579bd78bd6aac681227947e86ea43737f54693889aac79d82237a145ab4ed32316d7
6
+ metadata.gz: 0cc47f00733d0927470036ec6d9d2ef434945204426692ac26858e64a88d0b38e3a57396f64d2c1980152a8924d174cbd014dde7cc4245c2e8bcdf1922f7eb22
7
+ data.tar.gz: 3e6d4ee0aa861c39ec8f11e55879201908b3c6c62910e47631e69ab8662966eaef265e51906a8a954a806a7cec9020c13c6eb1123b26c11669d3c44137172cfc
@@ -53,7 +53,7 @@ form.new_effective_order {
53
53
  }
54
54
 
55
55
  .effective-moneris-checkout {
56
- height: 560px;
56
+ height: 720px;
57
57
  }
58
58
 
59
59
  @media print {
@@ -1,6 +1,6 @@
1
1
  module Effective
2
2
  class Cart < ActiveRecord::Base
3
- self.table_name = EffectiveOrders.carts_table_name.to_s
3
+ self.table_name = (EffectiveOrders.carts_table_name || :carts).to_s
4
4
 
5
5
  belongs_to :user, polymorphic: true, optional: true # Optional. We want non-logged-in users to have carts too.
6
6
 
@@ -1,6 +1,6 @@
1
1
  module Effective
2
2
  class CartItem < ActiveRecord::Base
3
- self.table_name = EffectiveOrders.cart_items_table_name.to_s
3
+ self.table_name = (EffectiveOrders.cart_items_table_name || :cart_items).to_s
4
4
 
5
5
  belongs_to :cart, counter_cache: true
6
6
  belongs_to :purchasable, polymorphic: true
@@ -1,6 +1,6 @@
1
1
  module Effective
2
2
  class Customer < ActiveRecord::Base
3
- self.table_name = EffectiveOrders.customers_table_name.to_s
3
+ self.table_name = (EffectiveOrders.customers_table_name || :customers).to_s
4
4
 
5
5
  attr_accessor :stripe_customer
6
6
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  module Effective
11
11
  class Order < ActiveRecord::Base
12
- self.table_name = EffectiveOrders.orders_table_name.to_s
12
+ self.table_name = (EffectiveOrders.orders_table_name || :orders).to_s
13
13
 
14
14
  # Effective Resources
15
15
  acts_as_statused(
@@ -201,13 +201,13 @@ module Effective
201
201
  end
202
202
  end
203
203
 
204
- validate(if: -> { was_voided? }) do
205
- errors.add(:status, "cannot update a voided order") unless (voided? || pending?)
204
+ validate(if: -> { was_voided? && status_changed? }) do
205
+ errors.add(:status, "cannot update status of a voided order") unless voided?
206
206
  end
207
207
 
208
208
  # Sanity check
209
209
  before_save(if: -> { status_was.to_s == 'purchased' }) do
210
- raise('cannot unpurchase an order') unless purchased?
210
+ raise('cannot unpurchase an order. try voiding instead.') unless purchased? || voided?
211
211
 
212
212
  raise('cannot change subtotal of a purchased order') if changes[:subtotal].present?
213
213
 
@@ -722,13 +722,13 @@ module Effective
722
722
  end
723
723
 
724
724
  def void!
725
- raise('unable to void a purchased order') if purchased?
726
- voided!
725
+ raise('already voided') if voided?
726
+ voided!(skip_buyer_validations: true)
727
727
  end
728
728
 
729
729
  def unvoid!
730
730
  raise('order must be voided to unvoid') unless voided?
731
- pending!
731
+ unvoided!(skip_buyer_validations: true)
732
732
  end
733
733
 
734
734
  # These are all the emails we send all notifications to
@@ -3,7 +3,7 @@
3
3
  module Effective
4
4
  # An Order Item
5
5
  class OrderItem < ActiveRecord::Base
6
- self.table_name = EffectiveOrders.order_items_table_name.to_s
6
+ self.table_name = (EffectiveOrders.order_items_table_name || :order_items).to_s
7
7
 
8
8
  belongs_to :order
9
9
 
@@ -1,6 +1,6 @@
1
1
  module Effective
2
2
  class Product < ActiveRecord::Base
3
- self.table_name = EffectiveOrders.products_table_name.to_s
3
+ self.table_name = (EffectiveOrders.products_table_name || :products).to_s
4
4
 
5
5
  acts_as_purchasable
6
6
  log_changes if respond_to?(:log_changes)
@@ -1,6 +1,6 @@
1
1
  module Effective
2
2
  class Subscription < ActiveRecord::Base
3
- self.table_name = EffectiveOrders.subscriptions_table_name.to_s
3
+ self.table_name = (EffectiveOrders.subscriptions_table_name || :subscriptions).to_s
4
4
 
5
5
  attr_accessor :stripe_subscription
6
6
 
@@ -1,15 +1,6 @@
1
1
  # EffectiveOrders Rails Engine
2
2
 
3
3
  EffectiveOrders.setup do |config|
4
- # Configure Database Tables
5
- config.orders_table_name = :orders
6
- config.order_items_table_name = :order_items
7
- config.carts_table_name = :carts
8
- config.cart_items_table_name = :cart_items
9
- config.customers_table_name = :customers
10
- config.subscriptions_table_name = :subscriptions
11
- config.products_table_name = :products
12
-
13
4
  # Layout Settings
14
5
  # config.layout = { application: 'application', admin: 'admin' }
15
6
 
data/config/routes.rb CHANGED
@@ -51,7 +51,7 @@ EffectiveOrders::Engine.routes.draw do
51
51
  post :send_payment_request
52
52
  post :send_buyer_receipt
53
53
 
54
- post :void
54
+ delete :void
55
55
  post :unvoid
56
56
 
57
57
  # GET should be last here
@@ -1,6 +1,6 @@
1
- class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
2
- def self.up
3
- create_table <%= @orders_table_name %> do |t|
1
+ class CreateEffectiveOrders < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :orders do |t|
4
4
  t.integer :user_id
5
5
  t.string :user_type
6
6
 
@@ -43,10 +43,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
43
43
  t.timestamps
44
44
  end
45
45
 
46
- add_index <%= @orders_table_name %>, :user_id
46
+ add_index :orders, :user_id
47
47
 
48
-
49
- create_table <%= @order_items_table_name %> do |t|
48
+ create_table :order_items do |t|
50
49
  t.integer :order_id
51
50
  t.string :purchasable_type
52
51
  t.integer :purchasable_id
@@ -59,12 +58,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
59
58
  t.timestamps
60
59
  end
61
60
 
62
- add_index <%= @order_items_table_name %>, :order_id
63
- add_index <%= @order_items_table_name %>, :purchasable_id
64
- add_index <%= @order_items_table_name %>, [:purchasable_type, :purchasable_id]
65
-
61
+ add_index :order_items, :order_id
62
+ add_index :order_items, :purchasable_id
63
+ add_index :order_items, [:purchasable_type, :purchasable_id]
66
64
 
67
- create_table <%= @carts_table_name %> do |t|
65
+ create_table :carts do |t|
68
66
  t.integer :user_id
69
67
  t.string :user_type
70
68
 
@@ -72,9 +70,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
72
70
  t.timestamps
73
71
  end
74
72
 
75
- add_index <%= @carts_table_name %>, :user_id
73
+ add_index :carts, :user_id
76
74
 
77
- create_table <%= @cart_items_table_name %> do |t|
75
+ create_table :cart_items do |t|
78
76
  t.integer :cart_id
79
77
  t.string :purchasable_type
80
78
  t.integer :purchasable_id
@@ -85,11 +83,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
85
83
  t.timestamps
86
84
  end
87
85
 
88
- add_index <%= @cart_items_table_name %>, :cart_id
89
- add_index <%= @cart_items_table_name %>, :purchasable_id
90
- add_index <%= @cart_items_table_name %>, [:purchasable_type, :purchasable_id]
86
+ add_index :cart_items, :cart_id
87
+ add_index :cart_items, :purchasable_id
88
+ add_index :cart_items, [:purchasable_type, :purchasable_id]
91
89
 
92
- create_table <%= @customers_table_name %> do |t|
90
+ create_table :customers do |t|
93
91
  t.integer :user_id
94
92
  t.string :user_type
95
93
 
@@ -103,9 +101,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
103
101
  t.timestamps
104
102
  end
105
103
 
106
- add_index <%= @customers_table_name %>, :user_id
104
+ add_index :customers, :user_id
107
105
 
108
- create_table <%= @subscriptions_table_name %> do |t|
106
+ create_table :subscriptions do |t|
109
107
  t.integer :customer_id
110
108
 
111
109
  t.integer :subscribable_id
@@ -123,11 +121,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
123
121
  t.timestamps
124
122
  end
125
123
 
126
- add_index <%= @subscriptions_table_name %>, :customer_id
127
- add_index <%= @subscriptions_table_name %>, :subscribable_id
128
- add_index <%= @subscriptions_table_name %>, [:subscribable_type, :subscribable_id]
124
+ add_index :subscriptions, :customer_id
125
+ add_index :subscriptions, :subscribable_id
126
+ add_index :subscriptions, [:subscribable_type, :subscribable_id]
129
127
 
130
- create_table <%= @products_table_name %> do |t|
128
+ create_table :products do |t|
131
129
  t.integer :purchased_order_id
132
130
 
133
131
  t.string :name
@@ -140,14 +138,4 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
140
138
  end
141
139
 
142
140
  end
143
-
144
- def self.down
145
- drop_table <%= @orders_table_name %>
146
- drop_table <%= @order_items_table_name %>
147
- drop_table <%= @carts_table_name %>
148
- drop_table <%= @cart_items_table_name %>
149
- drop_table <%= @customers_table_name %>
150
- drop_table <%= @subscriptions_table_name %>
151
- drop_table <%= @products_table_name %>
152
- end
153
141
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.7.2'.freeze
2
+ VERSION = '6.8.0'.freeze
3
3
  end
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.7.2
4
+ version: 6.8.0
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: 2023-08-14 00:00:00.000000000 Z
11
+ date: 2023-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -328,7 +328,7 @@ files:
328
328
  - config/effective_orders.rb
329
329
  - config/locales/effective_orders.en.yml
330
330
  - config/routes.rb
331
- - db/migrate/01_create_effective_orders.rb.erb
331
+ - db/migrate/101_create_effective_orders.rb
332
332
  - lib/effective_orders.rb
333
333
  - lib/effective_orders/engine.rb
334
334
  - lib/effective_orders/version.rb