payola-payments 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +200 -0
- data/LICENSE +6 -0
- data/README.md +80 -0
- data/Rakefile +5 -4
- data/app/assets/javascripts/payola/application.js +3 -3
- data/app/assets/javascripts/payola/checkout_button.js +29 -19
- data/app/assets/javascripts/payola/subscription_checkout_button.js +7 -1
- data/app/assets/javascripts/payola/subscription_form_onestep.js +27 -0
- data/app/assets/stylesheets/payola/application.css +4 -4
- data/app/controllers/concerns/payola/affiliate_behavior.rb +1 -1
- data/app/controllers/concerns/payola/status_behavior.rb +1 -1
- data/app/controllers/payola/application_controller.rb +8 -0
- data/app/controllers/payola/cards_controller.rb +14 -14
- data/app/controllers/payola/customers_controller.rb +11 -12
- data/app/controllers/payola/subscriptions_controller.rb +16 -8
- data/app/controllers/payola/transactions_controller.rb +1 -1
- data/app/models/concerns/payola/plan.rb +2 -1
- data/app/models/payola/subscription.rb +5 -0
- data/app/services/payola/cancel_subscription.rb +6 -5
- data/app/services/payola/change_subscription_plan.rb +3 -1
- data/app/services/payola/change_subscription_quantity.rb +1 -1
- data/app/services/payola/create_sale.rb +12 -2
- data/app/services/payola/create_subscription.rb +1 -1
- data/app/services/payola/start_subscription.rb +9 -1
- data/app/services/payola/update_customer.rb +1 -1
- data/app/views/payola/subscriptions/_change_plan.html.erb +2 -0
- data/app/views/payola/subscriptions/_checkout.html.erb +1 -1
- data/app/views/payola/transactions/_checkout.html.erb +4 -2
- data/config/locales/en.yml +17 -0
- data/db/migrate/20151205004838_change_tax_percent_format_in_payola_subscriptions.rb +9 -0
- data/lib/payola.rb +6 -0
- data/lib/payola/version.rb +1 -1
- data/spec/concerns/plan_spec.rb +16 -4
- data/spec/controllers/payola/cards_controller_spec.rb +92 -8
- data/spec/controllers/payola/customers_controller_spec.rb +47 -4
- data/spec/controllers/payola/subscriptions_controller_spec.rb +59 -46
- data/spec/controllers/payola/transactions_controller_spec.rb +33 -30
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +3 -3
- data/spec/dummy/app/assets/stylesheets/application.css +4 -4
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +27 -11
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/config/application.rb +1 -2
- data/spec/dummy/config/boot.rb +2 -2
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +1 -37
- data/spec/dummy/config/environments/production.rb +1 -82
- data/spec/dummy/config/environments/rails_4/development.rb +37 -0
- data/spec/dummy/config/environments/rails_4/production.rb +82 -0
- data/spec/dummy/config/environments/rails_4/test.rb +45 -0
- data/spec/dummy/config/environments/rails_5/development.rb +54 -0
- data/spec/dummy/config/environments/rails_5/production.rb +86 -0
- data/spec/dummy/config/environments/rails_5/test.rb +44 -0
- data/spec/dummy/config/environments/test.rb +1 -45
- data/spec/dummy/config/initializers/assets.rb +3 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -1
- data/spec/dummy/config/initializers/new_framework_defaults.rb +26 -0
- data/spec/dummy/config/secrets.yml +1 -1
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/db/schema.rb +9 -12
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +134732 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/models/payola/env_wrapper_spec.rb +13 -0
- data/spec/models/payola/sale_spec.rb +7 -7
- data/spec/models/payola/subscription_spec.rb +8 -3
- data/spec/payola_spec.rb +8 -8
- data/spec/services/payola/cancel_subscription_spec.rb +20 -4
- data/spec/services/payola/change_subscription_plan_spec.rb +2 -1
- data/spec/services/payola/change_subscription_quantity_spec.rb +23 -7
- data/spec/services/payola/charge_card_spec.rb +30 -25
- data/spec/services/payola/invoice_failed_spec.rb +1 -0
- data/spec/services/payola/invoice_paid_spec.rb +1 -0
- data/spec/services/payola/start_subscription_spec.rb +15 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/support/http_methods_with_keyword_args.rb +21 -0
- data/spec/support/params_helper.rb +9 -0
- data/spec/worker_spec.rb +2 -2
- metadata +41 -13
- data/config/database.yml.ci +0 -6
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Payola
|
4
|
+
describe EnvWrapper do
|
5
|
+
describe "delegations" do
|
6
|
+
it "should delgate is_a?" do
|
7
|
+
ENV['whatever'] = 'some value'
|
8
|
+
wrap = EnvWrapper.new('whatever')
|
9
|
+
expect(wrap.is_a?(String)).to be_truthy
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -40,7 +40,7 @@ module Payola
|
|
40
40
|
|
41
41
|
describe "#process!" do
|
42
42
|
it "should charge the card" do
|
43
|
-
Payola::ChargeCard.
|
43
|
+
expect(Payola::ChargeCard).to receive(:call)
|
44
44
|
|
45
45
|
sale = create(:sale)
|
46
46
|
sale.process!
|
@@ -50,8 +50,8 @@ module Payola
|
|
50
50
|
describe "#finish" do
|
51
51
|
it "should instrument finish" do
|
52
52
|
sale = create(:sale, state: 'processing')
|
53
|
-
Payola.
|
54
|
-
Payola.
|
53
|
+
expect(Payola).to receive(:instrument).with('payola.product.sale.finished', sale)
|
54
|
+
expect(Payola).to receive(:instrument).with('payola.sale.finished', sale)
|
55
55
|
|
56
56
|
sale.finish!
|
57
57
|
end
|
@@ -60,8 +60,8 @@ module Payola
|
|
60
60
|
describe "#fail" do
|
61
61
|
it "should instrument fail" do
|
62
62
|
sale = create(:sale, state: 'processing')
|
63
|
-
Payola.
|
64
|
-
Payola.
|
63
|
+
expect(Payola).to receive(:instrument).with('payola.product.sale.failed', sale)
|
64
|
+
expect(Payola).to receive(:instrument).with('payola.sale.failed', sale)
|
65
65
|
|
66
66
|
sale.fail!
|
67
67
|
end
|
@@ -70,8 +70,8 @@ module Payola
|
|
70
70
|
describe "#refund" do
|
71
71
|
it "should instrument refund" do
|
72
72
|
sale = create(:sale, state: 'finished')
|
73
|
-
Payola.
|
74
|
-
Payola.
|
73
|
+
expect(Payola).to receive(:instrument).with('payola.product.sale.refunded', sale)
|
74
|
+
expect(Payola).to receive(:instrument).with('payola.sale.refunded', sale)
|
75
75
|
sale.refund!
|
76
76
|
end
|
77
77
|
end
|
@@ -29,7 +29,7 @@ module Payola
|
|
29
29
|
subscription = build(:subscription, stripe_token: nil)
|
30
30
|
expect(subscription.valid?).to be true
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should validate nil stripe_token when the subscription owner is present" do
|
34
34
|
plan = create(:subscription_plan)
|
35
35
|
plan.amount = 0
|
@@ -65,6 +65,7 @@ module Payola
|
|
65
65
|
plan = create(:subscription_plan)
|
66
66
|
subscription = build(:subscription, plan: plan)
|
67
67
|
stripe_sub = Stripe::Customer.create.subscriptions.create(plan: plan.stripe_id, source: StripeMock.generate_card_token(last4: '1234', exp_year: Time.now.year + 1))
|
68
|
+
|
68
69
|
old_start = subscription.current_period_start
|
69
70
|
old_end = subscription.current_period_end
|
70
71
|
trial_start = subscription.trial_start
|
@@ -85,9 +86,11 @@ module Payola
|
|
85
86
|
end
|
86
87
|
|
87
88
|
it "should sync non-timestamp fields" do
|
88
|
-
plan = create(:subscription_plan)
|
89
|
-
subscription = build(:subscription, plan: plan)
|
89
|
+
plan = create(:subscription_plan, amount: 200)
|
90
|
+
subscription = build(:subscription, plan: plan, amount: 50)
|
90
91
|
stripe_sub = Stripe::Customer.create.subscriptions.create(plan: plan.stripe_id, source: StripeMock.generate_card_token(last4: '1234', exp_year: Time.now.year + 1))
|
92
|
+
coupon = create(:payola_coupon)
|
93
|
+
allow(stripe_sub).to receive_message_chain(:discount, :coupon, :id).and_return(coupon.code)
|
91
94
|
|
92
95
|
expect(stripe_sub).to receive(:quantity).and_return(10).at_least(1)
|
93
96
|
expect(stripe_sub).to receive(:cancel_at_period_end).and_return(true).at_least(1)
|
@@ -97,8 +100,10 @@ module Payola
|
|
97
100
|
subscription.reload
|
98
101
|
|
99
102
|
expect(subscription.quantity).to eq 10
|
103
|
+
expect(subscription.amount).to eq 200
|
100
104
|
expect(subscription.stripe_status).to eq 'active'
|
101
105
|
expect(subscription.cancel_at_period_end).to eq true
|
106
|
+
expect(subscription.coupon).to eq coupon.code
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
data/spec/payola_spec.rb
CHANGED
@@ -25,15 +25,15 @@ module Payola
|
|
25
25
|
|
26
26
|
describe "instrumentation" do
|
27
27
|
it "should pass subscribe to StripeEvent" do
|
28
|
-
StripeEvent.
|
28
|
+
expect(StripeEvent).to receive(:subscribe)
|
29
29
|
Payola.subscribe('foo', 'blah')
|
30
30
|
end
|
31
31
|
it "should pass instrument to StripeEvent.backend" do
|
32
|
-
ActiveSupport::Notifications.
|
32
|
+
expect(ActiveSupport::Notifications).to receive(:instrument)
|
33
33
|
Payola.instrument('foo', 'blah')
|
34
34
|
end
|
35
35
|
it "should pass all to StripeEvent" do
|
36
|
-
StripeEvent.
|
36
|
+
expect(StripeEvent).to receive(:all)
|
37
37
|
Payola.all('blah')
|
38
38
|
end
|
39
39
|
end
|
@@ -48,7 +48,7 @@ module Payola
|
|
48
48
|
|
49
49
|
describe "with symbol" do
|
50
50
|
it "should find the correct background worker" do
|
51
|
-
FakeWorker.
|
51
|
+
expect(FakeWorker).to receive(:call)
|
52
52
|
|
53
53
|
Payola.background_worker = :fake
|
54
54
|
Payola.queue!('blah')
|
@@ -76,8 +76,8 @@ module Payola
|
|
76
76
|
|
77
77
|
describe "with nothing" do
|
78
78
|
it "should call autofind" do
|
79
|
-
FakeWorker.
|
80
|
-
Payola::Worker.
|
79
|
+
expect(FakeWorker).to receive(:call).and_return(:true)
|
80
|
+
expect(Payola::Worker).to receive(:autofind).and_return(FakeWorker)
|
81
81
|
Payola.queue!('blah')
|
82
82
|
end
|
83
83
|
end
|
@@ -98,7 +98,7 @@ module Payola
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
FakeWorker.
|
101
|
+
expect(FakeWorker).to receive(:call).with(Payola::SendMail, 'Payola::FakeMailer', 'receipt', 1, 2)
|
102
102
|
Payola.send_mail(FakeMailer, :receipt, 1, 2)
|
103
103
|
end
|
104
104
|
end
|
@@ -109,7 +109,7 @@ module Payola
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should set up listeners for auto emails" do
|
112
|
-
Payola.
|
112
|
+
expect(Payola).to receive(:subscribe).with('payola.sale.finished').at_least(2)
|
113
113
|
Payola.send_email_for :receipt, :admin_receipt
|
114
114
|
end
|
115
115
|
end
|
@@ -10,14 +10,30 @@ module Payola
|
|
10
10
|
@subscription = create(:subscription, plan: plan, stripe_token: token)
|
11
11
|
@subscription.process!
|
12
12
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
context "when at_period_end is true" do
|
15
|
+
it "leaves the subscription in the active state" do
|
16
|
+
CancelSubscription.call(@subscription, at_period_end: true)
|
17
|
+
expect(@subscription.reload.state).to eq 'active'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "sets subscription.cancel_at_period_end to true" do
|
21
|
+
CancelSubscription.call(@subscription, at_period_end: true)
|
22
|
+
expect(@subscription.reload.cancel_at_period_end).to be true
|
23
|
+
end
|
16
24
|
end
|
25
|
+
|
26
|
+
context "when at_period_end is not true" do
|
27
|
+
it "cancels the subscription immediately" do
|
28
|
+
CancelSubscription.call(@subscription)
|
29
|
+
expect(@subscription.reload.state).to eq 'canceled'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
17
33
|
it "should not change the state if an error occurs" do
|
18
34
|
custom_error = StandardError.new("Customer not found")
|
19
35
|
StripeMock.prepare_error(custom_error, :get_customer)
|
20
|
-
expect { CancelSubscription.call(@subscription) }.to raise_error
|
36
|
+
expect { CancelSubscription.call(@subscription) }.to raise_error("Customer not found")
|
21
37
|
|
22
38
|
expect(@subscription.reload.state).to eq 'active'
|
23
39
|
end
|
@@ -50,7 +50,8 @@ module Payola
|
|
50
50
|
context "set" do
|
51
51
|
before do
|
52
52
|
@coupon = build :payola_coupon
|
53
|
-
|
53
|
+
@quantity = 1
|
54
|
+
Payola::ChangeSubscriptionPlan.call(@subscription, @plan2, @quantity, @coupon)
|
54
55
|
end
|
55
56
|
|
56
57
|
it "should have the coupon" do
|
@@ -5,28 +5,44 @@ module Payola
|
|
5
5
|
let(:stripe_helper) { StripeMock.create_test_helper }
|
6
6
|
|
7
7
|
describe "#call" do
|
8
|
+
let(:original_quantity) { 1 }
|
9
|
+
let(:new_quantity) { original_quantity + 1 }
|
10
|
+
|
8
11
|
before(:each) do
|
9
12
|
@plan = create(:subscription_plan)
|
10
13
|
expect(@plan.errors).to be_blank
|
11
14
|
|
12
15
|
token = StripeMock.generate_card_token({})
|
13
|
-
@subscription = create(:subscription, quantity:
|
16
|
+
@subscription = create(:subscription, quantity: original_quantity, stripe_token: token, plan: @plan, state: 'processing')
|
14
17
|
StartSubscription.call(@subscription)
|
15
18
|
expect(@subscription.error).to be_nil
|
16
19
|
expect(@subscription.active?).to be_truthy
|
17
|
-
|
18
|
-
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not produce any subscription errors" do
|
23
|
+
subscription = Payola::ChangeSubscriptionQuantity.call(@subscription, new_quantity)
|
24
|
+
|
25
|
+
expect(subscription.errors).to be_blank
|
19
26
|
end
|
20
27
|
|
21
28
|
it "should change the quantity on the stripe subscription" do
|
22
|
-
|
23
|
-
sub = customer.subscriptions.retrieve(@subscription.stripe_id)
|
29
|
+
subscription = Payola::ChangeSubscriptionQuantity.call(@subscription, new_quantity)
|
24
30
|
|
25
|
-
|
31
|
+
customer = Stripe::Customer.retrieve(subscription.stripe_customer_id)
|
32
|
+
sub = customer.subscriptions.retrieve(subscription.stripe_id)
|
33
|
+
expect(sub.quantity).to eq new_quantity
|
26
34
|
end
|
27
35
|
|
28
36
|
it "should change the quantity on the payola subscription" do
|
29
|
-
|
37
|
+
subscription = Payola::ChangeSubscriptionQuantity.call(@subscription, new_quantity)
|
38
|
+
|
39
|
+
expect(subscription.reload.quantity).to eq new_quantity
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should notify quantity has changed" do
|
43
|
+
expect(@subscription).to receive(:instrument_quantity_changed).with(original_quantity)
|
44
|
+
|
45
|
+
Payola::ChangeSubscriptionQuantity.call(@subscription, new_quantity)
|
30
46
|
end
|
31
47
|
end
|
32
48
|
end
|
@@ -4,34 +4,39 @@ module Payola
|
|
4
4
|
describe ChargeCard do
|
5
5
|
let(:stripe_helper) { StripeMock.create_test_helper }
|
6
6
|
describe "#call" do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
describe "on success" do
|
8
|
+
before do
|
9
|
+
expect(Stripe::BalanceTransaction).to receive(:retrieve).and_return(OpenStruct.new( amount: 100, fee: 3.29, currency: 'usd' ))
|
10
|
+
end
|
11
|
+
it "should create a customer" do
|
12
|
+
sale = create(:sale, state: 'processing', stripe_token: stripe_helper.generate_card_token)
|
13
|
+
ChargeCard.call(sale)
|
14
|
+
expect(sale.reload.stripe_customer_id).to_not be_nil
|
15
|
+
end
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
it "should not create a customer if one already exists" do
|
18
|
+
customer = Stripe::Customer.create
|
19
|
+
sale = create(:sale, state: 'processing', stripe_customer_id: customer.id)
|
20
|
+
expect(Stripe::Customer).to receive(:retrieve).and_return(customer)
|
21
|
+
ChargeCard.call(sale)
|
22
|
+
expect(sale.reload.stripe_customer_id).to eq customer.id
|
23
|
+
expect(sale.state).to eq 'finished'
|
24
|
+
end
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
it "should create a charge" do
|
27
|
+
sale = create(:sale, state: 'processing', stripe_token: stripe_helper.generate_card_token)
|
28
|
+
ChargeCard.call(sale)
|
29
|
+
expect(sale.reload.stripe_id).to_not be_nil
|
30
|
+
expect(sale.reload.card_last4).to_not be_nil
|
31
|
+
expect(sale.reload.card_expiration).to_not be_nil
|
32
|
+
expect(sale.reload.card_type).to_not be_nil
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
it "should get the fee from the balance transaction" do
|
36
|
+
sale = create(:sale, state: 'processing', stripe_token: stripe_helper.generate_card_token)
|
37
|
+
ChargeCard.call(sale)
|
38
|
+
expect(sale.reload.fee_amount).to_not be_nil
|
39
|
+
end
|
35
40
|
end
|
36
41
|
|
37
42
|
describe "on error" do
|
@@ -15,6 +15,7 @@ module Payola
|
|
15
15
|
sub = create(:subscription, plan: plan, stripe_customer_id: customer.id, stripe_id: customer.subscriptions.first.id)
|
16
16
|
|
17
17
|
charge = Stripe::Charge.create(amount: 100, currency: 'usd', failure_message: 'Failed! OMG!')
|
18
|
+
expect(Stripe::BalanceTransaction).to receive(:retrieve).and_return(OpenStruct.new( amount: 100, fee: 3.29, currency: 'usd' ))
|
18
19
|
event = StripeMock.mock_webhook_event('invoice.payment_failed', subscription: sub.stripe_id, charge: charge.id)
|
19
20
|
|
20
21
|
count = Payola::Sale.count
|
@@ -35,6 +35,7 @@ module Payola
|
|
35
35
|
sub = create(:subscription, plan: plan, stripe_customer_id: customer.id, stripe_id: customer.subscriptions.first.id)
|
36
36
|
|
37
37
|
charge = Stripe::Charge.create(amount: 100, currency: 'usd')
|
38
|
+
expect(Stripe::BalanceTransaction).to receive(:retrieve).and_return(OpenStruct.new( amount: 100, fee: 3.29, currency: 'usd' ))
|
38
39
|
event = StripeMock.mock_webhook_event('invoice.payment_succeeded', subscription: sub.stripe_id, charge: charge.id)
|
39
40
|
|
40
41
|
count = Payola::Sale.count
|
@@ -69,6 +69,21 @@ module Payola
|
|
69
69
|
expect(subscription2.reload.stripe_customer_id).to eq subscription.reload.stripe_customer_id
|
70
70
|
end
|
71
71
|
|
72
|
+
it "should assign a passed payment source to an existing customer without one" do
|
73
|
+
plan = create(:subscription_plan, amount:0)
|
74
|
+
subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: nil, owner: user)
|
75
|
+
StartSubscription.call(subscription)
|
76
|
+
expect(Stripe::Customer.retrieve(subscription.reload.stripe_customer_id).default_source).to be_nil
|
77
|
+
|
78
|
+
plan2 = create(:subscription_plan)
|
79
|
+
subscription2 = create(:subscription, state: 'processing', plan: plan2, stripe_token: token, owner: user)
|
80
|
+
StartSubscription.call(subscription2)
|
81
|
+
|
82
|
+
stripe_customer_id = subscription2.reload.stripe_customer_id
|
83
|
+
expect(stripe_customer_id).to eq subscription.reload.stripe_customer_id
|
84
|
+
expect(Stripe::Customer.retrieve(stripe_customer_id).default_source).to_not be_nil
|
85
|
+
end
|
86
|
+
|
72
87
|
it "should not re-use an existing customer that has been deleted" do
|
73
88
|
plan = create(:subscription_plan)
|
74
89
|
subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: token, owner: user)
|
data/spec/spec_helper.rb
CHANGED
@@ -15,10 +15,12 @@ end
|
|
15
15
|
ENV["RAILS_ENV"] ||= 'test'
|
16
16
|
require File.expand_path("../dummy/config/environment", __FILE__)
|
17
17
|
require 'rspec/rails'
|
18
|
-
require 'rspec/autorun'
|
19
18
|
require 'factory_girl_rails'
|
20
19
|
require 'stripe_mock'
|
21
20
|
|
21
|
+
ENV['STRIPE_SECRET_KEY'] = 'sk_testing123'
|
22
|
+
ENV['STRIPE_PUBLISHABLE_KEY'] = 'pk_test123'
|
23
|
+
|
22
24
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
23
25
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
24
26
|
# run as spec files by default. This means that files in spec/support that end
|
@@ -26,7 +28,7 @@ require 'stripe_mock'
|
|
26
28
|
# run twice. It is recommended that you do not name files matching this glob to
|
27
29
|
# end with _spec.rb. You can configure this pattern with with the --pattern
|
28
30
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
29
|
-
Dir[Rails.root.join("
|
31
|
+
Dir[Rails.root.join("../support/**/*.rb")].each { |f| require f }
|
30
32
|
|
31
33
|
# Checks for pending migrations before tests are run.
|
32
34
|
# If you are not using ActiveRecord, you can remove this line.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
if Rails::VERSION::MAJOR == 4
|
2
|
+
|
3
|
+
module HTTPMethodsWithKeywordArgs
|
4
|
+
def get(action, params: nil, headers: nil)
|
5
|
+
super(action, params, headers)
|
6
|
+
end
|
7
|
+
|
8
|
+
def post(action, params: nil, headers: nil)
|
9
|
+
super(action, params, headers)
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(action, params: nil, headers: nil)
|
13
|
+
super(action, params, headers)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.include HTTPMethodsWithKeywordArgs, type: :controller
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/spec/worker_spec.rb
CHANGED
@@ -49,7 +49,7 @@ module Payola
|
|
49
49
|
|
50
50
|
describe "#call" do
|
51
51
|
it "should call perform_async" do
|
52
|
-
Payola::Worker::Sidekiq.
|
52
|
+
expect(Payola::Worker::Sidekiq).to receive(:perform_async)
|
53
53
|
Payola::Worker::Sidekiq.call(Payola::TestService, double)
|
54
54
|
end
|
55
55
|
end
|
@@ -88,7 +88,7 @@ module Payola
|
|
88
88
|
|
89
89
|
describe "#call" do
|
90
90
|
it "should call perform_later" do
|
91
|
-
Payola::Worker::ActiveJob.
|
91
|
+
expect(Payola::Worker::ActiveJob).to receive(:perform_later)
|
92
92
|
Payola::Worker::ActiveJob.call(Payola::TestService, double)
|
93
93
|
end
|
94
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payola-payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Keen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: stripe
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.20.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.20.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: stripe-ruby-mock
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.1
|
131
|
+
version: 2.3.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.1
|
138
|
+
version: 2.3.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: sucker_punch
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,9 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- CHANGELOG.md
|
175
|
+
- LICENSE
|
176
|
+
- README.md
|
174
177
|
- Rakefile
|
175
178
|
- app/assets/javascripts/payola.js
|
176
179
|
- app/assets/javascripts/payola/application.js
|
@@ -242,7 +245,7 @@ files:
|
|
242
245
|
- app/views/payola/transactions/new.html.erb
|
243
246
|
- app/views/payola/transactions/show.html.erb
|
244
247
|
- app/views/payola/transactions/wait.html.erb
|
245
|
-
- config/
|
248
|
+
- config/locales/en.yml
|
246
249
|
- config/routes.rb
|
247
250
|
- db/migrate/20141001170138_create_payola_sales.rb
|
248
251
|
- db/migrate/20141001203541_create_payola_stripe_webhooks.rb
|
@@ -264,6 +267,7 @@ files:
|
|
264
267
|
- db/migrate/20141122020755_add_setup_fee_to_payola_subscriptions.rb
|
265
268
|
- db/migrate/20141213205847_add_active_to_payola_coupon.rb
|
266
269
|
- db/migrate/20150930164135_add_tax_percent_to_payola_subscriptions.rb
|
270
|
+
- db/migrate/20151205004838_change_tax_percent_format_in_payola_subscriptions.rb
|
267
271
|
- lib/generators/payola/install_generator.rb
|
268
272
|
- lib/generators/payola/templates/initializer.rb
|
269
273
|
- lib/payola-payments.rb
|
@@ -314,6 +318,12 @@ files:
|
|
314
318
|
- spec/dummy/config/environment.rb
|
315
319
|
- spec/dummy/config/environments/development.rb
|
316
320
|
- spec/dummy/config/environments/production.rb
|
321
|
+
- spec/dummy/config/environments/rails_4/development.rb
|
322
|
+
- spec/dummy/config/environments/rails_4/production.rb
|
323
|
+
- spec/dummy/config/environments/rails_4/test.rb
|
324
|
+
- spec/dummy/config/environments/rails_5/development.rb
|
325
|
+
- spec/dummy/config/environments/rails_5/production.rb
|
326
|
+
- spec/dummy/config/environments/rails_5/test.rb
|
317
327
|
- spec/dummy/config/environments/test.rb
|
318
328
|
- spec/dummy/config/initializers/assets.rb
|
319
329
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
@@ -321,6 +331,7 @@ files:
|
|
321
331
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
322
332
|
- spec/dummy/config/initializers/inflections.rb
|
323
333
|
- spec/dummy/config/initializers/mime_types.rb
|
334
|
+
- spec/dummy/config/initializers/new_framework_defaults.rb
|
324
335
|
- spec/dummy/config/initializers/payola.rb
|
325
336
|
- spec/dummy/config/initializers/session_store.rb
|
326
337
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
@@ -328,6 +339,7 @@ files:
|
|
328
339
|
- spec/dummy/config/locales/en.yml
|
329
340
|
- spec/dummy/config/routes.rb
|
330
341
|
- spec/dummy/config/secrets.yml
|
342
|
+
- spec/dummy/config/spring.rb
|
331
343
|
- spec/dummy/db/development.sqlite3
|
332
344
|
- spec/dummy/db/migrate/20141001230848_create_products.rb
|
333
345
|
- spec/dummy/db/migrate/20141029140518_create_owners.rb
|
@@ -341,6 +353,8 @@ files:
|
|
341
353
|
- spec/dummy/public/404.html
|
342
354
|
- spec/dummy/public/422.html
|
343
355
|
- spec/dummy/public/500.html
|
356
|
+
- spec/dummy/public/apple-touch-icon-precomposed.png
|
357
|
+
- spec/dummy/public/apple-touch-icon.png
|
344
358
|
- spec/dummy/public/favicon.ico
|
345
359
|
- spec/dummy/spec/controllers/buy_controller_spec.rb
|
346
360
|
- spec/dummy/spec/factories/products.rb
|
@@ -439,6 +453,7 @@ files:
|
|
439
453
|
- spec/mailers/payola/admin_mailer_spec.rb
|
440
454
|
- spec/mailers/payola/receipt_mailer_spec.rb
|
441
455
|
- spec/models/payola/coupon_spec.rb
|
456
|
+
- spec/models/payola/env_wrapper_spec.rb
|
442
457
|
- spec/models/payola/sale_spec.rb
|
443
458
|
- spec/models/payola/stripe_webhook_spec.rb
|
444
459
|
- spec/models/payola/subscription_spec.rb
|
@@ -464,14 +479,14 @@ files:
|
|
464
479
|
- spec/services/payola/update_card_spec.rb
|
465
480
|
- spec/services/payola/update_customer_spec.rb
|
466
481
|
- spec/spec_helper.rb
|
482
|
+
- spec/support/http_methods_with_keyword_args.rb
|
483
|
+
- spec/support/params_helper.rb
|
467
484
|
- spec/worker_spec.rb
|
468
485
|
homepage: https://www.payola.io
|
469
486
|
licenses:
|
470
487
|
- LGPL-3.0
|
471
488
|
metadata: {}
|
472
|
-
post_install_message:
|
473
|
-
Payola v1.4.0. See LICENSE and the LGPL-3.0 for licensing details.
|
474
|
-
Upgrade to Payola Pro for more features and support. https://www.payola.io/pro
|
489
|
+
post_install_message:
|
475
490
|
rdoc_options: []
|
476
491
|
require_paths:
|
477
492
|
- lib
|
@@ -487,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
487
502
|
version: '0'
|
488
503
|
requirements: []
|
489
504
|
rubyforge_project:
|
490
|
-
rubygems_version: 2.
|
505
|
+
rubygems_version: 2.5.1
|
491
506
|
signing_key:
|
492
507
|
specification_version: 4
|
493
508
|
summary: Drop-in Rails engine for accepting payments with Stripe
|
@@ -527,6 +542,12 @@ test_files:
|
|
527
542
|
- spec/dummy/config/environment.rb
|
528
543
|
- spec/dummy/config/environments/development.rb
|
529
544
|
- spec/dummy/config/environments/production.rb
|
545
|
+
- spec/dummy/config/environments/rails_4/development.rb
|
546
|
+
- spec/dummy/config/environments/rails_4/production.rb
|
547
|
+
- spec/dummy/config/environments/rails_4/test.rb
|
548
|
+
- spec/dummy/config/environments/rails_5/development.rb
|
549
|
+
- spec/dummy/config/environments/rails_5/production.rb
|
550
|
+
- spec/dummy/config/environments/rails_5/test.rb
|
530
551
|
- spec/dummy/config/environments/test.rb
|
531
552
|
- spec/dummy/config/initializers/assets.rb
|
532
553
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
@@ -534,6 +555,7 @@ test_files:
|
|
534
555
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
535
556
|
- spec/dummy/config/initializers/inflections.rb
|
536
557
|
- spec/dummy/config/initializers/mime_types.rb
|
558
|
+
- spec/dummy/config/initializers/new_framework_defaults.rb
|
537
559
|
- spec/dummy/config/initializers/payola.rb
|
538
560
|
- spec/dummy/config/initializers/session_store.rb
|
539
561
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
@@ -541,6 +563,7 @@ test_files:
|
|
541
563
|
- spec/dummy/config/locales/en.yml
|
542
564
|
- spec/dummy/config/routes.rb
|
543
565
|
- spec/dummy/config/secrets.yml
|
566
|
+
- spec/dummy/config/spring.rb
|
544
567
|
- spec/dummy/config.ru
|
545
568
|
- spec/dummy/db/development.sqlite3
|
546
569
|
- spec/dummy/db/migrate/20141001230848_create_products.rb
|
@@ -555,6 +578,8 @@ test_files:
|
|
555
578
|
- spec/dummy/public/404.html
|
556
579
|
- spec/dummy/public/422.html
|
557
580
|
- spec/dummy/public/500.html
|
581
|
+
- spec/dummy/public/apple-touch-icon-precomposed.png
|
582
|
+
- spec/dummy/public/apple-touch-icon.png
|
558
583
|
- spec/dummy/public/favicon.ico
|
559
584
|
- spec/dummy/Rakefile
|
560
585
|
- spec/dummy/README.rdoc
|
@@ -655,6 +680,7 @@ test_files:
|
|
655
680
|
- spec/mailers/payola/admin_mailer_spec.rb
|
656
681
|
- spec/mailers/payola/receipt_mailer_spec.rb
|
657
682
|
- spec/models/payola/coupon_spec.rb
|
683
|
+
- spec/models/payola/env_wrapper_spec.rb
|
658
684
|
- spec/models/payola/sale_spec.rb
|
659
685
|
- spec/models/payola/stripe_webhook_spec.rb
|
660
686
|
- spec/models/payola/subscription_spec.rb
|
@@ -680,4 +706,6 @@ test_files:
|
|
680
706
|
- spec/services/payola/update_card_spec.rb
|
681
707
|
- spec/services/payola/update_customer_spec.rb
|
682
708
|
- spec/spec_helper.rb
|
709
|
+
- spec/support/http_methods_with_keyword_args.rb
|
710
|
+
- spec/support/params_helper.rb
|
683
711
|
- spec/worker_spec.rb
|