payola-payments 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -13
  2. data/app/assets/javascripts/payola/form.js +1 -0
  3. data/app/assets/javascripts/payola/subscription_form.js +74 -0
  4. data/app/controllers/payola/application_controller.rb +1 -2
  5. data/app/controllers/payola/subscriptions_controller.rb +94 -0
  6. data/app/models/concerns/payola/plan.rb +50 -0
  7. data/app/models/payola/subscription.rb +161 -0
  8. data/app/services/payola/cancel_subscription.rb +12 -0
  9. data/app/services/payola/change_subscription_plan.rb +29 -0
  10. data/app/services/payola/create_plan.rb +17 -0
  11. data/app/services/payola/create_subscription.rb +20 -0
  12. data/app/services/payola/invoice_failed.rb +42 -0
  13. data/app/services/payola/invoice_paid.rb +43 -0
  14. data/app/services/payola/process_subscription.rb +7 -0
  15. data/app/services/payola/start_subscription.rb +41 -0
  16. data/app/services/payola/sync_subscription.rb +11 -0
  17. data/app/services/payola/update_card.rb +27 -0
  18. data/app/services/payola/update_subscription.rb +11 -0
  19. data/app/views/payola/subscriptions/_cancel.html.erb +10 -0
  20. data/app/views/payola/subscriptions/_change_plan.html.erb +10 -0
  21. data/config/routes.rb +7 -0
  22. data/db/migrate/20141105043439_create_payola_subscriptions.rb +31 -0
  23. data/db/migrate/20141106034610_add_currency_to_payola_subscriptions.rb +6 -0
  24. data/db/migrate/20141107025420_add_guid_to_payola_subscriptions.rb +6 -0
  25. data/db/migrate/20141109203101_add_stripe_status_to_payola_subscription.rb +5 -0
  26. data/db/migrate/20141112024805_add_affiliate_id_to_payola_subscriptions.rb +5 -0
  27. data/db/migrate/20141114032013_add_coupon_code_to_payola_subscriptions.rb +5 -0
  28. data/db/migrate/20141114154223_add_signed_custom_fields_to_payola_subscription.rb +5 -0
  29. data/db/migrate/20141114163841_add_addresses_to_payola_subscription.rb +6 -0
  30. data/lib/payola.rb +11 -0
  31. data/lib/payola/engine.rb +10 -2
  32. data/lib/payola/version.rb +1 -1
  33. data/spec/concerns/plan_spec.rb +43 -0
  34. data/spec/controllers/payola/subscriptions_controller_spec.rb +148 -0
  35. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  36. data/spec/dummy/app/controllers/home_controller.rb +6 -0
  37. data/spec/dummy/app/controllers/subscribe_controller.rb +11 -0
  38. data/spec/dummy/app/models/subscription_plan.rb +3 -0
  39. data/spec/dummy/app/views/home/index.html.erb +7 -0
  40. data/spec/dummy/app/views/subscribe/index.html.erb +21 -0
  41. data/spec/dummy/app/views/subscribe/show.html.erb +4 -0
  42. data/spec/dummy/config/initializers/payola.rb +4 -0
  43. data/spec/dummy/config/routes.rb +4 -0
  44. data/spec/dummy/db/development.sqlite3 +0 -0
  45. data/spec/dummy/db/migrate/20141105010234_create_subscription_plans.rb +14 -0
  46. data/spec/dummy/db/schema.rb +51 -1
  47. data/spec/dummy/db/test.sqlite3 +0 -0
  48. data/spec/dummy/log/development.log +275 -0
  49. data/spec/dummy/log/test.log +109420 -0
  50. data/spec/dummy/tmp/cache/assets/development/sprockets/0e585aeb88c1555ae8f5292f7c7a9068 +0 -0
  51. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  52. data/spec/dummy/tmp/cache/assets/development/sprockets/1b54952339cbc96811097cee5f8923b4 +0 -0
  53. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  54. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  55. data/spec/dummy/tmp/cache/assets/development/sprockets/5afa4bc970e0bc781b3500c696ba25ff +0 -0
  56. data/spec/dummy/tmp/cache/assets/development/sprockets/664efeb51d1b486dcfc30d142db56f3c +0 -0
  57. data/spec/dummy/tmp/cache/assets/development/sprockets/68a3bbdc64a0729b5896fa1e33fce4b1 +0 -0
  58. data/spec/dummy/tmp/cache/assets/development/sprockets/96b1ccdc193a02b2bbea195310262fa5 +0 -0
  59. data/spec/dummy/tmp/cache/assets/development/sprockets/aea159adbc0944b120d91d5b578612ba +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/b20dab973e971c61bc7e334a38453ae0 +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/b83da90cb58011313e13a97a4a41cb6e +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/c0b954b40f2881a6d286061bc069643e +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/c5b3877d49b39932a7557611cefca9a6 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/ca491e325ff6948be9292f701aa4ce64 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/d3f4b67cc032016dfeebc71f2148b9dc +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/d9856638a3c7b9cfd9d1b884e3b33982 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/ddba6e841f28d3005e828fbfffd18b74 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/df935e399019055729aa968bd7062096 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/ef82c31948061751bb026663b54484e1 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/f0b5d4bea0c6cdd1904e1e9a0a45532f +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  74. data/spec/factories/payola_subscriptions.rb +25 -0
  75. data/spec/factories/subscription_plan.rb +9 -0
  76. data/spec/models/payola/subscription_spec.rb +50 -0
  77. data/spec/services/payola/cancel_subscription_spec.rb +29 -0
  78. data/spec/services/payola/change_subscription_plan_spec.rb +31 -0
  79. data/spec/services/payola/charge_card_spec.rb +9 -5
  80. data/spec/services/payola/create_plan_spec.rb +24 -0
  81. data/spec/services/payola/create_subscription_spec.rb +65 -0
  82. data/spec/services/payola/invoice_failed_spec.rb +29 -0
  83. data/spec/services/payola/invoice_paid_spec.rb +49 -0
  84. data/spec/services/payola/start_subscription_spec.rb +36 -0
  85. data/spec/services/payola/sync_subscription_spec.rb +14 -0
  86. data/spec/services/payola/update_card_spec.rb +26 -0
  87. metadata +95 -30
