saucy 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/lib/saucy/configuration.rb +1 -0
- data/lib/saucy/subscription.rb +3 -1
- data/spec/models/subscription_spec.rb +14 -0
- data/spec/saucy_spec.rb +4 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -32,6 +32,10 @@ You will want to customize the from email address on billing emails:
|
|
32
32
|
|
33
33
|
Saucy::Configuration.mailer_sender = "billingemail@example.com"
|
34
34
|
|
35
|
+
If you have an account with Braintree with multiple merchant accounts you'll want to configure the merchant account for this application:
|
36
|
+
|
37
|
+
Saucy::Configuration.merchant_account_id = 'your merchant account id'
|
38
|
+
|
35
39
|
In addition, there are a number of strings such as application name, support url, etc. that are provided and customized with i18n translations. You can customize these in your app, and you can see what they are by looking at config/locales/en.yml in saucy.
|
36
40
|
|
37
41
|
There is a `saucy:daily` rake task which should be run on a regular basis to send receipts and payment processing problem emails.
|
data/lib/saucy/configuration.rb
CHANGED
data/lib/saucy/subscription.rb
CHANGED
@@ -195,13 +195,15 @@ module Saucy
|
|
195
195
|
def create_subscription
|
196
196
|
result = Braintree::Subscription.create(
|
197
197
|
:payment_method_token => credit_card.token,
|
198
|
-
:plan_id
|
198
|
+
:plan_id => plan_id,
|
199
|
+
:merchant_account_id => Saucy::Configuration.merchant_account_id
|
199
200
|
)
|
200
201
|
if result.success?
|
201
202
|
self.subscription_token = result.subscription.id
|
202
203
|
self.next_billing_date = result.subscription.next_billing_date
|
203
204
|
self.subscription_status = result.subscription.status
|
204
205
|
else
|
206
|
+
p result
|
205
207
|
false
|
206
208
|
end
|
207
209
|
end
|
@@ -214,6 +214,20 @@ describe Account, "with a free plan" do
|
|
214
214
|
subject.subscription.should_not be_nil
|
215
215
|
end
|
216
216
|
|
217
|
+
it "passes up the merchant_account_id on the subscription when it's configured" do
|
218
|
+
Saucy::Configuration.merchant_account_id = 'test'
|
219
|
+
new_plan = Factory(:paid_plan, :name => "New Plan")
|
220
|
+
subject.save_customer_and_subscription!(:plan_id => new_plan.id,
|
221
|
+
:cardholder_name => "Ralph Robot",
|
222
|
+
:billing_email => "ralph@example.com",
|
223
|
+
:card_number => "4111111111111111",
|
224
|
+
:verification_code => "123",
|
225
|
+
:expiration_month => 5,
|
226
|
+
:expiration_year => 2012)
|
227
|
+
|
228
|
+
FakeBraintree.subscriptions[subject.subscription_token]["merchant_account_id"].should == 'test'
|
229
|
+
end
|
230
|
+
|
217
231
|
it "doesn't create a credit card, and subscription when the plan is changed to a different free plan" do
|
218
232
|
new_plan = Factory(:plan, :name => "New Plan")
|
219
233
|
subject.save_customer_and_subscription!(:plan_id => new_plan.id)
|
data/spec/saucy_spec.rb
CHANGED
@@ -9,6 +9,10 @@ describe Saucy::Configuration do
|
|
9
9
|
subject.mailer_sender.should_not be_nil
|
10
10
|
end
|
11
11
|
|
12
|
+
it "has a nil merchant_account_id" do
|
13
|
+
subject.merchant_account_id.should be_nil
|
14
|
+
end
|
15
|
+
|
12
16
|
it "can assign a mailer sender" do
|
13
17
|
old_sender = subject.mailer_sender
|
14
18
|
begin
|
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: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc.
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-03-
|
21
|
+
date: 2011-03-24 00:00:00 -04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|