payola-payments 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/payola/checkout_button.js +9 -5
  3. data/app/assets/javascripts/payola/form.js +10 -4
  4. data/app/assets/javascripts/payola/subscription_checkout_button.js +41 -24
  5. data/app/assets/javascripts/payola/subscription_form_onestep.js +13 -6
  6. data/app/assets/javascripts/payola/subscription_form_register.js +97 -0
  7. data/app/assets/javascripts/payola/subscription_form_twostep.js +14 -7
  8. data/app/controllers/payola/cards_controller.rb +40 -0
  9. data/app/controllers/payola/customers_controller.rb +37 -0
  10. data/app/controllers/payola/subscriptions_controller.rb +1 -1
  11. data/app/models/concerns/payola/plan.rb +1 -1
  12. data/app/models/payola/subscription.rb +15 -1
  13. data/app/services/payola/cancel_subscription.rb +6 -3
  14. data/app/services/payola/change_subscription_plan.rb +15 -7
  15. data/app/services/payola/create_card.rb +13 -0
  16. data/app/services/payola/create_subscription.rb +14 -6
  17. data/app/services/payola/destroy_card.rb +9 -0
  18. data/app/services/payola/process_refund.rb +20 -0
  19. data/app/services/payola/start_subscription.rb +30 -15
  20. data/app/services/payola/subscription_deleted.rb +11 -0
  21. data/app/services/payola/update_customer.rb +9 -0
  22. data/app/views/payola/subscriptions/_cancel.html.erb +2 -0
  23. data/app/views/payola/subscriptions/_checkout.html.erb +13 -4
  24. data/app/views/payola/transactions/_form.html.erb +1 -1
  25. data/config/routes.rb +8 -3
  26. data/db/migrate/20150930164135_add_tax_percent_to_payola_subscriptions.rb +5 -0
  27. data/lib/generators/payola/templates/initializer.rb +1 -1
  28. data/lib/payola.rb +5 -1
  29. data/lib/payola/engine.rb +1 -0
  30. data/lib/payola/version.rb +1 -1
  31. data/spec/concerns/plan_spec.rb +34 -11
  32. data/spec/controllers/payola/cards_controller_spec.rb +78 -0
  33. data/spec/controllers/payola/customers_controller_spec.rb +41 -0
  34. data/spec/controllers/payola/subscriptions_controller_spec.rb +14 -5
  35. data/spec/dummy/db/schema.rb +8 -7
  36. data/spec/dummy/db/test.sqlite3 +0 -0
  37. data/spec/dummy/log/development.log +83 -0
  38. data/spec/dummy/log/test.log +15285 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/05-CimMmYqCyJHDw0mlYlY8QTYNZWxvvjXNzt99raT8.cache +1 -0
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/0cwo25M79KGYxnM1Fn5aVXuB5Vx5NXDeI1mauCHJ6C0.cache +1 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1RezgAqI3WpLjtCkf15A28C_C_ZggGaTUJVj_0OtZt0.cache +2 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1sN5oeTaBcGDHbdpHx7u12CUoshmGO0a8n6wvOZ8e9g.cache +2 -0
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4Huwm41yGPbqU_ktIlyb9x7zWCBrETs8Hi1vod_h6CM.cache +0 -0
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6GYiGbi_eHKrkW4pmMOQc-YcJd5yjqypkSSVsmvLdGQ.cache +2 -0
  45. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6jBC_ionlG5SaNmx7QnmYyHapApzfD7gO7iacmF7A-o.cache +0 -0
  46. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8PuswVUdqRS0_2AjXzB3SJnp0T6R4XDd52aXU8HUb20.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/93_-tHqt48795qdk0JqDUZvfu8txM-kzSbHHwUHfUg4.cache +2 -0
  48. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BJ9VCB2p3PpqouoGa_QmkGjFv4aPZWzCCDiFpknRFCA.cache +0 -0
  49. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Cvp1E8cK9iR8ZIyJng_CyOI5-lFm_PpQuqJpfpdsFJQ.cache +1 -0
  50. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/D3ZSFffpWANPSAj2gTmelfr4w-KkX84C0EgyPOy6Y6o.cache +0 -0
  51. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/DBdvUpmp3qMac1HkOn7D-0WoON1Vn4n0VkmcBo9PYTE.cache +1 -0
  52. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EM3Tna1A9GSD2IeCpTZmuINPPHpdTXPbCG6sbLXHKPI.cache +1 -0
  53. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FJ2Xe7ZXhQCx8O6gziOCZXLYIMDdWQElTtXlygmzDP0.cache +0 -0
  54. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GDXP5hnN5ycGmMuaWltb9AFtcEBq7WXRfWTLjBgSK8I.cache +1 -0
  55. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GFxndLm-jxLvxsJ4aUJ54BUZ32Ypzp7mLCmArWCOIa4.cache +1 -0
  56. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GJmK02s0v61jK_BI__yUZI7NpGUVtXfur9ZiQGwOYyU.cache +0 -0
  57. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrKh1ye7y3UHd5ox4OgIUhcXyLvEN5FWvs6v7CzqFWI.cache +3 -0
  58. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nl0Imk9BLfXqZ83k4_-tB2g0aevktUZocldLZzEE8DM.cache +0 -0
  59. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nz8cUs5LShWxHeARb_8KNPjYZGYN8tCqWa2OoovieYg.cache +1 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/OWrok24obbylOHeAaps9WA5SBwjpaEd0xnQqBWOc-mQ.cache +2 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QVhitoXuP03xtsfQo4gH_mAw16dk1EPH7Xf8JlXVLpk.cache +1 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QrIfBX9SocQINdKbcOGU2ZplYq_3lE7-CgPvvFRZUPs.cache +3 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RSFirXKeTuMV9nWIeu-30jvOMVQTdZQUugyREItprkE.cache +1 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S5giqzoBdK-jXI6AoAelpiCYhMTwMFNaxjUJj816KdM.cache +2 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Se3LTfrl02BuX--hLV7cqyaPT9b9ydVPYsWlXjSvQ6Q.cache +1 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/SwyH6o1ZPaOTMGyVqMXuWtYuyf9yBl0NRSVjvv2HQGo.cache +1 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/T8VFzmrZkpfAHu4YyuwEfZWPF3sv77n7comxiwI6yK4.cache +1 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Te0Swu57VjhvpFOJV5fIm9X9C-tiyuF486pgN6gWuvs.cache +2 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TolX3hiRfWiUWMlwHiH5G7KZZuFKPV2geKgORhx1kbc.cache +1 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/W5-aJJXrwJHHZ2LUNvSZJDuDWnf-nXHn_RrdHm8Dsy4.cache +1 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WwYeCgq1wE5ouj5QoNsFDYa_K0Hw5SNPPPyzZ9JRk_M.cache +1 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WxGjqpQ1GofgXtH2VW51hBdHzehHiH9QQSzeFwvPa04.cache +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/X-OoOAyH7movCISCvhiawWmwCODe3fN7ymRIQEQJGWs.cache +1 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YUqxvOCuXaKKNVrkC0BmaxSs-ae8k61lE-cXvNvp6ts.cache +2 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ald4YZEKpA5mAmBUBRLwntPH1BB--dukFx4hRB1G8Sc.cache +2 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/coggheKLeRswSaNoMMz-DG4eSncE1LfiKd6ebpHdcDQ.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ctvwDGAdKE_Nmp-gIQsb4edj11gnDV2HvIb4f_hTr1A.cache +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d1MBBmJw2iL1O_NLFnwSRJlDR2VB-Au8nckF0HcpAjU.cache +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/fQIfzJDoR7LlNPN5nxZ-wlReF7b9zJ71zPnU-mwz0tU.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/if00l9X27C69IaQ5LW33GQ76AK8TNTK2x_mAtUBiK_Y.cache +2 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mFdDv_nbtZKHUux_oAK4OmPBu8TJ62BtWnklHAw52lk.cache +1 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nGRK5RyFWrQfZM7AqkyVNDZrMJny5SvIThqdcSaF7s4.cache +1 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nxuLyls6X-Txo4fYUEBKChRSnonW6fR3e3hy60jNKDk.cache +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/o8Pe3_OPNi7cpOIjfFsLK0KP_hLNPoR0eO61oXCo40Q.cache +2 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/oiIb0gmeFbc8wNdBNqzP6QepH1VG7L6rOwt7JRjLF6Y.cache +1 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/os-IBWzcQaIeJAr-eZ0ISapp8u6ViHJBDVl3zsSnAxs.cache +1 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/p8-Esy85oOHbF8SlC_ADEPGi7AjMurnoYSdCD3V0QHo.cache +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rDG6NUIkefVSkt66sViHIj-M-YmUVD3LC383yOQZE3Y.cache +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rT-10_0UmPqfTi7e_RvVV2oVVrZPcnzEVxYryWf0AWk.cache +1 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rgRsqTnAPvMJlyOn2tOMsfX1YNwqiKZprIoYnBtUIao.cache +2 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tZkY3_ZombuoVZpSwY2dfvHcyD88nyqaNHLzVfrlSbA.cache +1 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/v8-7s6wdUoobgWtvSQPJYtNsLoojslrMGambhfCbLBo.cache +2 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xAmLB93l5rnHnPfuqo_rdVoCN4PRE5-22KU8O3LNn5U.cache +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xFmik7WLB1nL3qhSnRWbIEXIwMG1K_dLc1ymZ3hNJ_8.cache +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/z5DZtajWt8UQUvtzye6ncruhskjV7HVUOKWv800kzrE.cache +2 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zPJ93ju23hj65NVsVWOgNlvHe3OjA-SGQ9nU2oupKlI.cache +2 -0
  97. data/spec/factories/payola_subscriptions.rb +2 -3
  98. data/spec/models/payola/subscription_spec.rb +35 -1
  99. data/spec/payola_spec.rb +7 -0
  100. data/spec/services/payola/change_subscription_plan_spec.rb +70 -7
  101. data/spec/services/payola/create_card_spec.rb +42 -0
  102. data/spec/services/payola/create_subscription_spec.rb +12 -10
  103. data/spec/services/payola/destroy_card_spec.rb +28 -0
  104. data/spec/services/payola/process_refund_spec.rb +35 -0
  105. data/spec/services/payola/start_subscription_spec.rb +27 -3
  106. data/spec/services/payola/subscription_deleted_spec.rb +11 -0
  107. data/spec/services/payola/update_customer_spec.rb +26 -0
  108. metadata +142 -6
  109. data/app/services/payola/#update_card.rb# +0 -27
  110. data/spec/services/payola/#start_subscription_spec.rb# +0 -95
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module Payola
4
+ describe DestroyCard do
5
+ let(:stripe_helper) { StripeMock.create_test_helper }
6
+
7
+ let(:customer) {
8
+ Stripe::Customer.create({
9
+ email: 'johnny@appleseed.com',
10
+ source: stripe_helper.generate_card_token
11
+ })
12
+ }
13
+
14
+ describe "#call" do
15
+ it "creates the new card" do
16
+ Payola.secret_key = 'sk_test_12345'
17
+
18
+ card_id = customer.sources.first.id
19
+
20
+ expect{Payola::DestroyCard.call(card_id, customer.id)}.to_not raise_error
21
+ updated_customer = Stripe::Customer.retrieve(customer.id, Payola.secret_key)
22
+ expect(updated_customer.sources.count).to eq(0)
23
+ expect(updated_customer.default_source).to eq(nil)
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ module Payola
4
+ describe ProcessRefund do
5
+ describe "#call" do
6
+ before :each do
7
+ Payola.secret_key = 'sk_test_12345'
8
+ end
9
+
10
+ it "should refund the sale" do
11
+ charge = Stripe::Charge.create({
12
+ :amount => 40,
13
+ :currency => "usd",
14
+ :source => StripeMock.generate_card_token({}),
15
+ })
16
+
17
+ sale = create(:sale, stripe_id: charge.id, amount: charge.amount, state: :finished)
18
+
19
+ expect(Payola::Sale).to receive(:find_by).with(guid: sale.guid).and_return(sale)
20
+ Payola::ProcessRefund.call(sale.guid)
21
+ expect(sale.reload.refunded?).to eq(true)
22
+ end
23
+
24
+ it "should not refund the sale if an error occurs" do
25
+ sale = create(:sale, stripe_id: "this doesn't exist", amount: "10", state: :finished)
26
+
27
+ expect(Payola::Sale).to receive(:find_by).with(guid: sale.guid).and_return(sale)
28
+ returned_sale = Payola::ProcessRefund.call(sale.guid)
29
+ expect(returned_sale.errors.any?).to eq(true)
30
+ expect(sale.reload.refunded?).to eq(false)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -13,6 +13,12 @@ module Payola
13
13
  StartSubscription.call(subscription)
