spree_promo 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,9 +7,11 @@ Spree::CheckoutController.class_eval do
7
7
  fire_event('spree.checkout.update')
8
8
 
9
9
  if @order.coupon_code.present?
10
+ event_name = "spree.checkout.coupon_code_added"
11
+ if Spree::Promotion.exists?(:code => @order.coupon_code,
12
+ :event_name => event_name)
10
13
 
11
- if Spree::Promotion.exists?(:code => @order.coupon_code)
12
- fire_event('spree.checkout.coupon_code_added', :coupon_code => @order.coupon_code)
14
+ fire_event(event_name, :coupon_code => @order.coupon_code)
13
15
  # If it doesn't exist, raise an error!
14
16
  # Giving them another chance to enter a valid coupon code
15
17
  else
@@ -23,4 +23,8 @@ Spree::Order.class_eval do
23
23
  end
24
24
  alias_method_chain :update_adjustments, :promotion_limiting
25
25
  end
26
+
27
+ def promo_total
28
+ adjustments.promotion.map(&:amount).sum
29
+ end
26
30
  end
@@ -0,0 +1,5 @@
1
+ Spree::Payment.class_eval do
2
+ def promo_total
3
+ order.promo_total * 100
4
+ end
5
+ end
@@ -1,6 +1,6 @@
1
1
  <% if Spree::Promotion.count > 0 %>
2
- <p>
3
- <%= form.label :coupon_code %><br />
4
- <%= form.text_field :coupon_code %>
5
- </p>
2
+ <p class='field' data-hook='coupon_code'>
3
+ <%= form.label :coupon_code %><br />
4
+ <%= form.text_field :coupon_code %>
5
+ </p>
6
6
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_promo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,30 +9,30 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-27 00:00:00.000000000Z
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &70299252260320 !ruby/object:Gem::Requirement
16
+ requirement: &70124633804180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
20
20
  - !ruby/object:Gem::Version
21
- version: 1.1.3
21
+ version: 1.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70299252260320
24
+ version_requirements: *70124633804180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spree_auth
27
- requirement: &70299252259720 !ruby/object:Gem::Requirement
27
+ requirement: &70124633818580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
31
31
  - !ruby/object:Gem::Version
32
- version: 1.1.3
32
+ version: 1.1.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70299252259720
35
+ version_requirements: *70124633818580
36
36
  description: Required dependency for Spree
37
37
  email: david@spreecommerce.com
38
38
  executables: []
@@ -55,6 +55,7 @@ files:
55
55
  - app/models/spree/adjustment_decorator.rb
56
56
  - app/models/spree/calculator/free_shipping.rb
57
57
  - app/models/spree/order_decorator.rb
58
+ - app/models/spree/payment_decorator.rb
58
59
  - app/models/spree/product_decorator.rb
59
60
  - app/models/spree/promotion/actions/create_adjustment.rb
60
61
  - app/models/spree/promotion/actions/create_line_items.rb
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  version: '0'
133
134
  segments:
134
135
  - 0
135
- hash: -2084238401508216031
136
+ hash: 4089934897313968543
136
137
  requirements:
137
138
  - none
138
139
  rubyforge_project: