spree_core 0.50.0 → 0.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,15 @@
1
1
  class ContentController < Spree::BaseController
2
-
3
- before_filter :render_404, :if => :static_asset
2
+ # Don't serve local files or static assets
3
+ before_filter { render_404 if params[:path] =~ /(\.|\\)/ }
4
4
 
5
5
  rescue_from ActionView::MissingTemplate, :with => :render_404
6
6
  caches_page :show, :index, :if => Proc.new { Spree::Config[:cache_static_content] }
7
7
 
8
8
  def show
9
- render params[:path]
9
+ render :template => params[:path]
10
10
  end
11
11
 
12
12
  def cvv
13
13
  render "cvv", :layout => false
14
14
  end
15
-
16
- private
17
- # Determines if the requested resource has a path similar to that of a static asset. In this case do not go through the
18
- # overhead of trying to render a template or whatever.
19
- def static_asset
20
- params[:path] =~ /^\/([^.]+)$/
21
- end
22
15
  end
@@ -50,6 +50,7 @@ class OrdersController < Spree::BaseController
50
50
 
51
51
  def empty
52
52
  if @order = current_order
53
+ @order.promotion_credits.destroy_all
53
54
  @order.line_items.destroy_all
54
55
  end
55
56
  redirect_to cart_path
@@ -81,7 +81,8 @@ class Payment < ActiveRecord::Base
81
81
  end
82
82
 
83
83
  def payment_source
84
- source.is_a?(Payment) ? source.source : source
84
+ res = source.is_a?(Payment) ? source.source : source
85
+ res || payment_method
85
86
  end
86
87
 
87
88
  private
@@ -1,2 +1,27 @@
1
1
  class PaymentMethod::Check < PaymentMethod
2
- end
2
+ def actions
3
+ %w{capture void}
4
+ end
5
+
6
+ # Indicates whether its possible to capture the payment
7
+ def can_capture?(payment)
8
+ ['checkout', 'pending'].include?(payment.state)
9
+ end
10
+
11
+ # Indicates whether its possible to void the payment.
12
+ def can_void?(payment)
13
+ payment.state != 'void'
14
+ end
15
+
16
+ def capture(payment)
17
+ payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
18
+ payment.complete
19
+ true
20
+ end
21
+
22
+ def void(payment)
23
+ payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
24
+ payment.void
25
+ true
26
+ end
27
+ end
@@ -14,7 +14,9 @@ module Spree
14
14
  # The current incomplete order from the session for use in cart and during checkout
15
15
  def current_order(create_order_if_necessary = false)
16
16
  return @current_order if @current_order
17
- @current_order ||= Order.find_by_id(session[:order_id], :include => :adjustments)
17
+ if session[:order_id]
18
+ @current_order = Order.find_by_id(session[:order_id], :include => :adjustments)
19
+ end
18
20
  if create_order_if_necessary and (@current_order.nil? or @current_order.completed?)
19
21
  @current_order = Order.new
20
22
  before_save_new_order
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "0.50.0"
3
+ "0.50.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 215
5
- prerelease: false
4
+ hash: 213
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 50
9
- - 0
10
- version: 0.50.0
9
+ - 1
10
+ version: 0.50.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Schofield
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-23 00:00:00 -04:00
18
+ date: 2011-04-19 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -200,11 +200,12 @@ dependencies:
200
200
  requirements:
201
201
  - - "="
202
202
  - !ruby/object:Gem::Version
203
- hash: -1876988247
203
+ hash: 1923831917
204
204
  segments:
205
205
  - 3
206
206
  - 0
207
- - pre2
207
+ - pre
208
+ - 2
208
209
  version: 3.0.pre2
209
210
  type: :runtime
210
211
  version_requirements: *id012
@@ -216,12 +217,12 @@ dependencies:
216
217
  requirements:
217
218
  - - "="
218
219
  - !ruby/object:Gem::Version
219
- hash: 13
220
+ hash: 11
220
221
  segments:
221
222
  - 3
222
223
  - 0
223
- - 5
224
- version: 3.0.5
224
+ - 6
225
+ version: 3.0.6
225
226
  type: :runtime
226
227
  version_requirements: *id013
227
228
  - !ruby/object:Gem::Dependency
@@ -1125,7 +1126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1125
1126
  requirements:
1126
1127
  - none
1127
1128
  rubyforge_project: spree_core
1128
- rubygems_version: 1.3.7
1129
+ rubygems_version: 1.4.2
1129
1130
  signing_key:
1130
1131
  specification_version: 3
1131
1132
  summary: Core e-commerce functionality for the Spree project.