14
14
  expect(subscription.reload.stripe_customer_id).to_not be_nil
15
15
  end
16
+ it "should create a customer with free plan without stripe_token" do
17
+ plan = create(:subscription_plan, amount:0)
18
+ subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: nil)
19
+ StartSubscription.call(subscription)
20
+ expect(subscription.reload.stripe_customer_id).to_not be_nil
21
+ end
16
22
  it "should capture credit card info" do
17
23
  plan = create(:subscription_plan)
18
24
  subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: token)
@@ -33,6 +39,24 @@ module Payola
33
39
  end
34
40
  end
35
41
 
42
+ it "should re-use an explicitly specified customer" do
43
+ plan = create(:subscription_plan)
44
+ stripe_customer = Stripe::Customer.create
45
+ subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: nil, stripe_customer_id: stripe_customer.id)
46
+ expect(Stripe::Customer).to_not receive(:create)
47
+ StartSubscription.call(subscription)
48
+ end
49
+
50
+ it "should fail if the explicitly specified customer has been deleted" do
51
+ plan = create(:subscription_plan)
52
+ stripe_customer = Stripe::Customer.create
53
+ stripe_customer.delete
54
+ subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: nil, stripe_customer_id: stripe_customer.id)
55
+ expect(subscription).to receive(:fail!)
56
+ StartSubscription.call(subscription)
57
+ expect(subscription.reload.error).to eq "stripeToken required for new customer with paid subscription"
58
+ end
59
+
36
60
  it "should re-use an existing customer" do
