saucy 0.11.3 → 0.11.5
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.
- data/CHANGELOG.md +9 -0
- data/app/mailers/billing_mailer.rb +1 -2
- data/app/views/billing_mailer/problem.html.erb +1 -1
- data/app/views/billing_mailer/problem.text.erb +1 -1
- data/lib/saucy/subscription.rb +1 -1
- data/spec/mailers/billing_mailer_spec.rb +1 -6
- data/spec/models/subscription_spec.rb +7 -44
- metadata +9 -12
data/CHANGELOG.md
CHANGED
@@ -10,9 +10,8 @@ class BillingMailer < ActionMailer::Base
|
|
10
10
|
:from => Saucy::Configuration.support_email_address)
|
11
11
|
end
|
12
12
|
|
13
|
-
def problem(account
|
13
|
+
def problem(account)
|
14
14
|
@account = account
|
15
|
-
@transaction = transaction
|
16
15
|
mail(:to => account.customer.email,
|
17
16
|
:subject => I18n.t(:subject,
|
18
17
|
:scope => [:saucy, :mailers, :billing_mailer, :problem],
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<p>Unfortunately there was a problem processing your latest payment
|
1
|
+
<p>Unfortunately there was a problem processing your latest payment for your <%= @account.name -%> account on <%= t("app_name") %>.</p>
|
2
2
|
|
3
3
|
<p>Some functionality of your <%= @account.name -%> account on <%= t("app_name") %> is now disabled.</p>
|
4
4
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Unfortunately there was a problem processing your latest payment
|
1
|
+
Unfortunately there was a problem processing your latest payment for your <%= @account.name -%> account on <%= t("app_name") %>.
|
2
2
|
|
3
3
|
Some functionality of your <%= @account.name -%> account on <%= t("app_name") %> is now disabled.
|
4
4
|
|
data/lib/saucy/subscription.rb
CHANGED
@@ -232,7 +232,7 @@ module Saucy
|
|
232
232
|
account.next_billing_date = account.subscription.next_billing_date
|
233
233
|
account.save!
|
234
234
|
if account.past_due?
|
235
|
-
BillingMailer.problem(account
|
235
|
+
BillingMailer.problem(account).deliver!
|
236
236
|
else
|
237
237
|
BillingMailer.receipt(account, account.most_recent_transaction).deliver!
|
238
238
|
Saucy::Notifications.notify_observers("billed", :account => account)
|
@@ -21,7 +21,7 @@ describe "with an account and transaction" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe BillingMailer, "problem" do
|
24
|
-
subject { BillingMailer.problem(account
|
24
|
+
subject { BillingMailer.problem(account) }
|
25
25
|
|
26
26
|
it "sends the problem mail from the support address" do
|
27
27
|
subject.from.should == [Saucy::Configuration.support_email_address]
|
@@ -30,11 +30,6 @@ describe "with an account and transaction" do
|
|
30
30
|
it "sets the problem mail reply-to to the support address" do
|
31
31
|
subject.reply_to.should == [Saucy::Configuration.support_email_address]
|
32
32
|
end
|
33
|
-
|
34
|
-
it "includes the attempted billing date" do
|
35
|
-
billing_date = account.subscription.transactions.first.created_at
|
36
|
-
subject.to_s.should include(billing_date.to_s(:short_date))
|
37
|
-
end
|
38
33
|
end
|
39
34
|
|
40
35
|
describe BillingMailer, "expiring trial" do
|
@@ -339,7 +339,7 @@ describe Account, "with a paid subscription" do
|
|
339
339
|
end
|
340
340
|
end
|
341
341
|
|
342
|
-
context "with multiple historical transactions" do
|
342
|
+
context "with multiple historical transactions and an active account" do
|
343
343
|
let(:subscription) { FakeBraintree.subscriptions[subject.subscription_token] }
|
344
344
|
|
345
345
|
let!(:earlier_transaction_date) { 2.months.ago }
|
@@ -357,48 +357,11 @@ describe Account, "with a paid subscription" do
|
|
357
357
|
|
358
358
|
before do
|
359
359
|
subscription["next_billing_date"] = 2.months.from_now
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
}
|
366
|
-
|
367
|
-
let(:later_transaction) {
|
368
|
-
build_transaction(:created_at => later_transaction_date, :status => Braintree::Transaction::Status::Failed)
|
369
|
-
}
|
370
|
-
|
371
|
-
before do
|
372
|
-
subscription["status"] = Braintree::Subscription::Status::PastDue
|
373
|
-
subscription["transactions"] = [later_transaction, earlier_transaction]
|
374
|
-
end
|
375
|
-
|
376
|
-
it "receives a problem email with the correct transaction" do
|
377
|
-
Timecop.travel(subject.next_billing_date + 1.day) do
|
378
|
-
ActionMailer::Base.deliveries.clear
|
379
|
-
Account.update_subscriptions!
|
380
|
-
|
381
|
-
ActionMailer::Base.deliveries.any? do |email|
|
382
|
-
email.subject =~ /problem/i &&
|
383
|
-
email.to_s.include?(later_transaction_date.strftime("%x"))
|
384
|
-
end.should be
|
385
|
-
end
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
|
-
context "and an actively billed account" do
|
390
|
-
let(:earlier_transaction) {
|
391
|
-
build_transaction(:created_at => earlier_transaction_date, :status => Braintree::Transaction::Status::Settled)
|
392
|
-
}
|
393
|
-
|
394
|
-
let(:later_transaction) {
|
395
|
-
build_transaction(:created_at => later_transaction_date, :status => Braintree::Transaction::Status::Settled)
|
396
|
-
}
|
397
|
-
|
398
|
-
before do
|
399
|
-
subscription["status"] = Braintree::Subscription::Status::Active
|
400
|
-
subscription["transactions"] = [later_transaction, earlier_transaction]
|
401
|
-
end
|
360
|
+
subscription["status"] = Braintree::Subscription::Status::Active
|
361
|
+
subscription["transactions"] = [
|
362
|
+
build_transaction(:created_at => later_transaction_date),
|
363
|
+
build_transaction(:created_at => earlier_transaction_date)
|
364
|
+
]
|
402
365
|
|
403
366
|
it "receives a receipt email with the correct transaction for active accounts" do
|
404
367
|
Timecop.travel(subject.next_billing_date + 1.day) do
|
@@ -407,7 +370,7 @@ describe Account, "with a paid subscription" do
|
|
407
370
|
|
408
371
|
ActionMailer::Base.deliveries.any? do |email|
|
409
372
|
email.subject =~ /receipt/i &&
|
410
|
-
|
373
|
+
email.to_s.include?(later_transaction_date.strftime("%x"))
|
411
374
|
end.should be
|
412
375
|
end
|
413
376
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: saucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.11.
|
5
|
+
version: 0.11.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- thoughtbot, inc.
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: clearance
|
22
|
+
prerelease: false
|
22
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
@@ -26,10 +27,10 @@ dependencies:
|
|
26
27
|
- !ruby/object:Gem::Version
|
27
28
|
version: 0.11.2
|
28
29
|
type: :runtime
|
29
|
-
prerelease: false
|
30
30
|
version_requirements: *id001
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: formtastic
|
33
|
+
prerelease: false
|
33
34
|
requirement: &id002 !ruby/object:Gem::Requirement
|
34
35
|
none: false
|
35
36
|
requirements:
|
@@ -37,10 +38,10 @@ dependencies:
|
|
37
38
|
- !ruby/object:Gem::Version
|
38
39
|
version: "1.2"
|
39
40
|
type: :runtime
|
40
|
-
prerelease: false
|
41
41
|
version_requirements: *id002
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: railties
|
44
|
+
prerelease: false
|
44
45
|
requirement: &id003 !ruby/object:Gem::Requirement
|
45
46
|
none: false
|
46
47
|
requirements:
|
@@ -48,10 +49,10 @@ dependencies:
|
|
48
49
|
- !ruby/object:Gem::Version
|
49
50
|
version: 3.0.3
|
50
51
|
type: :runtime
|
51
|
-
prerelease: false
|
52
52
|
version_requirements: *id003
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: braintree
|
55
|
+
prerelease: false
|
55
56
|
requirement: &id004 !ruby/object:Gem::Requirement
|
56
57
|
none: false
|
57
58
|
requirements:
|
@@ -59,10 +60,10 @@ dependencies:
|
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: 2.6.2
|
61
62
|
type: :runtime
|
62
|
-
prerelease: false
|
63
63
|
version_requirements: *id004
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: sham_rack
|
66
|
+
prerelease: false
|
66
67
|
requirement: &id005 !ruby/object:Gem::Requirement
|
67
68
|
none: false
|
68
69
|
requirements:
|
@@ -70,10 +71,10 @@ dependencies:
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: 1.3.3
|
72
73
|
type: :runtime
|
73
|
-
prerelease: false
|
74
74
|
version_requirements: *id005
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: sinatra
|
77
|
+
prerelease: false
|
77
78
|
requirement: &id006 !ruby/object:Gem::Requirement
|
78
79
|
none: false
|
79
80
|
requirements:
|
@@ -81,10 +82,10 @@ dependencies:
|
|
81
82
|
- !ruby/object:Gem::Version
|
82
83
|
version: 1.1.2
|
83
84
|
type: :runtime
|
84
|
-
prerelease: false
|
85
85
|
version_requirements: *id006
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: aruba
|
88
|
+
prerelease: false
|
88
89
|
requirement: &id007 !ruby/object:Gem::Requirement
|
89
90
|
none: false
|
90
91
|
requirements:
|
@@ -92,7 +93,6 @@ dependencies:
|
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: 0.2.6
|
94
95
|
type: :development
|
95
|
-
prerelease: false
|
96
96
|
version_requirements: *id007
|
97
97
|
description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
|
98
98
|
email: support@thoughtbot.com
|
@@ -287,9 +287,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
287
|
requirements:
|
288
288
|
- - ">="
|
289
289
|
- !ruby/object:Gem::Version
|
290
|
-
hash: 1978592027769739368
|
291
|
-
segments:
|
292
|
-
- 0
|
293
290
|
version: "0"
|
294
291
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
292
|
none: false
|