@@ -0,0 +1,148 @@
1
+ require 'spec_helper'
2
+
3
+ module Payola
4
+ describe SubscriptionsController do
5
+ before do
6
+ @plan = create(:subscription_plan)
7
+ Payola.register_subscribable(@plan.class)
8
+ end
9
+
10
+ describe '#create' do
11
+ it "should pass args to CreateSubscription and queue the job" do
12
+ subscription = double
13
+ subscription.should_receive(:save).and_return(true)
14
+ subscription.should_receive(:guid).at_least(1).times.and_return(1)
15
+
16
+ CreateSubscription.should_receive(:call).and_return(subscription)
17
+ Payola.should_receive(:queue!)
18
+ post :create, plan_class: @plan.plan_class, plan_id: @plan.id, use_route: :payola
19
+
20
+ expect(response.status).to eq 200
21
+ parsed_body = JSON.load(response.body)
22
+ expect(parsed_body['guid']).to eq 1
23
+ end
24
+
25
+ describe "with an error" do
26
+ it "should return an error in json" do
27
+ subscription = double
28
+ subscription.should_receive(:save).and_return(false)
29
+ error = double
30
+ error.should_receive(:full_messages).and_return(['done did broke'])
31
+ subscription.should_receive(:errors).and_return(error)
32
+
33
+ CreateSubscription.should_receive(:call).and_return(subscription)
34
+ Payola.should_not_receive(:queue!)
35
+
36
+ post :create, plan_class: @plan.plan_class, plan_id: @plan.id, use_route: :payola
37
+
38
+ expect(response.status).to eq 400
39
+ parsed_body = JSON.load(response.body)
40
+ expect(parsed_body['error']).to eq 'done did broke'
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#status' do
46
+ it "should return 404 if it can't find the subscription" do
47
+ get :status, guid: 'doesnotexist', use_route: :payola
48
+ expect(response.status).to eq 404
49
+ end
50
+ it "should return json with properties" do
51
+ subscription = create(:subscription)
52
+ get :status, guid: subscription.guid, use_route: :payola
53
+
54
+ expect(response.status).to eq 200
55
+
56
+ parsed_body = JSON.load(response.body)
57
+
58
+ expect(parsed_body['guid']).to eq subscription.guid
59
+ expect(parsed_body['status']).to eq subscription.state
60
+ expect(parsed_body['error']).to be_nil
61
+ end
62
+ end
63
+
64
+ describe '#show' do
65
+ it "should redirect to the product's redirect path" do
66
+ plan = create(:subscription_plan)
67
+ subscription = create(:subscription, :plan => plan)
68
+ get :show, guid: subscription.guid, use_route: :payola
69
+
70
+ expect(response).to redirect_to '/'
71
+ end
72
+ end
73
+
74
+ describe '#destroy' do
75
+ before :each do
76
+ @subscription = create(:subscription, :state => :active)
77
+ end
78
+ it "call Payola::CancelSubscription and redirect" do
79
+ Payola::CancelSubscription.should_receive(:call)
80
+ delete :destroy, :guid => @subscription.guid, use_route: :payola
81
+ # TODO : Figure out why this needs to be a hardcoded path.
82
+ # Why doesn't subscription_path(@subscription) work?
83
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
84
+ end
85
+
86
+ it "should redirect with an error if it can't cancel the subscription" do
87
+ expect(Payola::CancelSubscription).to_not receive(:call)
88
+ expect_any_instance_of(::ApplicationController).to receive(:payola_can_modify_subscription?).and_return(false)
89
+
90
+ delete :destroy, :guid => @subscription.guid, use_route: :payola
91
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
92
+ expect(request.flash[:alert]).to eq 'You cannot modify this subscription.'
93
+ end
94
+ end
95
+
96
+ describe '#change_plan' do
97
+ before :each do
98
+ @subscription = create(:subscription, state: :active)
99
+ @plan = create(:subscription_plan)
100
+ end
101
+
102
+ it "should call Payola::ChangeSubscriptionPlan and redirect" do
103
+ expect(Payola::ChangeSubscriptionPlan).to receive(:call).with(@subscription, @plan)
104
+
105
+ post :change_plan, guid: @subscription.guid, plan_class: @plan.plan_class, plan_id: @plan.id, use_route: :payola
106
+
107
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
108
+ expect(request.flash[:notice]).to eq 'Subscription plan updated'
109
+ end
110
+
111
+ it "should redirect with an error if it can't cancel the subscription" do
112
+ expect(Payola::CancelSubscription).to_not receive(:call)
113
+ expect_any_instance_of(::ApplicationController).to receive(:payola_can_modify_subscription?).and_return(false)
114
+
115
+ delete :destroy, :guid => @subscription.guid, use_route: :payola
116
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
117
+ expect(request.flash[:alert]).to eq 'You cannot modify this subscription.'
118
+ end
119
+ end
120
+
121
+ describe "#update_card" do
122
+ before :each do
123
+ @subscription = create(:subscription, state: :active)
124
+ @plan = create(:subscription_plan)
125
+ end
126
+
127
+ it "should call UpdateCard and redirect" do
128
+ expect(Payola::UpdateCard).to receive(:call).with(@subscription, 'tok_1234')
129
+
130
+ post :update_card, guid: @subscription.guid, stripeToken: 'tok_1234', use_route: :payola
131
+
132
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
133
+ expect(request.flash[:notice]).to eq 'Card updated'
134
+ end
135
+
136
+ it "should redirect with an error" do
137
+ expect(Payola::UpdateCard).to receive(:call).never
138
+ expect_any_instance_of(::ApplicationController).to receive(:payola_can_modify_subscription?).and_return(false)
139
+
140
+ post :update_card, guid: @subscription.guid, stripeToken: 'tok_1234', use_route: :payola
141
+
142
+ expect(response).to redirect_to "/subdir/payola/confirm_subscription/#{@subscription.guid}"
143
+ expect(request.flash[:alert]).to eq 'You cannot modify this subscription.'
144
+ end
145
+ end
146
+
147
+ end
148
+ end
@@ -2,4 +2,8 @@ class ApplicationController < ActionController::Base
2
2
  # Prevent CSRF attacks by raising an exception.
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
+
6
+ def payola_can_modify_subscription?(subscription)
7
+ true
8
+ end
5
9
  end
