muck-commerce 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -1
- data/VERSION +1 -1
- data/app/controllers/admin/muck/coupons_controller.rb +3 -1
- data/app/controllers/muck/subscriptions_controller.rb +64 -1
- data/config/muck_commerce_routes.rb +1 -1
- data/db/migrate/20100327171239_add_subscription_records.rb +14 -0
- data/lib/active_record/acts/muck_commerce_user.rb +13 -2
- data/lib/active_record/acts/muck_coupon.rb +3 -0
- data/lib/active_record/acts/muck_coupon_type.rb +9 -1
- data/lib/active_record/acts/muck_subscription.rb +2 -1
- data/lib/active_record/acts/muck_subscription_record.rb +35 -0
- data/lib/muck_commerce.rb +1 -0
- data/lib/test/muck_commerce_factories.rb +9 -1
- data/muck-commerce.gemspec +28 -4
- data/test/rails_root/app/models/coupon_type.rb +3 -0
- data/test/rails_root/db/migrate/20091230220327_create_muck_commerce.rb +9 -11
- data/test/rails_root/db/migrate/20100228060913_create_subscription_coupons.rb +14 -0
- data/test/rails_root/db/migrate/20100327171239_add_subscription_records.rb +14 -0
- data/test/rails_root/public/images/fancybox/blank.gif +0 -0
- data/test/rails_root/public/images/fancybox/fancy_close.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_loading.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_nav_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_nav_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_main.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_over.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancybox-x.png +0 -0
- data/test/rails_root/public/images/fancybox/fancybox-y.png +0 -0
- data/test/rails_root/public/images/fancybox/fancybox.png +0 -0
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +72 -1
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +34 -6
- data/test/rails_root/public/javascripts/jquery/jquery.js +150 -15
- data/test/rails_root/public/javascripts/jquery/jquery.mousewheel.js +13 -0
- data/test/rails_root/public/javascripts/muck-countries.js +1 -1
- data/test/rails_root/public/javascripts/muck.js +0 -2
- data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +77 -38
- data/test/rails_root/test/functional/{billings_information_controller_test.rb → billing_informations_controller_test.rb} +0 -0
- data/test/rails_root/test/unit/cart_coupon_test.rb +16 -0
- data/test/rails_root/test/unit/coupon_test.rb +65 -0
- data/test/rails_root/test/unit/coupon_type_test.rb +24 -0
- data/test/rails_root/test/unit/subscription_test.rb +153 -1
- data/test/rails_root/test/unit/user_test.rb +56 -8
- metadata +29 -5
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= muck-commerce
|
2
2
|
|
3
|
-
A commerce engine for muck
|
3
|
+
A commerce engine for the muck framework.
|
4
4
|
|
5
5
|
== Configuration
|
6
6
|
|
@@ -57,6 +57,10 @@ Add acts_as_muck_commerce_user to user.rb
|
|
57
57
|
acts_as_muck_commerce_user
|
58
58
|
end
|
59
59
|
|
60
|
+
The muck commerce engine is setup to use coupons as referral codes for users. To automatically create a coupon code for
|
61
|
+
each user add this code to user.rb
|
62
|
+
after_create {|user| user.create_referral_code unless user.referral_code}
|
63
|
+
|
60
64
|
== Create Models
|
61
65
|
billing_information.rb
|
62
66
|
acts_as_muck_billing_information
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -3,7 +3,7 @@ class Admin::Muck::CouponsController < Admin::Muck::BaseController
|
|
3
3
|
before_filter :get_coupon, :only => [:edit, :update, :destroy]
|
4
4
|
|
5
5
|
def index
|
6
|
-
@coupons = Coupon.by_newest
|
6
|
+
@coupons = Coupon.default.by_newest
|
7
7
|
render :template => 'admin/coupons/index'
|
8
8
|
end
|
9
9
|
|
@@ -21,6 +21,7 @@ class Admin::Muck::CouponsController < Admin::Muck::BaseController
|
|
21
21
|
@coupon.use_limit = 1
|
22
22
|
@coupon.uses = 0
|
23
23
|
@coupon.code = Coupon.random_code
|
24
|
+
@coupon.coupon_type = CouponType.default
|
24
25
|
@coupon.save!
|
25
26
|
MuckCommerceMailer.deliver_coupon_code(email, params[:subject], params[:message], @coupon.code)
|
26
27
|
end
|
@@ -37,6 +38,7 @@ class Admin::Muck::CouponsController < Admin::Muck::BaseController
|
|
37
38
|
|
38
39
|
def create
|
39
40
|
@coupon = Coupon.new(params[:coupon])
|
41
|
+
@coupon.coupon_type = CouponType.default
|
40
42
|
@coupon.save!
|
41
43
|
redirect_to admin_coupons_path
|
42
44
|
rescue ActiveRecord::RecordInvalid => ex
|
@@ -4,7 +4,7 @@ class Muck::SubscriptionsController < ApplicationController
|
|
4
4
|
|
5
5
|
before_filter :login_required
|
6
6
|
|
7
|
-
ssl_required :new, :
|
7
|
+
ssl_required :new, :receipt , :confirm, :create, :update
|
8
8
|
|
9
9
|
def show
|
10
10
|
@subscription = current_user.subscriptions.find(params[:id]) rescue nil
|
@@ -81,6 +81,69 @@ class Muck::SubscriptionsController < ApplicationController
|
|
81
81
|
redirect_to new_subscription_path
|
82
82
|
end
|
83
83
|
|
84
|
+
# Paypal functionality
|
85
|
+
# def express
|
86
|
+
# response = PAYPAL_EXPRESS_GATEWAY.setup_purchase(calculate_amount,
|
87
|
+
# :ip => request.remote_ip,
|
88
|
+
# :return_url => process_express_user_lookup_url(@user),
|
89
|
+
# :cancel_return_url => edit_user_lookup_url(@user, @lookup)
|
90
|
+
# )
|
91
|
+
# redirect_to PAYPAL_EXPRESS_GATEWAY.redirect_url_for(response.token)
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# def process_express
|
95
|
+
# @lookup.amount = calculate_amount
|
96
|
+
# @lookup.save!
|
97
|
+
# response = PAYPAL_EXPRESS_GATEWAY.purchase(@lookup.amount, :ip => request.remote_ip, :token => params[:token], :payer_id => params[:PayerID], :order_id => @lookup.order.order_number)
|
98
|
+
# purchase = OrderTransaction.parse_response(response, 'paypal express purcahse', @lookup.amount)
|
99
|
+
# @lookup.transactions << purchase
|
100
|
+
# @lookup.finish!
|
101
|
+
# respond_to do |format|
|
102
|
+
# format.html { redirect_to user_lookup_path(@user, @lookup) }
|
103
|
+
# end
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# # let the user pay with paypal
|
107
|
+
# def express
|
108
|
+
# description = 'sign up for stuff'
|
109
|
+
# response = PAYPAL_EXPRESS_RECURRING_GATEWAY.setup_agreement(
|
110
|
+
# :description => description,
|
111
|
+
# :ip => request.remote_ip,
|
112
|
+
# :return_url => process_express_new_order_url,
|
113
|
+
# :cancel_return_url => root_url)
|
114
|
+
# redirect_to PAYPAL_EXPRESS_RECURRING_GATEWAY.redirect_url_for(response.token)
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
# def process_express
|
118
|
+
# amount = 100
|
119
|
+
# token = params[:token]
|
120
|
+
# response = PAYPAL_EXPRESS_RECURRING_GATEWAY.create_profile(params[:token],
|
121
|
+
# :ip => request.remote_ip,
|
122
|
+
# :description => description,
|
123
|
+
# :start_date => start_date,
|
124
|
+
# :frequency => frequency_in_months,
|
125
|
+
# :amount => amount_in_dollars,
|
126
|
+
# :auto_bill_outstanding => true,
|
127
|
+
# :payer_id => params[:PayerID],
|
128
|
+
# :order_id => '101')
|
129
|
+
#
|
130
|
+
# # Save this profile_id in your transactions table. This is used to cancel/modify the plan in the future.
|
131
|
+
# profile_id = response.params["profile_id"]
|
132
|
+
#
|
133
|
+
# if response.success?
|
134
|
+
# flash[:notice] = "Your PayPal account was successfully set up for the <strong>#{description}</strong> payment plan."
|
135
|
+
# redirect_to login_path
|
136
|
+
# else
|
137
|
+
# flash.now[:notice] = "There was a problem setting up your PayPal account for the <strong>#{description}</strong> payment plan"
|
138
|
+
# render cancel_url
|
139
|
+
# end
|
140
|
+
# end
|
141
|
+
#
|
142
|
+
# def cancel
|
143
|
+
# response = PAYPAL_EXPRESS_GATEWAY.cancel_profile(paypal_profile_id, :note => 'Payment plan was canceled by user')
|
144
|
+
# flash[:notice] = 'You have successfully canceled your membership'
|
145
|
+
# end
|
146
|
+
|
84
147
|
protected
|
85
148
|
|
86
149
|
def new_action(message = nil)
|
@@ -4,7 +4,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
4
4
|
map.resources :orders, :controller => 'muck/orders'
|
5
5
|
map.resources :cart_items, :controller => 'muck/cart_items'
|
6
6
|
map.resource :cart, :controller => 'muck/carts'
|
7
|
-
map.resources :subscriptions, :controller => 'muck/subscriptions'
|
7
|
+
map.resources :subscriptions, :controller => 'muck/subscriptions', :member => { :receipt => :get, :confirm => :get, :confirm_unsubscribe => :get }
|
8
8
|
|
9
9
|
# admin
|
10
10
|
map.namespace :admin do |a|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddSubscriptionRecords < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :subscription_records do |t|
|
4
|
+
t.integer :subscription_id
|
5
|
+
t.integer :amount
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
add_index :subscription_records, :subscription_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table :subscription_records
|
13
|
+
end
|
14
|
+
end
|
@@ -9,6 +9,12 @@ module ActiveRecord
|
|
9
9
|
module ClassMethods
|
10
10
|
|
11
11
|
# +acts_as_muck_commerce_user+ ties a user into the muck commerce system and adds order, carts, etc.
|
12
|
+
# Access cart using:
|
13
|
+
# @user.cart
|
14
|
+
# Access default billing information:
|
15
|
+
# @user.billing_information
|
16
|
+
# Each user can have a referral code which can be accessed using:
|
17
|
+
# @user.referral_code
|
12
18
|
def acts_as_muck_commerce_user
|
13
19
|
|
14
20
|
has_one :cart, :as => :cartable, :dependent => :destroy
|
@@ -16,7 +22,8 @@ module ActiveRecord
|
|
16
22
|
has_many :order_transactions, :as => :transactionable, :dependent => :destroy
|
17
23
|
has_many :orders, :as => :orderable
|
18
24
|
has_many :subscriptions, :dependent => :destroy
|
19
|
-
|
25
|
+
has_one :referral_coupon_code, :class_name => 'Coupon'
|
26
|
+
|
20
27
|
include ActiveRecord::Acts::MuckCommerceUser::InstanceMethods
|
21
28
|
extend ActiveRecord::Acts::MuckCommerceUser::SingletonMethods
|
22
29
|
end
|
@@ -56,7 +63,11 @@ module ActiveRecord
|
|
56
63
|
def build_billing_information(billing_information)
|
57
64
|
BillingInformation.new(billing_information.merge(:default => true, :user_id => self.id))
|
58
65
|
end
|
59
|
-
|
66
|
+
|
67
|
+
def referral_code
|
68
|
+
self.referral_coupon_code ||= Coupon.create(:code => Coupon.random_code, :unlimited => true, :coupon_type => CouponType.user_referral)
|
69
|
+
end
|
70
|
+
|
60
71
|
end
|
61
72
|
|
62
73
|
end
|
@@ -20,6 +20,9 @@ module ActiveRecord
|
|
20
20
|
named_scope :by_newest, :order => 'created_at DESC'
|
21
21
|
named_scope :active, :conditions => 'coupons.expires_at > Now() AND coupons.uses <= use_limit'
|
22
22
|
|
23
|
+
named_scope :referrals, lambda { { :conditions => ["coupon_type_id = ? ", CouponType.user_referral] } }
|
24
|
+
named_scope :default, lambda { { :conditions => ["coupon_type_id = ? ", CouponType.default] } }
|
25
|
+
|
23
26
|
include ActiveRecord::Acts::MuckCoupon::InstanceMethods
|
24
27
|
extend ActiveRecord::Acts::MuckCoupon::SingletonMethods
|
25
28
|
end
|
@@ -19,7 +19,15 @@ module ActiveRecord
|
|
19
19
|
|
20
20
|
# class methods
|
21
21
|
module SingletonMethods
|
22
|
-
|
22
|
+
|
23
|
+
def user_referral
|
24
|
+
self.find_or_create_by_name('Referral')
|
25
|
+
end
|
26
|
+
|
27
|
+
def default
|
28
|
+
self.find_or_create_by_name('Default')
|
29
|
+
end
|
30
|
+
|
23
31
|
end
|
24
32
|
|
25
33
|
# All the methods available to a record that has had <tt>acts_as_muck_billing_information</tt> specified.
|
@@ -14,7 +14,8 @@ module ActiveRecord
|
|
14
14
|
|
15
15
|
belongs_to :user
|
16
16
|
belongs_to :subscription_plan
|
17
|
-
|
17
|
+
|
18
|
+
has_many :subscription_records
|
18
19
|
has_many :order_coupons
|
19
20
|
has_many :coupons, :through => :subscription_coupons
|
20
21
|
has_many :order_transactions, :as => :transactionable, :dependent => :destroy
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Acts #:nodoc:
|
3
|
+
module MuckSubscriptionRecord #:nodoc:
|
4
|
+
def self.included(base)
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
|
10
|
+
# Subscription records are used to record extra information each time a
|
11
|
+
# subscription is billed.
|
12
|
+
def acts_as_muck_subscription_record(options = {})
|
13
|
+
|
14
|
+
validates_presence_of :amount
|
15
|
+
belongs_to :subscription
|
16
|
+
|
17
|
+
include ActiveRecord::Acts::MuckSubscriptionRecord::InstanceMethods
|
18
|
+
extend ActiveRecord::Acts::MuckSubscriptionRecord::SingletonMethods
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
# class methods
|
24
|
+
module SingletonMethods
|
25
|
+
end
|
26
|
+
|
27
|
+
# All the methods available to a record that has had <tt>acts_as_muck_subscription_plan</tt> specified.
|
28
|
+
module InstanceMethods
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/muck_commerce.rb
CHANGED
@@ -20,6 +20,7 @@ ActiveRecord::Base.class_eval { include ActiveRecord::Acts::MuckOrderTransaction
|
|
20
20
|
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::MuckOrderCoupon }
|
21
21
|
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::MuckSubscription }
|
22
22
|
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::MuckSubscriptionPlan }
|
23
|
+
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::MuckSubscriptionRecord }
|
23
24
|
ActionController::Base.class_eval { include ActionController::MuckBillingApplication }
|
24
25
|
|
25
26
|
I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locales', '*.{rb,yml}') ]
|
@@ -5,8 +5,10 @@ end
|
|
5
5
|
Factory.define :billing_information do |f|
|
6
6
|
f.first_name 'test'
|
7
7
|
f.last_name 'guy'
|
8
|
+
f.name 'test guy'
|
9
|
+
f.company { Factory.next(:name) }
|
8
10
|
f.address1 '345 E'
|
9
|
-
f.city
|
11
|
+
f.city { Factory.next(:name) }
|
10
12
|
f.state {|a| a.association(:state) }
|
11
13
|
f.country {|a| a.association(:country) }
|
12
14
|
f.postal_code '88888'
|
@@ -96,6 +98,7 @@ Factory.define :coupon do |f|
|
|
96
98
|
f.uses 0
|
97
99
|
f.use_limit 1
|
98
100
|
f.unlimited false
|
101
|
+
f.coupon_type CouponType.default
|
99
102
|
f.expires_at { Date.new((DateTime.now.year + 2), 10, 10) }
|
100
103
|
end
|
101
104
|
|
@@ -103,6 +106,11 @@ Factory.define :cart do |f|
|
|
103
106
|
f.cartable {|a| a.association(:user)}
|
104
107
|
end
|
105
108
|
|
109
|
+
Factory.define :cart_coupon do |f|
|
110
|
+
f.cart {|a| a.association(:cart)}
|
111
|
+
f.coupon {|a| a.association(:coupon)}
|
112
|
+
end
|
113
|
+
|
106
114
|
def default_billing(options = {})
|
107
115
|
{ :first_name => 'test',
|
108
116
|
:last_name => 'dude',
|
data/muck-commerce.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-commerce}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-29}
|
13
13
|
s.description = %q{Add ecommerce functionality to your muck project. This includes integration with Paypal and Authorize.net. This gem uses active merchant and so adding other gateways should be simple.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -81,6 +81,7 @@ Gem::Specification.new do |s|
|
|
81
81
|
"db/migrate/20100228060913_create_subscription_coupons.rb",
|
82
82
|
"db/migrate/20100309183304_add_coupon_subscrption_uses.rb",
|
83
83
|
"db/migrate/20100310180031_create_coupon_types.rb",
|
84
|
+
"db/migrate/20100327171239_add_subscription_records.rb",
|
84
85
|
"lib/action_controller/muck_billing_application.rb",
|
85
86
|
"lib/active_record/acts/muck_billing_information.rb",
|
86
87
|
"lib/active_record/acts/muck_cart.rb",
|
@@ -93,6 +94,7 @@ Gem::Specification.new do |s|
|
|
93
94
|
"lib/active_record/acts/muck_order_transaction.rb",
|
94
95
|
"lib/active_record/acts/muck_subscription.rb",
|
95
96
|
"lib/active_record/acts/muck_subscription_plan.rb",
|
97
|
+
"lib/active_record/acts/muck_subscription_record.rb",
|
96
98
|
"lib/muck_commerce.rb",
|
97
99
|
"lib/muck_commerce/cart_methods.rb",
|
98
100
|
"lib/muck_commerce/configure.rb",
|
@@ -122,6 +124,7 @@ Gem::Specification.new do |s|
|
|
122
124
|
"test/rails_root/app/models/cart.rb",
|
123
125
|
"test/rails_root/app/models/cart_coupon.rb",
|
124
126
|
"test/rails_root/app/models/coupon.rb",
|
127
|
+
"test/rails_root/app/models/coupon_type.rb",
|
125
128
|
"test/rails_root/app/models/order.rb",
|
126
129
|
"test/rails_root/app/models/order_coupon.rb",
|
127
130
|
"test/rails_root/app/models/order_transaction.rb",
|
@@ -158,8 +161,10 @@ Gem::Specification.new do |s|
|
|
158
161
|
"test/rails_root/db/migrate/20100123035450_create_access_codes.rb",
|
159
162
|
"test/rails_root/db/migrate/20100123233654_create_access_code_requests.rb",
|
160
163
|
"test/rails_root/db/migrate/20100206000906_remove_name_fields.rb",
|
164
|
+
"test/rails_root/db/migrate/20100228060913_create_subscription_coupons.rb",
|
161
165
|
"test/rails_root/db/migrate/20100309183304_add_coupon_subscrption_uses.rb",
|
162
166
|
"test/rails_root/db/migrate/20100310180031_create_coupon_types.rb",
|
167
|
+
"test/rails_root/db/migrate/20100327171239_add_subscription_records.rb",
|
163
168
|
"test/rails_root/features/step_definitions/webrat_steps.rb",
|
164
169
|
"test/rails_root/features/support/env.rb",
|
165
170
|
"test/rails_root/lib/tasks/muck.rake",
|
@@ -181,8 +186,13 @@ Gem::Specification.new do |s|
|
|
181
186
|
"test/rails_root/public/images/arrow_right.gif",
|
182
187
|
"test/rails_root/public/images/arrow_up.gif",
|
183
188
|
"test/rails_root/public/images/blue/preview.gif",
|
189
|
+
"test/rails_root/public/images/fancybox/blank.gif",
|
190
|
+
"test/rails_root/public/images/fancybox/fancy_close.png",
|
184
191
|
"test/rails_root/public/images/fancybox/fancy_closebox.png",
|
185
192
|
"test/rails_root/public/images/fancybox/fancy_left.png",
|
193
|
+
"test/rails_root/public/images/fancybox/fancy_loading.png",
|
194
|
+
"test/rails_root/public/images/fancybox/fancy_nav_left.png",
|
195
|
+
"test/rails_root/public/images/fancybox/fancy_nav_right.png",
|
186
196
|
"test/rails_root/public/images/fancybox/fancy_progress.png",
|
187
197
|
"test/rails_root/public/images/fancybox/fancy_right.png",
|
188
198
|
"test/rails_root/public/images/fancybox/fancy_shadow_e.png",
|
@@ -195,7 +205,11 @@ Gem::Specification.new do |s|
|
|
195
205
|
"test/rails_root/public/images/fancybox/fancy_shadow_w.png",
|
196
206
|
"test/rails_root/public/images/fancybox/fancy_title_left.png",
|
197
207
|
"test/rails_root/public/images/fancybox/fancy_title_main.png",
|
208
|
+
"test/rails_root/public/images/fancybox/fancy_title_over.png",
|
198
209
|
"test/rails_root/public/images/fancybox/fancy_title_right.png",
|
210
|
+
"test/rails_root/public/images/fancybox/fancybox-x.png",
|
211
|
+
"test/rails_root/public/images/fancybox/fancybox-y.png",
|
212
|
+
"test/rails_root/public/images/fancybox/fancybox.png",
|
199
213
|
"test/rails_root/public/images/icons/accept.png",
|
200
214
|
"test/rails_root/public/images/icons/add.png",
|
201
215
|
"test/rails_root/public/images/icons/blue_guy.png",
|
@@ -589,6 +603,7 @@ Gem::Specification.new do |s|
|
|
589
603
|
"test/rails_root/public/javascripts/jquery/jquery.jgrowl.js",
|
590
604
|
"test/rails_root/public/javascripts/jquery/jquery.js",
|
591
605
|
"test/rails_root/public/javascripts/jquery/jquery.metadata.min.js",
|
606
|
+
"test/rails_root/public/javascripts/jquery/jquery.mousewheel.js",
|
592
607
|
"test/rails_root/public/javascripts/jquery/jquery.queryString.js",
|
593
608
|
"test/rails_root/public/javascripts/jquery/jquery.swapimage.js",
|
594
609
|
"test/rails_root/public/javascripts/jquery/jquery.swapimage.min.js",
|
@@ -735,11 +750,14 @@ Gem::Specification.new do |s|
|
|
735
750
|
"test/rails_root/test/functional/admin/billing_informations_controller_test.rb",
|
736
751
|
"test/rails_root/test/functional/admin/coupons_controller_test.rb",
|
737
752
|
"test/rails_root/test/functional/admin/subscription_plans_controller_test.rb",
|
738
|
-
"test/rails_root/test/functional/
|
753
|
+
"test/rails_root/test/functional/billing_informations_controller_test.rb",
|
739
754
|
"test/rails_root/test/functional/carts_controller_test.rb",
|
740
755
|
"test/rails_root/test/functional/orders_controller_test.rb",
|
741
756
|
"test/rails_root/test/functional/subscription_controller_test.rb",
|
742
757
|
"test/rails_root/test/test_helper.rb",
|
758
|
+
"test/rails_root/test/unit/cart_coupon_test.rb",
|
759
|
+
"test/rails_root/test/unit/coupon_test.rb",
|
760
|
+
"test/rails_root/test/unit/coupon_type_test.rb",
|
743
761
|
"test/rails_root/test/unit/order_test.rb",
|
744
762
|
"test/rails_root/test/unit/order_transaction_test.rb",
|
745
763
|
"test/rails_root/test/unit/subscription_test.rb",
|
@@ -805,6 +823,7 @@ Gem::Specification.new do |s|
|
|
805
823
|
"test/rails_root/app/models/cart.rb",
|
806
824
|
"test/rails_root/app/models/cart_coupon.rb",
|
807
825
|
"test/rails_root/app/models/coupon.rb",
|
826
|
+
"test/rails_root/app/models/coupon_type.rb",
|
808
827
|
"test/rails_root/app/models/order.rb",
|
809
828
|
"test/rails_root/app/models/order_coupon.rb",
|
810
829
|
"test/rails_root/app/models/order_transaction.rb",
|
@@ -838,8 +857,10 @@ Gem::Specification.new do |s|
|
|
838
857
|
"test/rails_root/db/migrate/20100123035450_create_access_codes.rb",
|
839
858
|
"test/rails_root/db/migrate/20100123233654_create_access_code_requests.rb",
|
840
859
|
"test/rails_root/db/migrate/20100206000906_remove_name_fields.rb",
|
860
|
+
"test/rails_root/db/migrate/20100228060913_create_subscription_coupons.rb",
|
841
861
|
"test/rails_root/db/migrate/20100309183304_add_coupon_subscrption_uses.rb",
|
842
862
|
"test/rails_root/db/migrate/20100310180031_create_coupon_types.rb",
|
863
|
+
"test/rails_root/db/migrate/20100327171239_add_subscription_records.rb",
|
843
864
|
"test/rails_root/features/step_definitions/webrat_steps.rb",
|
844
865
|
"test/rails_root/features/support/env.rb",
|
845
866
|
"test/rails_root/public/dispatch.rb",
|
@@ -851,11 +872,14 @@ Gem::Specification.new do |s|
|
|
851
872
|
"test/rails_root/test/functional/admin/billing_informations_controller_test.rb",
|
852
873
|
"test/rails_root/test/functional/admin/coupons_controller_test.rb",
|
853
874
|
"test/rails_root/test/functional/admin/subscription_plans_controller_test.rb",
|
854
|
-
"test/rails_root/test/functional/
|
875
|
+
"test/rails_root/test/functional/billing_informations_controller_test.rb",
|
855
876
|
"test/rails_root/test/functional/carts_controller_test.rb",
|
856
877
|
"test/rails_root/test/functional/orders_controller_test.rb",
|
857
878
|
"test/rails_root/test/functional/subscription_controller_test.rb",
|
858
879
|
"test/rails_root/test/test_helper.rb",
|
880
|
+
"test/rails_root/test/unit/cart_coupon_test.rb",
|
881
|
+
"test/rails_root/test/unit/coupon_test.rb",
|
882
|
+
"test/rails_root/test/unit/coupon_type_test.rb",
|
859
883
|
"test/rails_root/test/unit/order_test.rb",
|
860
884
|
"test/rails_root/test/unit/order_transaction_test.rb",
|
861
885
|
"test/rails_root/test/unit/subscription_test.rb",
|
@@ -47,15 +47,6 @@ class CreateMuckCommerce < ActiveRecord::Migration
|
|
47
47
|
end
|
48
48
|
add_index "cart_coupons", ["cart_id", "coupon_id"]
|
49
49
|
|
50
|
-
|
51
|
-
create_table :order_coupons, :force => true do |t|
|
52
|
-
t.integer "order_id"
|
53
|
-
t.integer "coupon_id"
|
54
|
-
t.timestamps
|
55
|
-
end
|
56
|
-
add_index "order_coupons", ["order_id", "coupon_id"]
|
57
|
-
|
58
|
-
|
59
50
|
create_table :coupons, :force => true do |t|
|
60
51
|
t.string "code"
|
61
52
|
t.integer "amount", :default => 0, :null => false
|
@@ -102,6 +93,14 @@ class CreateMuckCommerce < ActiveRecord::Migration
|
|
102
93
|
add_index "orders", ["orderable_id", "orderable_type"]
|
103
94
|
|
104
95
|
|
96
|
+
create_table :order_coupons, :force => true do |t|
|
97
|
+
t.integer "order_id"
|
98
|
+
t.integer "coupon_id"
|
99
|
+
t.timestamps
|
100
|
+
end
|
101
|
+
add_index "order_coupons", ["order_id", "coupon_id"]
|
102
|
+
|
103
|
+
|
105
104
|
create_table :subscription_plans, :force => true do |t|
|
106
105
|
t.string "name"
|
107
106
|
t.string "sku"
|
@@ -119,7 +118,6 @@ class CreateMuckCommerce < ActiveRecord::Migration
|
|
119
118
|
t.datetime "next_renewal_at"
|
120
119
|
t.string "aasm_state", :default => "trial"
|
121
120
|
t.integer "subscription_plan_id"
|
122
|
-
t.integer "coupon_id"
|
123
121
|
t.integer "renewal_period"
|
124
122
|
t.string "number"
|
125
123
|
t.integer "failed_billing_attempts", :default => 0, :null => false
|
@@ -130,7 +128,7 @@ class CreateMuckCommerce < ActiveRecord::Migration
|
|
130
128
|
t.timestamps
|
131
129
|
end
|
132
130
|
add_index "subscriptions", ["user_id"]
|
133
|
-
|
131
|
+
|
134
132
|
end
|
135
133
|
|
136
134
|
def self.down
|