saucy 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/features/run_features.feature +1 -1
- data/lib/saucy/subscription.rb +11 -5
- data/spec/models/subscription_spec.rb +14 -0
- metadata +23 -23
data/README.md
CHANGED
@@ -28,7 +28,7 @@ After you bundle, run the generators:
|
|
28
28
|
|
29
29
|
You will want to include the `ensure_active_account` `before_filter` in any controller actions that you want to protect if the user is using an past due paid account.
|
30
30
|
|
31
|
-
You will want to customize the from email address on billing emails:
|
31
|
+
You will want to customize the from email address on billing and invite emails:
|
32
32
|
|
33
33
|
Saucy::Configuration.mailer_sender = "billingemail@example.com"
|
34
34
|
|
@@ -40,7 +40,7 @@ In addition, there are a number of strings such as application name, support url
|
|
40
40
|
|
41
41
|
There is a `saucy:daily` rake task which should be run on a regular basis to send receipts and payment processing problem emails.
|
42
42
|
|
43
|
-
Saucy accounts become "activated" once an initial setup step is complete. This could be creating the first bug for a bug tracker, or setting up a client gem for a server API. Once the application detects that the account is activate, it should set "
|
43
|
+
Saucy accounts become "activated" once an initial setup step is complete. This could be creating the first bug for a bug tracker, or setting up a client gem for a server API. Once the application detects that the account is activate, it should set "activated" to true on the account. This will prevent followup emails being sent to users that have already set up their accounts.
|
44
44
|
|
45
45
|
Development environment
|
46
46
|
-----------------------
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Feature: generate a saucy application and run rake
|
3
3
|
|
4
4
|
Background:
|
5
|
-
When I successfully run "rails new testapp"
|
5
|
+
When I successfully run "bundle exec rails new testapp"
|
6
6
|
And I cd to "testapp"
|
7
7
|
And I copy the locked Gemfile from this project
|
8
8
|
And I append to "Gemfile" with:
|
data/lib/saucy/subscription.rb
CHANGED
@@ -193,11 +193,7 @@ module Saucy
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def create_subscription
|
196
|
-
result = Braintree::Subscription.create(
|
197
|
-
:payment_method_token => credit_card.token,
|
198
|
-
:plan_id => plan_id,
|
199
|
-
:merchant_account_id => Saucy::Configuration.merchant_account_id
|
200
|
-
)
|
196
|
+
result = Braintree::Subscription.create(subscription_attributes)
|
201
197
|
if result.success?
|
202
198
|
self.subscription_token = result.subscription.id
|
203
199
|
self.next_billing_date = result.subscription.next_billing_date
|
@@ -207,6 +203,16 @@ module Saucy
|
|
207
203
|
end
|
208
204
|
end
|
209
205
|
|
206
|
+
def subscription_attributes
|
207
|
+
{
|
208
|
+
:payment_method_token => credit_card.token,
|
209
|
+
:plan_id => plan_id,
|
210
|
+
:merchant_account_id => Saucy::Configuration.merchant_account_id
|
211
|
+
}.tap do |attributes|
|
212
|
+
attributes.reject! { |key, value| value.nil? }
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
210
216
|
def switching_to_billed?
|
211
217
|
plan_id && plan.billed? && subscription_token.blank?
|
212
218
|
end
|
@@ -232,6 +232,20 @@ describe Account, "with a free plan" do
|
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
+
it "doesn't pass up the merchant_account_id on the subscription when it's not configured" do
|
236
|
+
Saucy::Configuration.merchant_account_id = nil
|
237
|
+
new_plan = Factory(:paid_plan, :name => "New Plan")
|
238
|
+
subject.save_customer_and_subscription!(:plan_id => new_plan.id,
|
239
|
+
:cardholder_name => "Ralph Robot",
|
240
|
+
:billing_email => "ralph@example.com",
|
241
|
+
:card_number => "4111111111111111",
|
242
|
+
:verification_code => "123",
|
243
|
+
:expiration_month => 5,
|
244
|
+
:expiration_year => 2012)
|
245
|
+
|
246
|
+
FakeBraintree.subscriptions[subject.subscription_token].keys.should_not include("merchant_account_id")
|
247
|
+
end
|
248
|
+
|
235
249
|
it "doesn't create a credit card, and subscription when the plan is changed to a different free plan" do
|
236
250
|
new_plan = Factory(:plan, :name => "New Plan")
|
237
251
|
subject.save_customer_and_subscription!(:plan_id => new_plan.id)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc.
|
@@ -18,12 +18,12 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-04-
|
21
|
+
date: 2011-04-12 00:00:00 -04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
type: :runtime
|
26
|
-
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
@@ -33,12 +33,12 @@ dependencies:
|
|
33
33
|
- 1
|
34
34
|
- 2
|
35
35
|
version: "1.2"
|
36
|
-
|
37
|
-
prerelease: false
|
36
|
+
version_requirements: *id001
|
38
37
|
name: formtastic
|
38
|
+
prerelease: false
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
type: :runtime
|
41
|
-
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
@@ -49,12 +49,12 @@ dependencies:
|
|
49
49
|
- 0
|
50
50
|
- 3
|
51
51
|
version: 3.0.3
|
52
|
-
|
53
|
-
prerelease: false
|
52
|
+
version_requirements: *id002
|
54
53
|
name: railties
|
54
|
+
prerelease: false
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
type: :runtime
|
57
|
-
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
@@ -65,12 +65,12 @@ dependencies:
|
|
65
65
|
- 6
|
66
66
|
- 2
|
67
67
|
version: 2.6.2
|
68
|
-
|
69
|
-
prerelease: false
|
68
|
+
version_requirements: *id003
|
70
69
|
name: braintree
|
70
|
+
prerelease: false
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
type: :runtime
|
73
|
-
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - "="
|
@@ -81,12 +81,12 @@ dependencies:
|
|
81
81
|
- 3
|
82
82
|
- 3
|
83
83
|
version: 1.3.3
|
84
|
-
|
85
|
-
prerelease: false
|
84
|
+
version_requirements: *id004
|
86
85
|
name: sham_rack
|
86
|
+
prerelease: false
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
type: :runtime
|
89
|
-
|
89
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
@@ -97,12 +97,12 @@ dependencies:
|
|
97
97
|
- 1
|
98
98
|
- 2
|
99
99
|
version: 1.1.2
|
100
|
-
|
101
|
-
prerelease: false
|
100
|
+
version_requirements: *id005
|
102
101
|
name: sinatra
|
102
|
+
prerelease: false
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
type: :development
|
105
|
-
|
105
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - "="
|
@@ -113,9 +113,9 @@ dependencies:
|
|
113
113
|
- 2
|
114
114
|
- 6
|
115
115
|
version: 0.2.6
|
116
|
-
|
117
|
-
prerelease: false
|
116
|
+
version_requirements: *id006
|
118
117
|
name: aruba
|
118
|
+
prerelease: false
|
119
119
|
description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
|
120
120
|
email: support@thoughtbot.com
|
121
121
|
executables: []
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
requirements: []
|
297
297
|
|
298
298
|
rubyforge_project:
|
299
|
-
rubygems_version: 1.
|
299
|
+
rubygems_version: 1.6.1
|
300
300
|
signing_key:
|
301
301
|
specification_version: 3
|
302
302
|
summary: Clearance-based Rails engine for SaaS
|