effective_orders 3.1.3 → 3.2.1

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: 2a44d926ef3b5778ccedeb057cb96ed9d0df5e63642ef26851db9d4df4a4e0f7
4
- data.tar.gz: 222f7df06cf76aa2d39ab3c428744057eed9468f4838c6230612ac6bda81ed55
3
+ metadata.gz: 2452332fcebd03986bf33bd266f0a4f59002fcd24dd9734085cd341e1f32afa6
4
+ data.tar.gz: d11d5da4657bed64443d42a7cb7b6fc3eb79c2eb832d97b84ceb5bc2ffa20c62
5
5
  SHA512:
6
- metadata.gz: 3218139fa9780d82e159d83498e35589fbe99115b59e076b2cc1c27f033a1a6f7e91fbcc4eb9eb4d7161a6a28a1dbac3ecbaf42026f305d08a7aa986ddc95211
7
- data.tar.gz: 0c6b49680dac2b6f4044484f15ed197b32ce145433ff67171331896f0251cba6e4f8b1e2341fa2913a73fb5fd1278d65ee8f7a45ce7bda14dc65a028a6ed7e5d
6
+ metadata.gz: aac4714aaab0a7d4cd86b2b7e3496719a7d63b00844181ee25c25c1c92a2ff5e48f8e37a110d060af48aab3ab782f1bbcb17e42cab451d0204c4182bfca87d5b
7
+ data.tar.gz: 20de7342f472d9b57a983fdc318c6bb90d6740d6d080c896c36928d9255b520e6a87de43d69a3322af83813f0a512c9699735c2411c7df46441b42f93555566f
data/README.md CHANGED
@@ -512,7 +512,7 @@ The `acts_as_purchasable` `.purchased?` and `.purchased_by?(user)` methods only
512
512
  To programatically purchase one or more `acts_as_purchasable` objects:
513
513
 
514
514
  ```ruby
515
- Effective::Order.new(@product1, @product2, user: current_user).purchase!(details: 'from my rake task')
515
+ Effective::Order.new(items: [@product1, @product2], user: current_user).purchase!(details: 'from my rake task')
516
516
  ```
517
517
 
518
518
  Here the `billing_address` and `shipping_address` are copied from the `current_user` object if the `current_user` responds_to `billing_address` / `shipping_address` as per [effective_addresses](https://github.com/code-and-effect/effective_addresses/).
@@ -541,7 +541,7 @@ The one gotcha with the above two scenarios, is that when `purchase!` is called,
541
541
  You can skip validations with the following command, but be careful as this skips all validations:
542
542
 
543
543
  ```ruby
544
- Effective::Order.new(@product, user: @user).purchase!(validate: false)
544
+ Effective::Order.new(item: @product, user: @user).purchase!(validate: false)
545
545
  ```
546
546
 
547
547
  The `@product` is now considered purchased.
@@ -0,0 +1,3 @@
1
+ //= link_directory ../javascripts .js
2
+ //= link_directory ../stylesheets .css
3
+ //= link_directory ../images/effective_orders
@@ -19,12 +19,12 @@ module Effective
19
19
 
20
20
  layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:orders] : EffectiveOrders.layout)
21
21
 
22
- before_action :authenticate_user!, except: [:ccbill_postback, :free, :paypal_postback, :pretend]
22
+ before_action :authenticate_user!, except: [:ccbill_postback, :free, :moneris_postback, :paypal_postback, :pretend]
23
23
  before_action :set_page_title, except: [:show]
24
24
 
25
25
  # This is the entry point for any Checkout button
26
26
  def new
27
- @order ||= Effective::Order.new(current_cart, user: current_user)
27
+ @order ||= Effective::Order.new(item: current_cart, user: current_user)
28
28
 
29
29
  EffectiveOrders.authorize!(self, :new, @order)
30
30
 
@@ -48,7 +48,7 @@ module Effective
48
48
  end
49
49
 
50
50
  def create
51
- @order ||= Effective::Order.new(current_cart, user: current_user)
51
+ @order ||= Effective::Order.new(item: current_cart, user: current_user)
52
52
  EffectiveOrders.authorize!(self, :create, @order)
53
53
 
54
54
  @order.assign_attributes(checkout_params) if params[:effective_order]
@@ -15,6 +15,13 @@ class EffectiveOrdersDatatable < Effective::Datatable
15
15
  )
16
16
  end
17
17
 
18
+ filters do
19
+ if admin_namespace?
20
+ filter :start_date, nil, as: :effective_date_picker
21
+ filter :end_date, nil, as: :effective_date_picker
22
+ end
23
+ end
24
+
18
25
  datatable do
19
26
  order :created_at, :desc