37
61
  plan = create(:subscription_plan)
38
62
  subscription = create(:subscription, state: 'processing', plan: plan, stripe_token: token, owner: user)
@@ -52,10 +76,10 @@ module Payola
52
76
  deleted_customer_id = subscription.reload.stripe_customer_id
53
77
  Stripe::Customer.retrieve(deleted_customer_id).delete
54
78
 
55
- subscription2 = create(:subscription, state: 'processing', plan: plan, owner: user)
79
+ subscription2 = create(:subscription, state: 'processing', plan: plan, stripe_token: nil, owner: user)
80
+ expect(subscription2).to receive(:fail!)
56
81
  StartSubscription.call(subscription2)
57
- expect(subscription2.reload.stripe_customer_id).to_not be_nil
58
- expect(subscription2.reload.stripe_customer_id).to_not eq deleted_customer_id
82
+ expect(subscription2.reload.error).to eq "stripeToken required for new customer with paid subscription"
59
83
  end
60
84
 
61
85
  it "should create an invoice item with a setup fee" do
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ module Payola
4
+ describe SubscriptionDeleted do
5
+ it "should cancel the subscription that was deleted" do
6
+ sub = create(:subscription, state: 'active')
7
+ event = StripeMock.mock_webhook_event('customer.subscription.deleted', id: sub.stripe_id)
8
+ expect { Payola::SubscriptionDeleted.call(event) }.to change { sub.reload.state }.from('active').to('canceled')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ module Payola
4
+ describe UpdateCustomer do
5
+ let(:stripe_helper) { StripeMock.create_test_helper }
6
+
7
+ let(:customer) {
8
+ Stripe::Customer.create({
9
+ email: 'johnny@appleseed.com',
10
+ card: stripe_helper.generate_card_token({last4: '2233', exp_year: '2021', exp_month: '11', brand: 'JCB'})
11
+ })
12
+ }
13
+
14
+ describe "#call" do
15
+ it "updates the customer" do
16
+ Payola.secret_key = 'sk_test_12345'
17
+
18
+ options = { default_source: "1234" }
19
+ expect{Payola::UpdateCustomer.call(customer.id, options)}.to_not raise_error
20
+ updated_customer = Stripe::Customer.retrieve(customer.id, Payola.secret_key)
21
+ expect(updated_customer.default_source).to eq "1234"
22
+ end
23
+
24
+ end
25
+ end
26
+ 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.3.2
4
+ version: 1.4.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: 2015-05-18 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,12 +178,15 @@ files:
178
178
  - app/assets/javascripts/payola/form.js