@@ -0,0 +1,6 @@
1
+ class HomeController < ApplicationController
2
+
3
+ protect_from_forgery :except => [:index]
4
+ def index
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class SubscribeController < ApplicationController
2
+ helper Payola::PriceHelper
3
+
4
+ def index
5
+ @plan = SubscriptionPlan.first
6
+ end
7
+
8
+ def show
9
+ @subscription = Payola::Subscription.find_by!(guid: params[:guid])
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ class SubscriptionPlan < ActiveRecord::Base
2
+ include Payola::Plan
3
+ end
@@ -0,0 +1,7 @@
1
+ <h1>Hi there!</h1>
2
+ <p>This is a fake home page. Maybe you'd like to:</p>
3
+ <ul>
4
+ <li><%= link_to "Buy Something", "/buy" %></li>
5
+ <li><%= link_to "Subscribe to Something", "/subscribe" %></li>
6
+ </ul>
7
+
@@ -0,0 +1,21 @@
1
+ <%#= render 'payola/transactions/checkout', sellable: @product, button_class: 'not-a-class' %>
2
+
3
+ <hr>
4
+
5
+ <%= form_for @plan, url: '/', method: :post, html: { class: 'payola-subscription-form', 'data-payola-base-path' => '/subdir/payola', 'data-payola-plan-type' => @plan.plan_class, 'data-payola-plan-id' => @plan.id } do |f| %>
6
+ <span class="payola-payment-error"></span>
7
+ Email:<br>
8
+ <input type="email" name="stripeEmail" data-payola="email"></input><br>
9
+ Card Number<br>
10
+ <input type="text" data-stripe="number"></input><br>
11
+ Exp Month<br>
12
+ <input type="text" data-stripe="exp_month"></input><br>
13
+ Exp Year<br>
14
+ <input type="text" data-stripe="exp_year"></input><br>
15
+ CVC<br>
16
+ <input type="text" data-stripe="cvc"></input><br>
17
+ Coupon Code<br>
18
+ <input type="text" name="coupon" data-payola="coupon"></input><br>
19
+ <input type="submit"></input>
20
+ <% end %>
21
+
@@ -0,0 +1,4 @@
1
+ <h1>Subscription #<%= @subscription.guid %></h1>
2
+ <% if @subscription.active? %>
3
+ <%= render 'payola/subscriptions/cancel', :subscription => @subscription %>
4
+ <% end %>
@@ -1,5 +1,9 @@
1
1
  require 'sucker_punch'
