erp_commerce 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.rdoc +2 -0
- data/Rakefile +32 -0
- data/app/assets/javascripts/erp_commerce/application.js +9 -0
- data/app/assets/stylesheets/erp_commerce/application.css +7 -0
- data/app/controllers/erp_commerce/application_controller.rb +4 -0
- data/app/helpers/erp_commerce/application_helper.rb +4 -0
- data/app/models/credit_card.rb +54 -0
- data/app/models/credit_card_account.rb +4 -0
- data/app/models/credit_card_account_party_role.rb +8 -0
- data/app/models/credit_card_account_purpose.rb +6 -0
- data/app/models/credit_card_token.rb +12 -0
- data/app/models/extensions/charge_line.rb +3 -0
- data/app/models/extensions/currency.rb +3 -0
- data/app/models/extensions/financial_txn.rb +3 -0
- data/app/models/extensions/order_txn.rb +3 -0
- data/app/models/extensions/party.rb +21 -0
- data/app/models/extensions/product_instance.rb +5 -0
- data/app/models/extensions/product_type.rb +3 -0
- data/app/models/fee.rb +7 -0
- data/app/models/fee_type.rb +4 -0
- data/app/models/payment.rb +38 -0
- data/app/models/payment_gateway.rb +4 -0
- data/app/models/payment_gateway_action.rb +2 -0
- data/app/models/price.rb +25 -0
- data/app/models/price_component.rb +8 -0
- data/app/models/price_component_type.rb +3 -0
- data/app/models/pricing_plan.rb +37 -0
- data/app/models/pricing_plan_assignment.rb +6 -0
- data/app/models/pricing_plan_component.rb +36 -0
- data/app/models/valid_price_plan_component.rb +8 -0
- data/app/views/layouts/erp_commerce/application.html.erb +14 -0
- data/app/widgets/orders/base.rb +40 -0
- data/app/widgets/orders/javascript/orders.js +11 -0
- data/app/widgets/orders/views/index.html.erb +63 -0
- data/app/widgets/product_catalog/base.rb +56 -0
- data/app/widgets/product_catalog/javascript/product_catalog.js +62 -0
- data/app/widgets/product_catalog/views/add_to_cart.html.erb +10 -0
- data/app/widgets/product_catalog/views/index.html.erb +69 -0
- data/app/widgets/product_catalog/views/show.html.erb +23 -0
- data/app/widgets/shopping_cart/base.rb +178 -0
- data/app/widgets/shopping_cart/javascript/shopping_cart.js +107 -0
- data/app/widgets/shopping_cart/views/cart_items.html.erb +83 -0
- data/app/widgets/shopping_cart/views/confirmation.html.erb +10 -0
- data/app/widgets/shopping_cart/views/demographics.html.erb +142 -0
- data/app/widgets/shopping_cart/views/login.html.erb +1 -0
- data/app/widgets/shopping_cart/views/payment.html.erb +81 -0
- data/app/widgets/shopping_cart/views/price_summary.html.erb +4 -0
- data/config/routes.rb +2 -0
- data/db/data_migrations/20101011152441_payment_gateway_actions.rb +27 -0
- data/db/migrate/20100823174238_erp_commerce_base.rb +174 -0
- data/db/migrate/20100913154134_setup_payments.rb +57 -0
- data/db/migrate/20101103132342_pricing_migrations.rb +169 -0
- data/db/migrate/20110921150854_create_fees.rb +50 -0
- data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +66 -0
- data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +34 -0
- data/lib/erp_commerce/active_merchant_wrappers.rb +2 -0
- data/lib/erp_commerce/engine.rb +15 -0
- data/lib/erp_commerce/extensions/active_record/acts_as_fee.rb +64 -0
- data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +57 -0
- data/lib/erp_commerce/extensions.rb +2 -0
- data/lib/erp_commerce/order_helper.rb +254 -0
- data/lib/erp_commerce/version.rb +3 -0
- data/lib/erp_commerce.rb +8 -0
- data/lib/tasks/erp_commerce_tasks.rake +4 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +49 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/credit_card_account_party_role_spec.rb +11 -0
- data/spec/models/credit_card_account_purpose_spec.rb +11 -0
- data/spec/models/credit_card_account_spec.rb +11 -0
- data/spec/models/credit_card_spec.rb +11 -0
- data/spec/models/fee_spec.rb +11 -0
- data/spec/models/fee_type_spec.rb +11 -0
- data/spec/models/payment_gateway_action_spec.rb +11 -0
- data/spec/models/payment_gateway_spec.rb +11 -0
- data/spec/models/payment_spec.rb +11 -0
- data/spec/models/price_component_spec.rb +11 -0
- data/spec/models/price_component_type_spec.rb +11 -0
- data/spec/models/price_spec.rb +11 -0
- data/spec/models/pricing_plan_assignment_spec.rb +11 -0
- data/spec/models/pricing_plan_component_spec.rb +11 -0
- data/spec/models/pricing_plan_spec.rb +11 -0
- data/spec/models/valid_price_plan_component_spec.rb +11 -0
- data/spec/spec_helper.rb +60 -0
- metadata +285 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
module ErpCommerce
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsFee
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def acts_as_fee
|
11
|
+
extend ActsAsFee::SingletonMethods
|
12
|
+
include ActsAsFee::InstanceMethods
|
13
|
+
|
14
|
+
after_initialize :new_fee
|
15
|
+
after_update :save_fee
|
16
|
+
after_save :save_fee
|
17
|
+
after_destroy :destroy_fee
|
18
|
+
|
19
|
+
has_one :fee, :as => :fee_record
|
20
|
+
|
21
|
+
#from Fee
|
22
|
+
[ :money, :money=,
|
23
|
+
:fee_type, :fee_type=,
|
24
|
+
:description, :description=,
|
25
|
+
:start_date, :start_date=,
|
26
|
+
:end_date, :end_date=,
|
27
|
+
:external_identifier, :external_identifier=,
|
28
|
+
:external_id_source, :external_id_source=,
|
29
|
+
:created_at,
|
30
|
+
:updated_at
|
31
|
+
].each { |m| delegate m, :to => :fee }
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
module SingletonMethods
|
38
|
+
end
|
39
|
+
|
40
|
+
module InstanceMethods
|
41
|
+
def fee
|
42
|
+
self.fee
|
43
|
+
end
|
44
|
+
|
45
|
+
def new_fee
|
46
|
+
if self.new_record? && self.fee == nil
|
47
|
+
self.fee = Fee.new
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def save_fee
|
52
|
+
self.fee.save_with_validation!
|
53
|
+
end
|
54
|
+
|
55
|
+
def destroy_fee
|
56
|
+
if self.fee && !self.fee.frozen?
|
57
|
+
self.fee.destroy
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module ErpCommerce
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsPriceable
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def acts_as_priceable
|
12
|
+
extend ActsAsPriceable::SingletonMethods
|
13
|
+
include ActsAsPriceable::InstanceMethods
|
14
|
+
|
15
|
+
has_many :pricing_plan_assignments, :as => :priceable_item
|
16
|
+
has_many :pricing_plans, :through => :pricing_plan_assignments, :dependent => :destroy
|
17
|
+
has_many :prices, :as => :priced_item, :dependent => :destroy
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module SingletonMethods
|
23
|
+
end
|
24
|
+
|
25
|
+
module InstanceMethods
|
26
|
+
def get_default_price
|
27
|
+
self.pricing_plans.first.get_price
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_current_simple_amount_with_currency
|
31
|
+
amount = nil
|
32
|
+
plan = get_current_simple_plan
|
33
|
+
unless plan.nil?
|
34
|
+
amount = help.number_to_currency(plan.money_amount, :unit => plan.currency.symbol)
|
35
|
+
end
|
36
|
+
amount
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_current_simple_plan
|
40
|
+
self.pricing_plans.find(:first,
|
41
|
+
:conditions => ['is_simple_amount = ? and from_date <= ? and thru_date >= ?', true, Date.today, Date.today])
|
42
|
+
end
|
43
|
+
|
44
|
+
class Helper
|
45
|
+
include Singleton
|
46
|
+
include ActionView::Helpers::NumberHelper
|
47
|
+
end
|
48
|
+
|
49
|
+
def help
|
50
|
+
Helper.instance
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
module ErpCommerce
|
2
|
+
class OrderHelper
|
3
|
+
attr_accessor :widget
|
4
|
+
delegate :params, :session, :request, :logger, :current_user, :to => :widget
|
5
|
+
|
6
|
+
def initialize(widget)
|
7
|
+
self.widget = widget
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_order(create=nil)
|
11
|
+
order = nil
|
12
|
+
unless session['order_txn_id'].nil?
|
13
|
+
order = OrderTxn.where('id = ?',session['order_txn_id']).first
|
14
|
+
order = create_order if order.nil?
|
15
|
+
else
|
16
|
+
order = create_order if create
|
17
|
+
end
|
18
|
+
order
|
19
|
+
end
|
20
|
+
|
21
|
+
#add a product type to cart
|
22
|
+
def add_to_cart(product_type)
|
23
|
+
order = get_order(true)
|
24
|
+
|
25
|
+
#see if we need to update quantity or create new line item
|
26
|
+
order_line_item = get_line_item_for_product_type(product_type)
|
27
|
+
if order_line_item.nil? || order_line_item.empty?
|
28
|
+
#create order line item
|
29
|
+
order_line_item = order.add_line_item(product_type)
|
30
|
+
|
31
|
+
#get pricing plan and create charge lines
|
32
|
+
pricing_plan = product_type.get_current_simple_plan
|
33
|
+
money = Money.create(
|
34
|
+
:description => pricing_plan.description,
|
35
|
+
:amount => pricing_plan.money_amount,
|
36
|
+
:currency => pricing_plan.currency)
|
37
|
+
|
38
|
+
charge_line = ChargeLine.create(
|
39
|
+
:charged_item => order_line_item,
|
40
|
+
:money => money,
|
41
|
+
:description => pricing_plan.description)
|
42
|
+
charge_line.save
|
43
|
+
order_line_item.charge_lines << charge_line
|
44
|
+
order.status = 'Items Added'
|
45
|
+
order.save
|
46
|
+
else
|
47
|
+
#update quantity
|
48
|
+
end
|
49
|
+
order
|
50
|
+
end
|
51
|
+
|
52
|
+
#set billing information
|
53
|
+
def set_demographic_info(params)
|
54
|
+
order = get_order
|
55
|
+
|
56
|
+
#if biz txn party roles have not been setup set them up
|
57
|
+
if order.root_txn.biz_txn_party_roles.nil? || order.root_txn.biz_txn_party_roles.empty?
|
58
|
+
setup_biz_txn_party_roles(order)
|
59
|
+
end
|
60
|
+
|
61
|
+
party = self.current_user.party
|
62
|
+
|
63
|
+
#set billing information on party
|
64
|
+
#get geo codes
|
65
|
+
geo_country = GeoCountry.find_by_iso_code_2(params[:bill_to_country])
|
66
|
+
geo_zone = GeoZone.find_by_zone_code(params[:bill_to_state])
|
67
|
+
party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.billing,
|
68
|
+
{
|
69
|
+
:address_line_1 => params[:bill_to_address_line_1],
|
70
|
+
:address_line_2 => params[:bill_to_address_line_2],
|
71
|
+
:city => params[:bill_to_city],
|
72
|
+
:state => geo_zone.zone_name,
|
73
|
+
:zip => params[:bill_to_postal_code],
|
74
|
+
:country => geo_country.name
|
75
|
+
})
|
76
|
+
billing_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.billing)
|
77
|
+
billing_postal_address.geo_country = geo_country
|
78
|
+
billing_postal_address.geo_zone = geo_zone
|
79
|
+
billing_postal_address.save
|
80
|
+
|
81
|
+
#set shipping information on party
|
82
|
+
#same as billing us billing info
|
83
|
+
if params[:ship_to_billing] == 'on'
|
84
|
+
#get geo codes
|
85
|
+
geo_country = GeoCountry.find_by_iso_code_2(params[:bill_to_country])
|
86
|
+
geo_zone = GeoZone.find_by_zone_code(params[:bill_to_state])
|
87
|
+
party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.shipping,
|
88
|
+
{
|
89
|
+
:address_line_1 => params[:bill_to_address_line_1],
|
90
|
+
:address_line_2 => params[:bill_to_address_line_2],
|
91
|
+
:city => params[:bill_to_city],
|
92
|
+
:state => geo_zone.zone_name,
|
93
|
+
:zip => params[:bill_to_postal_code],
|
94
|
+
:country => geo_country.name
|
95
|
+
})
|
96
|
+
shipping_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.shipping)
|
97
|
+
shipping_postal_address.geo_country = geo_country
|
98
|
+
shipping_postal_address.geo_zone = geo_zone
|
99
|
+
shipping_postal_address.save
|
100
|
+
else
|
101
|
+
#get geo codes
|
102
|
+
geo_country = GeoCountry.find_by_iso_code_2(params[:ship_to_country])
|
103
|
+
geo_zone = GeoZone.find_by_zone_code(params[:ship_to_state])
|
104
|
+
party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.shipping,
|
105
|
+
{
|
106
|
+
:address_line_1 => params[:ship_to_address_line_1],
|
107
|
+
:address_line_2 => params[:ship_to_address_line_2],
|
108
|
+
:city => params[:ship_to_city],
|
109
|
+
:state => geo_zone.zone_name,
|
110
|
+
:zip => params[:ship_to_postal_code],
|
111
|
+
:country => geo_country.name
|
112
|
+
})
|
113
|
+
shipping_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.shipping)
|
114
|
+
shipping_postal_address.geo_country = geo_country
|
115
|
+
shipping_postal_address.geo_zone = geo_zone
|
116
|
+
shipping_postal_address.save
|
117
|
+
end
|
118
|
+
|
119
|
+
#set phone and email
|
120
|
+
party.update_or_add_contact_with_purpose(PhoneNumber, ContactPurpose.billing, {:phone_number => params[:bill_to_phone]})
|
121
|
+
party.update_or_add_contact_with_purpose(EmailAddress, ContactPurpose.billing, {:email_address => params[:bill_to_email]})
|
122
|
+
|
123
|
+
#set billing and shipping info on order
|
124
|
+
order.set_shipping_info(party)
|
125
|
+
order.set_billing_info(party)
|
126
|
+
|
127
|
+
#update status
|
128
|
+
order.status = 'Demographics Gathered'
|
129
|
+
order.save
|
130
|
+
|
131
|
+
order
|
132
|
+
end
|
133
|
+
|
134
|
+
#complete the order
|
135
|
+
def complete_order(params, charge_credit_card=true)
|
136
|
+
success = true
|
137
|
+
message = nil
|
138
|
+
order = get_order
|
139
|
+
|
140
|
+
if charge_credit_card
|
141
|
+
#make credit financial txns and payment txns
|
142
|
+
#create financial txn for order
|
143
|
+
financial_txn = create_financial_txns(order)
|
144
|
+
#fire the purchase method with the passed gatewaywrapper
|
145
|
+
result = financial_txn.purchase(
|
146
|
+
build_credit_card_hash(params),
|
147
|
+
ErpCommerce::ActiveMerchantWrappers::BrainTreeGatewayWrapper,
|
148
|
+
{:login => 'demo', :password => 'password'}
|
149
|
+
)
|
150
|
+
#make sure cedit card payment was successful
|
151
|
+
if result[:payment].nil? or !result[:payment].success
|
152
|
+
success = false
|
153
|
+
message = result[:message]
|
154
|
+
order.status = 'Credit Card Failed'
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if success
|
159
|
+
order.status = 'Pending Shipment'
|
160
|
+
#update inventory counts
|
161
|
+
#should be moved to model somewhere
|
162
|
+
order.order_line_items.each do |oli|
|
163
|
+
inventory_entry = oli.product_type.inventory_entries.first
|
164
|
+
inventory_entry.number_available -= 1
|
165
|
+
inventory_entry.number_sold += 1
|
166
|
+
inventory_entry.save
|
167
|
+
end
|
168
|
+
#clear order from session
|
169
|
+
clear_order
|
170
|
+
end
|
171
|
+
|
172
|
+
order.save
|
173
|
+
return success, message, order
|
174
|
+
end
|
175
|
+
|
176
|
+
#remove line item
|
177
|
+
def remove_from_cart(order_line_item_id)
|
178
|
+
order = get_order
|
179
|
+
|
180
|
+
order.line_items.find(order_line_item_id).destroy
|
181
|
+
|
182
|
+
order
|
183
|
+
end
|
184
|
+
|
185
|
+
private
|
186
|
+
|
187
|
+
def get_line_item_for_product_type(product_type)
|
188
|
+
order = get_order(true)
|
189
|
+
order.line_items.select{|oli| oli.product_type == product_type.id}
|
190
|
+
end
|
191
|
+
|
192
|
+
def clear_order
|
193
|
+
session['order_txn_id'] = nil
|
194
|
+
end
|
195
|
+
|
196
|
+
def create_order
|
197
|
+
order = OrderTxn.create
|
198
|
+
order.status = 'Initialized'
|
199
|
+
order.order_number = (Time.now.to_i / (rand(100)+2)).round
|
200
|
+
order.save
|
201
|
+
session['order_txn_id'] = order.id
|
202
|
+
setup_biz_txn_party_roles(order) unless self.current_user.nil?
|
203
|
+
order
|
204
|
+
end
|
205
|
+
|
206
|
+
#sets up payor party role
|
207
|
+
def setup_biz_txn_party_roles(order)
|
208
|
+
payor_role = BizTxnPartyRoleType.find_by_internal_identifier('payor')
|
209
|
+
biz_txn_event = order.root_txn
|
210
|
+
tpr = BizTxnPartyRole.new
|
211
|
+
tpr.biz_txn_event = biz_txn_event
|
212
|
+
tpr.party = self.current_user.party
|
213
|
+
tpr.biz_txn_party_role_type = payor_role
|
214
|
+
tpr.save
|
215
|
+
end
|
216
|
+
|
217
|
+
#create financial_txn for charge lines
|
218
|
+
def create_financial_txns(order)
|
219
|
+
#total up all order line items charge lines
|
220
|
+
total_payment = 0
|
221
|
+
currency = nil
|
222
|
+
order.get_total_charges.each do |money|
|
223
|
+
total_payment += money.amount
|
224
|
+
currency = money.currency
|
225
|
+
end
|
226
|
+
|
227
|
+
financial_txn = FinancialTxn.create(:money => Money.create(:description => 'Order Payment', :amount => total_payment, :currency => currency))
|
228
|
+
financial_txn.description = 'Order Payment'
|
229
|
+
financial_txn.txn_type = BizTxnType.iid('payment_txn')
|
230
|
+
financial_txn.save
|
231
|
+
|
232
|
+
order.get_all_charge_lines.each do |charge_line|
|
233
|
+
charge_line.add_payment_txn(financial_txn)
|
234
|
+
charge_line.save
|
235
|
+
end
|
236
|
+
|
237
|
+
financial_txn
|
238
|
+
end
|
239
|
+
|
240
|
+
def build_credit_card_hash(params)
|
241
|
+
credit_card = {}
|
242
|
+
|
243
|
+
credit_card[:number] = params[:card_number]
|
244
|
+
credit_card[:exp_month] = params[:exp_month]
|
245
|
+
credit_card[:exp_year] = params[:exp_year]
|
246
|
+
credit_card[:cvvs] = params[:cvvs]
|
247
|
+
credit_card[:first_name] = params[:first_name]
|
248
|
+
credit_card[:last_name] = params[:last_name]
|
249
|
+
|
250
|
+
credit_card
|
251
|
+
end
|
252
|
+
|
253
|
+
end#ErpCommerce
|
254
|
+
end#OrderHelper
|
data/lib/erp_commerce.rb
ADDED
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require
|
6
|
+
require "erp_base_erp_svcs"
|
7
|
+
require "erp_tech_svcs"
|
8
|
+
require "erp_app"
|
9
|
+
require "erp_agreements"
|
10
|
+
require "erp_txns_and_accts"
|
11
|
+
require "erp_products"
|
12
|
+
require "erp_orders"
|
13
|
+
require "erp_commerce"
|
14
|
+
|
15
|
+
module Dummy
|
16
|
+
class Application < Rails::Application
|
17
|
+
# Settings in config/environments/* take precedence over those specified here.
|
18
|
+
# Application configuration should go into files in config/initializers
|
19
|
+
# -- all .rb files in that directory are automatically loaded.
|
20
|
+
|
21
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
22
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
23
|
+
|
24
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
25
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
26
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
27
|
+
|
28
|
+
# Activate observers that should always be running.
|
29
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
30
|
+
|
31
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
32
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
33
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
34
|
+
|
35
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
36
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
37
|
+
# config.i18n.default_locale = :de
|
38
|
+
|
39
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
40
|
+
config.encoding = "utf-8"
|
41
|
+
|
42
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
43
|
+
config.filter_parameters += [:password]
|
44
|
+
|
45
|
+
# Enable the asset pipeline
|
46
|
+
config.assets.enabled = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Warning: The database defined as "test" will be erased and
|
2
|
+
# re-generated from your development database when you run "rake".
|
3
|
+
# Do not set this db to the same as development or production.
|
4
|
+
spec:
|
5
|
+
adapter: sqlite3
|
6
|
+
database: db/spec.sqlite3
|
7
|
+
pool: 5
|
8
|
+
timeout: 5000
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'ae0d58840f73a49e40850c9d815a6a135e169865cdb8721cec7f335a738af09f3483de0f99d7c131f8fdecf2d8b508f8fd5e2e33c8d0565dcc9030eadb227695'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActionController::Base.wrap_parameters :format => [:json]
|
8
|
+
|
9
|
+
# Disable root element in JSON by default.
|
10
|
+
if defined?(ActiveRecord)
|
11
|
+
ActiveRecord::Base.include_root_in_json = false
|
12
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|