179
179
  - app/assets/javascripts/payola/subscription_checkout_button.js
180
180
  - app/assets/javascripts/payola/subscription_form_onestep.js
181
+ - app/assets/javascripts/payola/subscription_form_register.js
181
182
  - app/assets/javascripts/payola/subscription_form_twostep.js
182
183
  - app/assets/stylesheets/payola/application.css
183
184
  - app/controllers/concerns/payola/affiliate_behavior.rb
184
185
  - app/controllers/concerns/payola/async_behavior.rb
185
186
  - app/controllers/concerns/payola/status_behavior.rb
186
187
  - app/controllers/payola/application_controller.rb
188
+ - app/controllers/payola/cards_controller.rb
189
+ - app/controllers/payola/customers_controller.rb
187
190
  - app/controllers/payola/subscriptions_controller.rb
188
191
  - app/controllers/payola/transactions_controller.rb
189
192
  - app/helpers/payola/application_helper.rb
@@ -198,23 +201,27 @@ files:
198
201
  - app/models/payola/sale.rb
199
202
  - app/models/payola/stripe_webhook.rb
200
203
  - app/models/payola/subscription.rb
201
- - app/services/payola/#update_card.rb#
202
204
  - app/services/payola/cancel_subscription.rb
203
205
  - app/services/payola/change_subscription_plan.rb
204
206
  - app/services/payola/change_subscription_quantity.rb
205
207
  - app/services/payola/charge_card.rb
208
+ - app/services/payola/create_card.rb
206
209
  - app/services/payola/create_plan.rb
207
210
  - app/services/payola/create_sale.rb
208
211
  - app/services/payola/create_subscription.rb
212
+ - app/services/payola/destroy_card.rb
209
213
  - app/services/payola/invoice_behavior.rb
210
214
  - app/services/payola/invoice_failed.rb
211
215
  - app/services/payola/invoice_paid.rb
216
+ - app/services/payola/process_refund.rb
212
217
  - app/services/payola/process_sale.rb
213
218
  - app/services/payola/process_subscription.rb
214
219
  - app/services/payola/send_mail.rb
215
220
  - app/services/payola/start_subscription.rb
221
+ - app/services/payola/subscription_deleted.rb
216
222
  - app/services/payola/sync_subscription.rb
217
223
  - app/services/payola/update_card.rb
224
+ - app/services/payola/update_customer.rb
218
225
  - app/services/payola/update_subscription.rb
219
226
  - app/views/layouts/payola/application.html.erb
220
227
  - app/views/payola/admin_mailer/dispute.html.erb
@@ -256,6 +263,7 @@ files:
256
263
  - db/migrate/20141114163841_add_addresses_to_payola_subscription.rb
257
264
  - db/migrate/20141122020755_add_setup_fee_to_payola_subscriptions.rb
258
265
  - db/migrate/20141213205847_add_active_to_payola_coupon.rb
266
+ - db/migrate/20150930164135_add_tax_percent_to_payola_subscriptions.rb
259
267
  - lib/generators/payola/install_generator.rb
260
268
  - lib/generators/payola/templates/initializer.rb
261
269
  - lib/payola-payments.rb
@@ -270,6 +278,8 @@ files:
270
278
  - lib/tasks/payola_tasks.rake
271
279
  - spec/concerns/plan_spec.rb
272
280
  - spec/concerns/sellable_spec.rb
281
+ - spec/controllers/payola/cards_controller_spec.rb
282
+ - spec/controllers/payola/customers_controller_spec.rb
273
283
  - spec/controllers/payola/subscriptions_controller_spec.rb