2
2
 
3
3
  Payola.configure do |payola|
4
+
5
+ payola.secret_key = 'sk_test_TYtgGt8qBaUpEJh0ZIY1jUuO'
6
+ payola.publishable_key = 'pk_test_KeUPeR6mUmS67g2YdJ9nhqBF'
7
+
4
8
  payola.background_worker = :sucker_punch
5
9
  end
@@ -1,4 +1,8 @@
1
1
  Rails.application.routes.draw do
2
2
  resources :buy
3
+ get 'subscribe' => 'subscribe#index'
4
+ get 'subscription/:guid' => 'subscribe#show'
3
5
  mount Payola::Engine => "/subdir/payola", as: :payola
6
+ root 'home#index'
7
+ post '' => 'home#index'
4
8
  end
Binary file
@@ -0,0 +1,14 @@
1
+ class CreateSubscriptionPlans < ActiveRecord::Migration
2
+ def change
3
+ create_table :subscription_plans do |t|
4
+ t.integer :amount
5
+ t.string :interval
6
+ t.integer :interval_count
7
+ t.string :name
8
+ t.string :stripe_id
9
+ t.integer :trial_period_days
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20141029140518) do
14
+ ActiveRecord::Schema.define(version: 20141114163841) do
15
15
 
16
16
  create_table "owners", force: true do |t|