20
27
 
@@ -94,6 +101,14 @@ class EffectiveOrdersDatatable < Effective::Datatable
94
101
  scope = EffectiveOrders.orders_collection_scope.call(scope)
95
102
  end
96
103
 
104
+ if filters[:start_date].present?
105
+ scope = scope.where('created_at > ?', Time.zone.parse(filters[:start_date]).beginning_of_day)
106
+ end
107
+
108
+ if filters[:end_date].present?
109
+ scope = scope.where('created_at < ?', Time.zone.parse(filters[:end_date]).end_of_day)
110
+ end
111
+
97
112
  attributes[:user_id].present? ? scope.where(user_id: attributes[:user_id]) : scope
98
113
  end
99
114
 
@@ -127,7 +127,7 @@ module EffectiveCartsHelper
127
127
  end
128
128
 
129
129
  def render_purchasables(*purchasables)
130
- render(partial: 'effective/orders/order_items', locals: { order: Effective::Order.new(purchasables) })
130
+ render(partial: 'effective/orders/order_items', locals: { order: Effective::Order.new(items: purchasables) })
131
131
  end
132
132
 
133
133
  end
@@ -104,7 +104,8 @@ module Effective
104
104
  def order_id
105
105
  [
106
106
  order.to_param,
107
- (order.billing_name.to_s.parameterize.presence if EffectiveOrders.moneris[:include_billing_name_in_order_id])
107
+ (order.billing_name.to_s.parameterize.presence if EffectiveOrders.moneris[:include_billing_name_in_order_id]),
108
+ Time.zone.now.to_i
108
109
  ].compact.join('-')
109
110
  end
110
111
 
@@ -2,7 +2,7 @@ module EffectiveOrders
2
2
  class Engine < ::Rails::Engine
3
3
  engine_name 'effective_orders'
4
4
 
5
- config.autoload_paths += Dir["#{config.root}/app/models/**/"]
5
+ #config.autoload_paths += Dir["#{config.root}/app/models/**/"]
6
6
 
7
7
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
8
8
  initializer 'effective_orders.active_record' do |app|
@@ -18,6 +18,10 @@ module EffectiveOrders
18
18
  eval File.read("#{config.root}/config/effective_orders.rb")
19
19
  end
20
20
 
21
+ initializer 'effective_orders.assets' do |app|
22
+ app.config.assets.precompile += ['effective_orders_manifest.js', 'effective_orders/*']
23
+ end
24
+
21
25
  # Set up mail delivering config option
22
26
  initializer 'effective_orders.mailer', after: :load_config_initializers do |app|
23
27
  deliver_method = Rails.gem_version >= Gem::Version.new('4.2') ? :deliver_now : :deliver
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '3.1.3'.freeze
2
+ VERSION = '3.2.1'.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: 3.1.3
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -119,6 +119,7 @@ files:
119
119
  - MIT-LICENSE
120
120
  - README.md
121
121
  - Rakefile
122
+ - app/assets/config/effective_orders_manifest.js
122
123
  - app/assets/images/effective_orders/stripe_connect.png
123
124
  - app/assets/javascripts/effective_orders.js
124
125
  - app/assets/javascripts/effective_orders/customers.js.coffee
@@ -169,10 +170,10 @@ files:
169
170
  - app/models/effective/providers/ccbill_postback.rb
170
171
  - app/models/effective/providers/moneris_charge.rb
171
172
  - app/models/effective/providers/stripe_charge.rb
173
+ - app/models/effective/sold_out_validator.rb
172
174
  - app/models/effective/subscripter.rb
173
175
  - app/models/effective/subscription.rb
174
176
  - app/models/effective/tax_rate_calculator.rb
175
- - app/models/validators/effective/sold_out_validator.rb
176
177
  - app/views/admin/customers/_actions.html.haml
177
178
  - app/views/admin/customers/index.html.haml
178
179
  - app/views/admin/customers/show.html.haml
@@ -255,7 +256,7 @@ homepage: https://github.com/code-and-effect/effective_orders
255
256
  licenses:
256
257
  - MIT
257
258
  metadata: {}
258
- post_install_message:
259
+ post_install_message:
259
260
  rdoc_options: []
260
261
  require_paths:
261
262
  - lib
@@ -270,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
271
  - !ruby/object:Gem::Version
271
272
  version: '0'
272
273
  requirements: []
273
- rubygems_version: 3.0.3
274
- signing_key:
274
+ rubygems_version: 3.1.2
275
+ signing_key:
275
276
  specification_version: 4
276
277
  summary: Quickly build an online store with carts, orders, automatic email receipts
277
278
  and payment collection via Stripe, StripeConnect, PayPal and Moneris.