274
284
  - spec/controllers/payola/transactions_controller_spec.rb
275
285
  - spec/dummy/README.rdoc
@@ -361,6 +371,64 @@ files:
361
371
  - spec/dummy/tmp/cache/assets/development/sprockets/ef82c31948061751bb026663b54484e1
362
372
  - spec/dummy/tmp/cache/assets/development/sprockets/f0b5d4bea0c6cdd1904e1e9a0a45532f
363
373
  - spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
374
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/05-CimMmYqCyJHDw0mlYlY8QTYNZWxvvjXNzt99raT8.cache
375
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/0cwo25M79KGYxnM1Fn5aVXuB5Vx5NXDeI1mauCHJ6C0.cache
376
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1RezgAqI3WpLjtCkf15A28C_C_ZggGaTUJVj_0OtZt0.cache
377
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1sN5oeTaBcGDHbdpHx7u12CUoshmGO0a8n6wvOZ8e9g.cache
378
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4Huwm41yGPbqU_ktIlyb9x7zWCBrETs8Hi1vod_h6CM.cache
379
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6GYiGbi_eHKrkW4pmMOQc-YcJd5yjqypkSSVsmvLdGQ.cache
380
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6jBC_ionlG5SaNmx7QnmYyHapApzfD7gO7iacmF7A-o.cache
381
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8PuswVUdqRS0_2AjXzB3SJnp0T6R4XDd52aXU8HUb20.cache
382
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/93_-tHqt48795qdk0JqDUZvfu8txM-kzSbHHwUHfUg4.cache
383
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BJ9VCB2p3PpqouoGa_QmkGjFv4aPZWzCCDiFpknRFCA.cache
384
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Cvp1E8cK9iR8ZIyJng_CyOI5-lFm_PpQuqJpfpdsFJQ.cache
385
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/D3ZSFffpWANPSAj2gTmelfr4w-KkX84C0EgyPOy6Y6o.cache
386
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/DBdvUpmp3qMac1HkOn7D-0WoON1Vn4n0VkmcBo9PYTE.cache
387
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EM3Tna1A9GSD2IeCpTZmuINPPHpdTXPbCG6sbLXHKPI.cache
388
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FJ2Xe7ZXhQCx8O6gziOCZXLYIMDdWQElTtXlygmzDP0.cache
389
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GDXP5hnN5ycGmMuaWltb9AFtcEBq7WXRfWTLjBgSK8I.cache
390
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GFxndLm-jxLvxsJ4aUJ54BUZ32Ypzp7mLCmArWCOIa4.cache
391
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GJmK02s0v61jK_BI__yUZI7NpGUVtXfur9ZiQGwOYyU.cache
392
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrKh1ye7y3UHd5ox4OgIUhcXyLvEN5FWvs6v7CzqFWI.cache
393
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nl0Imk9BLfXqZ83k4_-tB2g0aevktUZocldLZzEE8DM.cache
394
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nz8cUs5LShWxHeARb_8KNPjYZGYN8tCqWa2OoovieYg.cache
395
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/OWrok24obbylOHeAaps9WA5SBwjpaEd0xnQqBWOc-mQ.cache
396
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QVhitoXuP03xtsfQo4gH_mAw16dk1EPH7Xf8JlXVLpk.cache
397
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QrIfBX9SocQINdKbcOGU2ZplYq_3lE7-CgPvvFRZUPs.cache
398
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RSFirXKeTuMV9nWIeu-30jvOMVQTdZQUugyREItprkE.cache
399
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S5giqzoBdK-jXI6AoAelpiCYhMTwMFNaxjUJj816KdM.cache
400
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Se3LTfrl02BuX--hLV7cqyaPT9b9ydVPYsWlXjSvQ6Q.cache
401
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/SwyH6o1ZPaOTMGyVqMXuWtYuyf9yBl0NRSVjvv2HQGo.cache
402
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/T8VFzmrZkpfAHu4YyuwEfZWPF3sv77n7comxiwI6yK4.cache
403
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Te0Swu57VjhvpFOJV5fIm9X9C-tiyuF486pgN6gWuvs.cache
404
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TolX3hiRfWiUWMlwHiH5G7KZZuFKPV2geKgORhx1kbc.cache
405
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/W5-aJJXrwJHHZ2LUNvSZJDuDWnf-nXHn_RrdHm8Dsy4.cache
406
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WwYeCgq1wE5ouj5QoNsFDYa_K0Hw5SNPPPyzZ9JRk_M.cache
407
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WxGjqpQ1GofgXtH2VW51hBdHzehHiH9QQSzeFwvPa04.cache
408
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/X-OoOAyH7movCISCvhiawWmwCODe3fN7ymRIQEQJGWs.cache
409
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YUqxvOCuXaKKNVrkC0BmaxSs-ae8k61lE-cXvNvp6ts.cache
410
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ald4YZEKpA5mAmBUBRLwntPH1BB--dukFx4hRB1G8Sc.cache
411
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/coggheKLeRswSaNoMMz-DG4eSncE1LfiKd6ebpHdcDQ.cache
412
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ctvwDGAdKE_Nmp-gIQsb4edj11gnDV2HvIb4f_hTr1A.cache
413
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d1MBBmJw2iL1O_NLFnwSRJlDR2VB-Au8nckF0HcpAjU.cache
414
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/fQIfzJDoR7LlNPN5nxZ-wlReF7b9zJ71zPnU-mwz0tU.cache
415
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/if00l9X27C69IaQ5LW33GQ76AK8TNTK2x_mAtUBiK_Y.cache
416
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mFdDv_nbtZKHUux_oAK4OmPBu8TJ62BtWnklHAw52lk.cache
417
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nGRK5RyFWrQfZM7AqkyVNDZrMJny5SvIThqdcSaF7s4.cache
418
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nxuLyls6X-Txo4fYUEBKChRSnonW6fR3e3hy60jNKDk.cache
419
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/o8Pe3_OPNi7cpOIjfFsLK0KP_hLNPoR0eO61oXCo40Q.cache
420
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/oiIb0gmeFbc8wNdBNqzP6QepH1VG7L6rOwt7JRjLF6Y.cache
421
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/os-IBWzcQaIeJAr-eZ0ISapp8u6ViHJBDVl3zsSnAxs.cache
422
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/p8-Esy85oOHbF8SlC_ADEPGi7AjMurnoYSdCD3V0QHo.cache
423
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rDG6NUIkefVSkt66sViHIj-M-YmUVD3LC383yOQZE3Y.cache
424
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rT-10_0UmPqfTi7e_RvVV2oVVrZPcnzEVxYryWf0AWk.cache
425
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rgRsqTnAPvMJlyOn2tOMsfX1YNwqiKZprIoYnBtUIao.cache
426
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tZkY3_ZombuoVZpSwY2dfvHcyD88nyqaNHLzVfrlSbA.cache
427
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/v8-7s6wdUoobgWtvSQPJYtNsLoojslrMGambhfCbLBo.cache
428
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xAmLB93l5rnHnPfuqo_rdVoCN4PRE5-22KU8O3LNn5U.cache
429
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xFmik7WLB1nL3qhSnRWbIEXIwMG1K_dLc1ymZ3hNJ_8.cache
430
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/z5DZtajWt8UQUvtzye6ncruhskjV7HVUOKWv800kzrE.cache
431
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zPJ93ju23hj65NVsVWOgNlvHe3OjA-SGQ9nU2oupKlI.cache
364
432
  - spec/factories/payola_affiliates.rb