17
17
  t.datetime "created_at"
@@ -75,6 +75,45 @@ ActiveRecord::Schema.define(version: 20141029140518) do
75
75
  t.datetime "updated_at"
76
76
  end
77
77
 
78
+ create_table "payola_subscriptions", force: true do |t|
79
+ t.string "plan_type"
80
+ t.integer "plan_id"
81
+ t.datetime "start"
82
+ t.string "status"
83
+ t.string "owner_type"
84
+ t.integer "owner_id"
85
+ t.string "stripe_customer_id"
86
+ t.boolean "cancel_at_period_end"
87
+ t.datetime "current_period_start"
88
+ t.datetime "current_period_end"
89
+ t.datetime "ended_at"
90
+ t.datetime "trial_start"
91
+ t.datetime "trial_end"
92
+ t.datetime "canceled_at"
93
+ t.integer "quantity"
94
+ t.string "stripe_id"
95
+ t.string "stripe_token"
96
+ t.string "card_last4"
97
+ t.date "card_expiration"
98
+ t.string "card_type"
99
+ t.text "error"
100
+ t.string "state"
101
+ t.string "email"
102
+ t.datetime "created_at"
103
+ t.datetime "updated_at"
104
+ t.string "currency"
105
+ t.integer "amount"
106
+ t.string "guid"
107
+ t.string "stripe_status"
108
+ t.integer "affiliate_id"
109
+ t.string "coupon"
110
+ t.text "signed_custom_fields"
111
+ t.text "customer_address"
112
+ t.text "business_address"
113
+ end
114
+
115
+ add_index "payola_subscriptions", ["guid"], name: "index_payola_subscriptions_on_guid"
116
+
78
117
  create_table "products", force: true do |t|
79
118
  t.string "name"
80
119
  t.string "permalink"
@@ -83,4 +122,15 @@ ActiveRecord::Schema.define(version: 20141029140518) do
83
122
  t.datetime "updated_at"
84
123
  end
85
124
 
125
+ create_table "subscription_plans", force: true do |t|
126
+ t.integer "amount"
127
+ t.string "interval"
128
+ t.integer "interval_count"
129
+ t.string "name"
130
+ t.string "stripe_id"
131
+ t.integer "trial_period_days"
132
+ t.datetime "created_at"
133
+ t.datetime "updated_at"
134
+ end
135
+
86
136
  end
Binary file
@@ -4107,3 +4107,278 @@ Migrating to CreateOwners (20141029140518)
4107
4107
  FROM sqlite_temp_master
4108
4108
  WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4109
4109
 
