piggybak 0.6.13 → 0.6.15

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -17,3 +17,4 @@ gem "jquery-rails"
17
17
  # gem 'debugger'
18
18
 
19
19
  gem "countries"
20
+ gem "rack-ssl-enforcer"
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- piggybak (0.6.13)
4
+ piggybak (0.6.15)
5
5
  activemerchant
6
6
  countries
7
7
  devise
8
+ rack-ssl-enforcer
8
9
  rails (~> 3.2.8)
9
10
  rails_admin
10
11
 
@@ -51,7 +52,7 @@ GEM
51
52
  multi_json (~> 1.0)
52
53
  arel (3.0.2)
53
54
  bcrypt-ruby (3.0.1)
54
- bootstrap-sass (2.1.0.0)
55
+ bootstrap-sass (2.1.0.1)
55
56
  builder (3.0.4)
56
57
  coffee-rails (3.2.2)
57
58
  coffee-script (>= 2.2.0)
@@ -59,7 +60,7 @@ GEM
59
60
  coffee-script (2.2.0)
60
61
  coffee-script-source
61
62
  execjs
62
- coffee-script-source (1.3.3)
63
+ coffee-script-source (1.4.0)
63
64
  countries (0.8.1)
64
65
  currencies (= 0.4.0)
65
66
  currencies (>= 0.2.0)
@@ -110,6 +111,7 @@ GEM
110
111
  rack (~> 1.3)
111
112
  rack-ssl (1.3.2)
112
113
  rack
114
+ rack-ssl-enforcer (0.2.4)
113
115
  rack-test (0.6.2)
114
116
  rack (>= 1.0)
115
117
  rails (3.2.8)
@@ -170,3 +172,4 @@ DEPENDENCIES
170
172
  countries
171
173
  jquery-rails
172
174
  piggybak!
175
+ rack-ssl-enforcer
@@ -37,9 +37,6 @@ module Piggybak
37
37
  end
38
38
 
39
39
  if @order.save
40
- # TODO: Imporant: figure out how to have notifications not trigger rollback here. Instead log failed order notification sent.
41
- Piggybak::Notifier.order_notification(@order).deliver
42
-
43
40
  if Piggybak.config.logging
44
41
  logger.info "#{request.remote_ip}:#{Time.now.strftime("%Y-%m-%d %H:%M")} Order saved: #{@order.inspect}"
45
42
  end
@@ -21,13 +21,18 @@ module Piggybak
21
21
  validate :number_payments
22
22
  before_save :postprocess_order, :update_status, :set_new_record
23
23
  after_save :record_order_note
24
+ after_save :deliver_order_confirmation, :if => Proc.new { |order| order.ip_address != "admin" }
24
25
 
25
26
  default_scope :order => 'created_at DESC'
26
27
 
27
28
  attr_accessible :user_id, :email, :phone, :billing_address_attributes,
28
29
  :shipping_address_attributes, :line_items_attributes,
29
30
  :order_notes_attributes, :details, :recorded_changer, :ip_address
30
-
31
+
32
+ def deliver_order_confirmation
33
+ Piggybak::Notifier.order_notification(self).deliver
34
+ end
35
+
31
36
  def initialize_defaults
32
37
  self.recorded_changes ||= []
33
38
 
@@ -66,6 +66,7 @@
66
66
  </table>
67
67
 
68
68
  <% if page == "cart" %>
69
+ <%= link_to "Proceed to Checkout", piggybak.orders_url, :id => "checkout" %>
69
70
  <%= submit_tag "Update", :id => "update" %>
70
71
  <% end -%>
71
72
 
@@ -8,8 +8,4 @@
8
8
  <% end -%>
9
9
 
10
10
  <%= render "items", :page => "cart" %>
11
-
12
- <% if @cart.sellables.any? -%>
13
- <%= link_to "Proceed to Checkout", piggybak.orders_url, :id => "checkout" %>
14
- <% end -%>
15
11
  </div>
@@ -12,6 +12,7 @@ module Piggybak
12
12
  attr_accessor :logging_file
13
13
  attr_accessor :whois_url
14
14
  attr_accessor :line_item_types
15
+ attr_accessor :secure_checkout
15
16
 
16
17
  def reset
17
18
  @email_sender = "support@piggybak.org"
@@ -57,6 +58,8 @@ module Piggybak
57
58
  @logging_file = "/log/orders.log"
58
59
 
59
60
  @whois_url = nil
61
+
62
+ @secure_checkout = false
60
63
  end
61
64
  end
62
65
 
@@ -1,3 +1,3 @@
1
1
  module Piggybak
2
- VERSION = "0.6.13"
2
+ VERSION = "0.6.15"
3
3
  end
data/lib/piggybak.rb CHANGED
@@ -6,6 +6,7 @@ require 'active_merchant'
6
6
  require 'formatted_changes'
7
7
  require 'currency'
8
8
  require 'mask_submissions'
9
+ require 'rack-ssl-enforcer'
9
10
 
10
11
  module Piggybak
11
12
  def self.config(entity = nil, &block)
@@ -24,6 +25,17 @@ module Piggybak
24
25
  end
25
26
 
26
27
  class Engine < Rails::Engine
28
+ initializer "piggybak.ssl_enforcer" do |app|
29
+ # Note: If your main application also uses rack-ssl-enforcer,
30
+ # set secure_checkout to false, and copy this and integrate
31
+ # additional pages that need SSL into your config/application.rb
32
+ if Piggybak.config.secure_checkout
33
+ app.config.middleware.use Rack::SslEnforcer,
34
+ :only => [/\/checkout\/$/, '/checkout/orders/tax', '/checkout/orders/shipping', '/checkout/orders/geodata'],
35
+ :strict => true
36
+ end
37
+ end
38
+
27
39
  initializer "piggybak.add_helper" do |app|
28
40
  ApplicationController.class_eval do
29
41
  helper :piggybak
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.13
4
+ version: 0.6.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-11-05 00:00:00.000000000 Z
14
+ date: 2012-11-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -93,6 +93,22 @@ dependencies:
93
93
  - - ! '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rack-ssl-enforcer
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
96
112
  description: Mountable Ruby on Rails Ecommerce.
97
113
  email:
98
114
  - piggybak@endpoint.com
@@ -213,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
229
  version: '0'
214
230
  segments:
215
231
  - 0
216
- hash: 1341771261448397345
232
+ hash: 3431245891548905163
217
233
  required_rubygems_version: !ruby/object:Gem::Requirement
218
234
  none: false
219
235
  requirements:
@@ -222,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
238
  version: '0'
223
239
  segments:
224
240
  - 0
225
- hash: 1341771261448397345
241
+ hash: 3431245891548905163
226
242
  requirements: []
227
243
  rubyforge_project:
228
244
  rubygems_version: 1.8.23