365
433
  - spec/factories/payola_coupons.rb
366
434
  - spec/factories/payola_subscriptions.rb
@@ -375,22 +443,26 @@ files:
375
443
  - spec/models/payola/stripe_webhook_spec.rb
376
444
  - spec/models/payola/subscription_spec.rb
377
445
  - spec/payola_spec.rb
378
- - spec/services/payola/#start_subscription_spec.rb#
379
446
  - spec/services/payola/cancel_subscription_spec.rb
380
447
  - spec/services/payola/change_subscription_plan_spec.rb
381
448
  - spec/services/payola/change_subscription_quantity_spec.rb
382
449
  - spec/services/payola/charge_card_spec.rb
450
+ - spec/services/payola/create_card_spec.rb
383
451
  - spec/services/payola/create_plan_spec.rb
384
452
  - spec/services/payola/create_sale_spec.rb
385
453
  - spec/services/payola/create_subscription_spec.rb
454
+ - spec/services/payola/destroy_card_spec.rb
386
455
  - spec/services/payola/invoice_failed_spec.rb
387
456
  - spec/services/payola/invoice_paid_spec.rb
457
+ - spec/services/payola/process_refund_spec.rb
388
458
  - spec/services/payola/process_sale_spec.rb
389
459
  - spec/services/payola/process_subscription_spec.rb
390
460
  - spec/services/payola/send_mail_spec.rb
391
461
  - spec/services/payola/start_subscription_spec.rb
462
+ - spec/services/payola/subscription_deleted_spec.rb
392
463
  - spec/services/payola/sync_subscription_spec.rb
393
464
  - spec/services/payola/update_card_spec.rb
465
+ - spec/services/payola/update_customer_spec.rb
394
466
  - spec/spec_helper.rb
395
467
  - spec/worker_spec.rb
396
468
  homepage: https://www.payola.io
@@ -398,7 +470,7 @@ licenses:
398
470
  - LGPL-3.0
399
471
  metadata: {}
400
472
  post_install_message: |
401
- Payola v1.3.2. See LICENSE and the LGPL-3.0 for licensing details.
473
+ Payola v1.4.0. See LICENSE and the LGPL-3.0 for licensing details.
402
474
  Upgrade to Payola Pro for more features and support. https://www.payola.io/pro
403
475
  rdoc_options: []
404
476
  require_paths:
@@ -422,6 +494,8 @@ summary: Drop-in Rails engine for accepting payments with Stripe
422
494
  test_files:
423
495
  - spec/concerns/plan_spec.rb
424
496
  - spec/concerns/sellable_spec.rb
497
+ - spec/controllers/payola/cards_controller_spec.rb
498
+ - spec/controllers/payola/customers_controller_spec.rb
425
499
  - spec/controllers/payola/subscriptions_controller_spec.rb