4110
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
4111
+ Migrating to CreateSubscriptionPlans (20141105010234)
4112
+  (0.1ms) begin transaction
4113
+  (0.9ms) CREATE TABLE "subscription_plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "amount" integer, "interval" varchar(255), "interval_count" integer, "name" varchar(255), "stripe_id" varchar(255), "trial_period_days" integer, "created_at" datetime, "updated_at" datetime) 
4114
+ SQL (0.6ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141105010234"]]
4115
+  (3.2ms) commit transaction
4116
+ Migrating to CreatePayolaSubscriptions (20141105043439)
4117
+  (0.1ms) begin transaction
4118
+  (0.4ms) CREATE TABLE "payola_subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plan_type" varchar(255), "plan_id" integer, "start" datetime, "status" varchar(255), "owner_type" varchar(255), "owner_id" integer, "stripe_customer_id" varchar(255), "cancel_at_period_end" boolean, "current_period_start" datetime, "current_period_end" datetime, "ended_at" datetime, "trial_start" datetime, "trial_end" datetime, "canceled_at" datetime, "quantity" integer, "stripe_id" varchar(255), "stripe_token" varchar(255), "card_last4" varchar(255), "card_expiration" date, "card_type" varchar(255), "error" text, "state" varchar(255), "email" varchar(255), "created_at" datetime, "updated_at" datetime) 
4119
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141105043439"]]
4120
+  (0.9ms) commit transaction
4121
+ Migrating to AddCurrencyToPayolaSubscriptions (20141106034610)
4122
+  (0.1ms) begin transaction
4123
+  (0.3ms) ALTER TABLE "payola_subscriptions" ADD "currency" varchar(255)
4124
+  (0.1ms) ALTER TABLE "payola_subscriptions" ADD "amount" integer
4125
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141106034610"]]
4126
+  (0.7ms) commit transaction
4127
+ Migrating to AddGuidToPayolaSubscriptions (20141107025420)
4128
+  (0.1ms) begin transaction
4129
+  (0.3ms) ALTER TABLE "payola_subscriptions" ADD "guid" varchar(255)
4130
+  (0.0ms) select sqlite_version(*)
4131
+  (0.1ms) CREATE INDEX "index_payola_subscriptions_on_guid" ON "payola_subscriptions" ("guid")
4132
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141107025420"]]
4133
+  (0.8ms) commit transaction
4134
+ Migrating to AddStripeStatusToPayolaSubscription (20141109203101)
4135
+  (0.1ms) begin transaction
4136
+  (0.8ms) ALTER TABLE "payola_subscriptions" ADD "stripe_status" varchar(255)
4137
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141109203101"]]
4138
+  (0.8ms) commit transaction
4139
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4140
+  (0.2ms) SELECT sql
4141
+ FROM sqlite_master
4142
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4143
+ UNION ALL
4144
+ SELECT sql
4145
+ FROM sqlite_temp_master
4146
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4147
+
4148
+  (0.1ms)  SELECT sql
4149
+ FROM sqlite_master
4150
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4151
+ UNION ALL
4152
+ SELECT sql
4153
+ FROM sqlite_temp_master
4154
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4155
+ 
4156
+  (0.1ms) SELECT sql
4157
+ FROM sqlite_master
4158
+ WHERE name='index_payola_sales_on_product' AND type='index'
4159
+ UNION ALL
4160
+ SELECT sql
4161
+ FROM sqlite_temp_master
4162
+ WHERE name='index_payola_sales_on_product' AND type='index'
4163
+
4164
+  (0.1ms)  SELECT sql
4165
+ FROM sqlite_master
4166
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4167
+ UNION ALL
4168
+ SELECT sql
4169
+ FROM sqlite_temp_master
4170
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4171
+ 
4172
+  (0.1ms) SELECT sql
4173
+ FROM sqlite_master
4174
+ WHERE name='index_payola_sales_on_email' AND type='index'
4175
+ UNION ALL
4176
+ SELECT sql
4177
+ FROM sqlite_temp_master
4178
+ WHERE name='index_payola_sales_on_email' AND type='index'
4179
+
4180
+  (0.1ms)  SELECT sql
4181
+ FROM sqlite_master
4182
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4183
+ UNION ALL
4184
+ SELECT sql
4185
+ FROM sqlite_temp_master
4186
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4187
+ 
4188
+  (0.1ms) SELECT sql
4189
+ FROM sqlite_master
4190
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4191
+ UNION ALL
4192
+ SELECT sql
4193
+ FROM sqlite_temp_master
4194
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4195
+
4196
+
4197
+
4198
+ Started GET "/" for 127.0.0.1 at 2014-11-13 10:28:29 -0500
4199
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
4200
+ Processing by Rails::WelcomeController#index as HTML
4201
+ Rendered /Users/peter/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/templates/rails/welcome/index.html.erb (2.3ms)
4202
+ Completed 200 OK in 8ms (Views: 7.6ms | ActiveRecord: 0.0ms)
4203
+
4204
+
4205
+ Started GET "/" for 127.0.0.1 at 2014-11-13 10:28:31 -0500
4206
+ Processing by Rails::WelcomeController#index as HTML
4207
+ Rendered /Users/peter/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
4208
+ Completed 200 OK in 2ms (Views: 1.3ms | ActiveRecord: 0.0ms)
4209
+
4210
+
4211
+ Started GET "/" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4212
+ Processing by Rails::WelcomeController#index as HTML
4213
+ Rendered /Users/peter/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.6/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
4214
+ Completed 200 OK in 1ms (Views: 1.1ms | ActiveRecord: 0.0ms)
4215
+
4216
+
4217
+ Started GET "/buy" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4218
+ Processing by BuyController#index as HTML
4219
+ Product Load (0.6ms) SELECT "products".* FROM "products" ORDER BY "products"."id" ASC LIMIT 1
4220
+ Rendered /Users/peter/devel/payola/app/views/payola/transactions/_checkout.html.erb (50.5ms)
4221
+ Rendered buy/index.html.erb within layouts/application (55.5ms)
4222
+ Rendered /Users/peter/devel/payola/app/views/payola/transactions/_stripe_header.html.erb (0.4ms)
4223
+ Completed 200 OK in 179ms (Views: 169.3ms | ActiveRecord: 1.4ms)
4224
+
4225
+
4226
+ Started GET "/assets/payola/checkout_button.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4227
+
4228
+
4229
+ Started GET "/assets/buy.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4230
+
4231
+
4232
+ Started GET "/assets/payola/application.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4233
+
4234
+
4235
+ Started GET "/assets/buy.css?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4236
+
4237
+
4238
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4239
+
4240
+
4241
+ Started GET "/assets/payola/form.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4242
+
4243
+
4244
+ Started GET "/assets/payola.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4245
+
4246
+
4247
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-11-13 10:28:32 -0500
4248
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
4249
+ Migrating to AddAffiliateIdToPayolaSubscriptions (20141112024805)
4250
+  (0.1ms) begin transaction
4251
+  (0.8ms) ALTER TABLE "payola_subscriptions" ADD "affiliate_id" integer
4252
+ SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141112024805"]]
4253
+  (0.9ms) commit transaction
4254
+ Migrating to AddCouponCodeToPayolaSubscriptions (20141114032013)
4255
+  (0.1ms) begin transaction
4256
+  (0.5ms) ALTER TABLE "payola_subscriptions" ADD "coupon" varchar(255)
4257
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141114032013"]]
4258
+  (0.8ms) commit transaction
4259
+ Migrating to AddSignedCustomFieldsToPayolaSubscription (20141114154223)
4260
+  (0.1ms) begin transaction
4261
+  (0.3ms) ALTER TABLE "payola_subscriptions" ADD "signed_custom_fields" text
4262
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141114154223"]]
4263
+  (0.8ms) commit transaction
4264
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4265
+  (0.1ms)  SELECT sql
4266
+ FROM sqlite_master
4267
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4268
+ UNION ALL
4269
+ SELECT sql
4270
+ FROM sqlite_temp_master
4271
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4272
+ 
4273
+  (0.1ms) SELECT sql
4274
+ FROM sqlite_master
4275
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4276
+ UNION ALL
4277
+ SELECT sql
4278
+ FROM sqlite_temp_master
4279
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4280
+
4281
+  (0.1ms)  SELECT sql
4282
+ FROM sqlite_master
4283
+ WHERE name='index_payola_sales_on_product' AND type='index'
4284
+ UNION ALL
4285
+ SELECT sql
4286
+ FROM sqlite_temp_master
4287
+ WHERE name='index_payola_sales_on_product' AND type='index'
4288
+ 
4289
+  (0.1ms) SELECT sql
4290
+ FROM sqlite_master
4291
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4292
+ UNION ALL
4293
+ SELECT sql
4294
+ FROM sqlite_temp_master
4295
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4296
+
4297
+  (0.1ms)  SELECT sql
4298
+ FROM sqlite_master
4299
+ WHERE name='index_payola_sales_on_email' AND type='index'
4300
+ UNION ALL
4301
+ SELECT sql
4302
+ FROM sqlite_temp_master
4303
+ WHERE name='index_payola_sales_on_email' AND type='index'
4304
+ 
4305
+  (0.1ms) SELECT sql
4306
+ FROM sqlite_master
4307
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4308
+ UNION ALL
4309
+ SELECT sql
4310
+ FROM sqlite_temp_master
4311
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4312
+
4313
+  (0.2ms)  SELECT sql
4314
+ FROM sqlite_master
4315
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4316
+ UNION ALL
4317
+ SELECT sql
4318
+ FROM sqlite_temp_master
4319
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4320
+ 
4321
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
4322
+ Migrating to AddAddressesToPayolaSubscription (20141114163841)
4323
+  (0.1ms) begin transaction
4324
+  (0.5ms) ALTER TABLE "payola_subscriptions" ADD "customer_address" text
4325
+  (0.2ms) ALTER TABLE "payola_subscriptions" ADD "business_address" text
4326
+ SQL (0.6ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141114163841"]]
4327
+  (1.2ms) commit transaction
4328
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4329
+  (0.2ms) SELECT sql
4330
+ FROM sqlite_master
4331
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4332
+ UNION ALL
4333
+ SELECT sql
4334
+ FROM sqlite_temp_master
4335
+ WHERE name='index_payola_sales_on_owner_id_and_owner_type' AND type='index'
4336
+
4337
+  (0.1ms)  SELECT sql
4338
+ FROM sqlite_master
4339
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4340
+ UNION ALL
4341
+ SELECT sql
4342
+ FROM sqlite_temp_master
4343
+ WHERE name='index_payola_sales_on_stripe_customer_id' AND type='index'
4344
+ 
4345
+  (0.1ms) SELECT sql
4346
+ FROM sqlite_master
4347
+ WHERE name='index_payola_sales_on_product' AND type='index'
4348
+ UNION ALL
4349
+ SELECT sql
4350
+ FROM sqlite_temp_master
4351
+ WHERE name='index_payola_sales_on_product' AND type='index'
4352
+
4353
+  (0.1ms)  SELECT sql
4354
+ FROM sqlite_master
4355
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4356
+ UNION ALL
4357
+ SELECT sql
4358
+ FROM sqlite_temp_master
4359
+ WHERE name='index_payola_sales_on_guid' AND type='index'
4360
+ 
4361
+  (0.1ms) SELECT sql
4362
+ FROM sqlite_master
4363
+ WHERE name='index_payola_sales_on_email' AND type='index'
4364
+ UNION ALL
4365
+ SELECT sql
4366
+ FROM sqlite_temp_master
4367
+ WHERE name='index_payola_sales_on_email' AND type='index'
4368
+
4369
+  (0.1ms)  SELECT sql
4370
+ FROM sqlite_master
4371
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4372
+ UNION ALL
4373
+ SELECT sql
4374
+ FROM sqlite_temp_master
4375
+ WHERE name='index_payola_sales_on_coupon_id' AND type='index'
4376
+ 
4377
+  (0.1ms) SELECT sql
4378
+ FROM sqlite_master
4379
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4380
+ UNION ALL
4381
+ SELECT sql
4382
+ FROM sqlite_temp_master
4383
+ WHERE name='index_payola_subscriptions_on_guid' AND type='index'
4384
+