426
500
  - spec/controllers/payola/transactions_controller_spec.rb
427
501
  - spec/dummy/app/assets/javascripts/application.js
@@ -513,6 +587,64 @@ test_files:
513
587
  - spec/dummy/tmp/cache/assets/development/sprockets/ef82c31948061751bb026663b54484e1
514
588
  - spec/dummy/tmp/cache/assets/development/sprockets/f0b5d4bea0c6cdd1904e1e9a0a45532f
515
589
  - spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
590
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/05-CimMmYqCyJHDw0mlYlY8QTYNZWxvvjXNzt99raT8.cache
591
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/0cwo25M79KGYxnM1Fn5aVXuB5Vx5NXDeI1mauCHJ6C0.cache
592
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1RezgAqI3WpLjtCkf15A28C_C_ZggGaTUJVj_0OtZt0.cache
593
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1sN5oeTaBcGDHbdpHx7u12CUoshmGO0a8n6wvOZ8e9g.cache
594
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4Huwm41yGPbqU_ktIlyb9x7zWCBrETs8Hi1vod_h6CM.cache
595
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6GYiGbi_eHKrkW4pmMOQc-YcJd5yjqypkSSVsmvLdGQ.cache
596
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6jBC_ionlG5SaNmx7QnmYyHapApzfD7gO7iacmF7A-o.cache
597
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8PuswVUdqRS0_2AjXzB3SJnp0T6R4XDd52aXU8HUb20.cache
598
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/93_-tHqt48795qdk0JqDUZvfu8txM-kzSbHHwUHfUg4.cache
599
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ald4YZEKpA5mAmBUBRLwntPH1BB--dukFx4hRB1G8Sc.cache
600
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BJ9VCB2p3PpqouoGa_QmkGjFv4aPZWzCCDiFpknRFCA.cache
601
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/coggheKLeRswSaNoMMz-DG4eSncE1LfiKd6ebpHdcDQ.cache
602
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ctvwDGAdKE_Nmp-gIQsb4edj11gnDV2HvIb4f_hTr1A.cache
603
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Cvp1E8cK9iR8ZIyJng_CyOI5-lFm_PpQuqJpfpdsFJQ.cache
604
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d1MBBmJw2iL1O_NLFnwSRJlDR2VB-Au8nckF0HcpAjU.cache
605
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/D3ZSFffpWANPSAj2gTmelfr4w-KkX84C0EgyPOy6Y6o.cache
606
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/DBdvUpmp3qMac1HkOn7D-0WoON1Vn4n0VkmcBo9PYTE.cache
607
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EM3Tna1A9GSD2IeCpTZmuINPPHpdTXPbCG6sbLXHKPI.cache
608
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FJ2Xe7ZXhQCx8O6gziOCZXLYIMDdWQElTtXlygmzDP0.cache
609
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/fQIfzJDoR7LlNPN5nxZ-wlReF7b9zJ71zPnU-mwz0tU.cache
610
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GDXP5hnN5ycGmMuaWltb9AFtcEBq7WXRfWTLjBgSK8I.cache
611
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GFxndLm-jxLvxsJ4aUJ54BUZ32Ypzp7mLCmArWCOIa4.cache
612
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GJmK02s0v61jK_BI__yUZI7NpGUVtXfur9ZiQGwOYyU.cache
613
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/if00l9X27C69IaQ5LW33GQ76AK8TNTK2x_mAtUBiK_Y.cache
614
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mFdDv_nbtZKHUux_oAK4OmPBu8TJ62BtWnklHAw52lk.cache
615
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrKh1ye7y3UHd5ox4OgIUhcXyLvEN5FWvs6v7CzqFWI.cache
616
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nGRK5RyFWrQfZM7AqkyVNDZrMJny5SvIThqdcSaF7s4.cache
617
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nl0Imk9BLfXqZ83k4_-tB2g0aevktUZocldLZzEE8DM.cache
618
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nxuLyls6X-Txo4fYUEBKChRSnonW6fR3e3hy60jNKDk.cache
619
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Nz8cUs5LShWxHeARb_8KNPjYZGYN8tCqWa2OoovieYg.cache
620
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/o8Pe3_OPNi7cpOIjfFsLK0KP_hLNPoR0eO61oXCo40Q.cache
621
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/oiIb0gmeFbc8wNdBNqzP6QepH1VG7L6rOwt7JRjLF6Y.cache
622
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/os-IBWzcQaIeJAr-eZ0ISapp8u6ViHJBDVl3zsSnAxs.cache
623
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/OWrok24obbylOHeAaps9WA5SBwjpaEd0xnQqBWOc-mQ.cache
624
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/p8-Esy85oOHbF8SlC_ADEPGi7AjMurnoYSdCD3V0QHo.cache
625
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QrIfBX9SocQINdKbcOGU2ZplYq_3lE7-CgPvvFRZUPs.cache
626
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/QVhitoXuP03xtsfQo4gH_mAw16dk1EPH7Xf8JlXVLpk.cache
627
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rDG6NUIkefVSkt66sViHIj-M-YmUVD3LC383yOQZE3Y.cache
628
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rgRsqTnAPvMJlyOn2tOMsfX1YNwqiKZprIoYnBtUIao.cache
629
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RSFirXKeTuMV9nWIeu-30jvOMVQTdZQUugyREItprkE.cache
630
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rT-10_0UmPqfTi7e_RvVV2oVVrZPcnzEVxYryWf0AWk.cache
631
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S5giqzoBdK-jXI6AoAelpiCYhMTwMFNaxjUJj816KdM.cache
632
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Se3LTfrl02BuX--hLV7cqyaPT9b9ydVPYsWlXjSvQ6Q.cache
633
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/SwyH6o1ZPaOTMGyVqMXuWtYuyf9yBl0NRSVjvv2HQGo.cache
634
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/T8VFzmrZkpfAHu4YyuwEfZWPF3sv77n7comxiwI6yK4.cache
635
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Te0Swu57VjhvpFOJV5fIm9X9C-tiyuF486pgN6gWuvs.cache
636
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TolX3hiRfWiUWMlwHiH5G7KZZuFKPV2geKgORhx1kbc.cache
637
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tZkY3_ZombuoVZpSwY2dfvHcyD88nyqaNHLzVfrlSbA.cache
638
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/v8-7s6wdUoobgWtvSQPJYtNsLoojslrMGambhfCbLBo.cache
639
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/W5-aJJXrwJHHZ2LUNvSZJDuDWnf-nXHn_RrdHm8Dsy4.cache
640
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WwYeCgq1wE5ouj5QoNsFDYa_K0Hw5SNPPPyzZ9JRk_M.cache
641
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WxGjqpQ1GofgXtH2VW51hBdHzehHiH9QQSzeFwvPa04.cache
642
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/X-OoOAyH7movCISCvhiawWmwCODe3fN7ymRIQEQJGWs.cache
643
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xAmLB93l5rnHnPfuqo_rdVoCN4PRE5-22KU8O3LNn5U.cache
644
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xFmik7WLB1nL3qhSnRWbIEXIwMG1K_dLc1ymZ3hNJ_8.cache
645
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YUqxvOCuXaKKNVrkC0BmaxSs-ae8k61lE-cXvNvp6ts.cache
646
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/z5DZtajWt8UQUvtzye6ncruhskjV7HVUOKWv800kzrE.cache
647
+ - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zPJ93ju23hj65NVsVWOgNlvHe3OjA-SGQ9nU2oupKlI.cache
516
648
  - spec/factories/payola_affiliates.rb
517
649
  - spec/factories/payola_coupons.rb
518
650
  - spec/factories/payola_subscriptions.rb
@@ -527,21 +659,25 @@ test_files:
527
659
  - spec/models/payola/stripe_webhook_spec.rb
528
660
  - spec/models/payola/subscription_spec.rb
529
661
  - spec/payola_spec.rb
530
- - spec/services/payola/#start_subscription_spec.rb#
531
662
  - spec/services/payola/cancel_subscription_spec.rb
532
663
  - spec/services/payola/change_subscription_plan_spec.rb
533
664
  - spec/services/payola/change_subscription_quantity_spec.rb
534
665
  - spec/services/payola/charge_card_spec.rb
666
+ - spec/services/payola/create_card_spec.rb
535
667
  - spec/services/payola/create_plan_spec.rb
536
668
  - spec/services/payola/create_sale_spec.rb
537
669
  - spec/services/payola/create_subscription_spec.rb
670
+ - spec/services/payola/destroy_card_spec.rb
538
671
  - spec/services/payola/invoice_failed_spec.rb
539
672
  - spec/services/payola/invoice_paid_spec.rb
673
+ - spec/services/payola/process_refund_spec.rb
540
674
  - spec/services/payola/process_sale_spec.rb
541
675
  - spec/services/payola/process_subscription_spec.rb
542
676
  - spec/services/payola/send_mail_spec.rb
543
677
  - spec/services/payola/start_subscription_spec.rb
678
+ - spec/services/payola/subscription_deleted_spec.rb
544
679
  - spec/services/payola/sync_subscription_spec.rb
545
680
  - spec/services/payola/update_card_spec.rb
681
+ - spec/services/payola/update_customer_spec.rb
546
682
  - spec/spec_helper.rb
547
683
  - spec/worker_spec.rb
@@ -1,27 +0,0 @@
1
- module Payola
2
- class UpdateCard
3
- def self.call(subscription, token)
4
- secret_key = Payola.secret_key_for_sale(subscription)
5
- begin
6
- customer = Stripe::Customer.retrieve(subscription.stripe_customer_id, secret_key)
7
-
8
- customer.source = token
9
- customer.save
10
-
11
- customer = Stripe::Customer.retrieve(subscription.stripe_customer_id, secret_key)
12
- card = customer.sources.retrieve(customer.default_source, secret_key)
13
-
14
- subscription.update_attributes(
15
- card_type: card.brand,
16
- card_last4: card.last4,
17
- card_expiration: Date.parse("#{card.exp_year}/#{card.exp_month}/1")
18
- )
19
- subscription.save!
20
- rescue RuntimeError, Stripe::StripeError => e
21
- subscription.errors[:base] << e.message
22
- end
23
-
24
- subscription
25
- end
26
- end
27
- end