erp_commerce 4.0.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/models/accepted_credit_card.rb +10 -0
- data/app/models/bank_account.rb +13 -0
- data/app/models/bank_account_type.rb +9 -0
- data/app/models/credit_card.rb +54 -19
- data/app/models/credit_card_account.rb +31 -9
- data/app/models/credit_card_account_party_role.rb +17 -0
- data/app/models/credit_card_account_purpose.rb +24 -0
- data/app/models/extensions/financial_txn.rb +62 -1
- data/app/models/extensions/order_txn.rb +48 -0
- data/app/models/extensions/party.rb +26 -13
- data/app/models/extensions/simple_product_offer.rb +3 -0
- data/app/models/payment.rb +21 -0
- data/app/models/payment_gateway.rb +12 -0
- data/app/models/payment_gateway_action.rb +12 -0
- data/app/models/pricing_plan.rb +29 -1
- data/db/data_migrations/20150125202814_add_payment_transaction_types.rb +14 -0
- data/db/migrate/20100823174238_erp_commerce_base.rb +196 -192
- data/db/migrate/20160310163057_add_created_by_updated_by_to_erp_commerce.rb +35 -0
- data/lib/erp_commerce.rb +1 -2
- data/lib/erp_commerce/config.rb +2 -3
- data/lib/erp_commerce/engine.rb +1 -5
- data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +1 -2
- data/lib/erp_commerce/version.rb +1 -1
- metadata +12 -32
- data/app/mailers/checkout_mailer.rb +0 -9
- data/app/views/checkout_mailer/email_confirmation.html.erb +0 -15
- data/app/widgets/orders/base.rb +0 -36
- data/app/widgets/orders/javascript/orders.js +0 -12
- data/app/widgets/orders/views/index.html.erb +0 -63
- data/app/widgets/product_catalog/base.rb +0 -52
- data/app/widgets/product_catalog/javascript/product_catalog.js +0 -64
- data/app/widgets/product_catalog/views/add_to_cart.html.erb +0 -10
- data/app/widgets/product_catalog/views/index.html.erb +0 -69
- data/app/widgets/product_catalog/views/show.html.erb +0 -23
- data/app/widgets/shopping_cart/base.rb +0 -175
- data/app/widgets/shopping_cart/javascript/shopping_cart.js +0 -110
- data/app/widgets/shopping_cart/views/cart_items.html.erb +0 -83
- data/app/widgets/shopping_cart/views/confirmation.html.erb +0 -11
- data/app/widgets/shopping_cart/views/demographics.html.erb +0 -142
- data/app/widgets/shopping_cart/views/login.html.erb +0 -1
- data/app/widgets/shopping_cart/views/payment.html.erb +0 -81
- data/app/widgets/shopping_cart/views/price_summary.html.erb +0 -4
- data/lib/erp_commerce/active_merchant_wrappers.rb +0 -3
- data/lib/erp_commerce/active_merchant_wrappers/authorize_net_wrapper.rb +0 -66
- data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +0 -68
- data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +0 -34
- data/lib/erp_commerce/order_helper.rb +0 -245
data/app/models/payment.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#### Table Definition ###########################
|
2
|
+
# create_table :payments do |t|
|
3
|
+
#
|
4
|
+
# t.column :success, :boolean
|
5
|
+
# t.column :reference_number, :string
|
6
|
+
# t.column :financial_txn_id, :integer
|
7
|
+
# t.column :current_state, :string
|
8
|
+
# t.column :authorization_code, :string
|
9
|
+
# t.string :external_identifier
|
10
|
+
#
|
11
|
+
# t.timestamps
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# add_index :payments, :financial_txn_id
|
15
|
+
#################################################
|
16
|
+
|
1
17
|
class Payment < ActiveRecord::Base
|
2
18
|
attr_protected :created_at, :updated_at
|
3
19
|
|
@@ -14,6 +30,7 @@ class Payment < ActiveRecord::Base
|
|
14
30
|
aasm_state :declined
|
15
31
|
aasm_state :authorized
|
16
32
|
aasm_state :captured
|
33
|
+
aasm_state :refunded
|
17
34
|
aasm_state :authorization_reversed
|
18
35
|
aasm_state :canceled
|
19
36
|
aasm_state :returned
|
@@ -46,4 +63,8 @@ class Payment < ActiveRecord::Base
|
|
46
63
|
transitions :to => :returned, :from => [:pending, :captured]
|
47
64
|
end
|
48
65
|
|
66
|
+
aasm_event :refund do
|
67
|
+
transitions :to => :refunded, :from => [:captured]
|
68
|
+
end
|
69
|
+
|
49
70
|
end
|
@@ -1,3 +1,15 @@
|
|
1
|
+
### Table Definition ###############################
|
2
|
+
# create_table :payment_gateways do |t|
|
3
|
+
#
|
4
|
+
# t.column :params, :string
|
5
|
+
# t.column :payment_gateway_action_id, :integer
|
6
|
+
# t.column :payment_id, :integer
|
7
|
+
# t.column :response, :string
|
8
|
+
#
|
9
|
+
# t.timestamps
|
10
|
+
# end
|
11
|
+
####################################################
|
12
|
+
|
1
13
|
class PaymentGateway < ActiveRecord::Base
|
2
14
|
attr_protected :created_at, :updated_at
|
3
15
|
|
@@ -1,3 +1,15 @@
|
|
1
|
+
#### Table Definition ###########################
|
2
|
+
# create_table :payment_gateway_actions do |t|
|
3
|
+
#
|
4
|
+
# t.column :internal_identifier, :string
|
5
|
+
# t.column :description, :string
|
6
|
+
#
|
7
|
+
# t.timestamps
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# add_index :payment_gateway_actions, :internal_identifier
|
11
|
+
#################################################
|
12
|
+
|
1
13
|
class PaymentGatewayAction < ActiveRecord::Base
|
2
14
|
attr_protected :created_at, :updated_at
|
3
15
|
end
|
data/app/models/pricing_plan.rb
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
#### Table Definition ####################################
|
2
|
+
# create_table :pricing_plans do |t|
|
3
|
+
#
|
4
|
+
# t.string :description
|
5
|
+
# t.string :comments
|
6
|
+
#
|
7
|
+
# t.string :internal_identifier
|
8
|
+
#
|
9
|
+
# t.string :external_identifier
|
10
|
+
# t.string :external_id_source
|
11
|
+
#
|
12
|
+
# t.date :from_date
|
13
|
+
# t.date :thru_date
|
14
|
+
#
|
15
|
+
# #this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
16
|
+
# t.string :matching_rules
|
17
|
+
# #this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
18
|
+
# t.string :pricing_calculation
|
19
|
+
#
|
20
|
+
# #support for simple assignment of a single money amount
|
21
|
+
# t.boolean :is_simple_amount
|
22
|
+
# t.integer :currency_id
|
23
|
+
# t.decimal :money_amount, :precision => 8, :scale => 2
|
24
|
+
#
|
25
|
+
# t.timestamps
|
26
|
+
# end
|
27
|
+
#########################################################
|
28
|
+
|
1
29
|
class PricingPlan < ActiveRecord::Base
|
2
30
|
attr_protected :created_at, :updated_at
|
3
31
|
|
@@ -22,7 +50,7 @@ class PricingPlan < ActiveRecord::Base
|
|
22
50
|
rule_ctx[:price] = price
|
23
51
|
eval(self.pricing_calculation)
|
24
52
|
|
25
|
-
#finanlly if this is not a simple amount and has no pricing
|
53
|
+
#finanlly if this is not a simple amount and has no pricing calculation use the price components associated to this plan
|
26
54
|
else
|
27
55
|
self.pricing_plan_components.each do |pricing_plan_component|
|
28
56
|
price_component = pricing_plan_component.get_price_component(rule_ctx)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddPaymentTransactionTypes
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
payment_transactions = BizTxnType.find_or_create('payment_transaction', 'Payment Transaction')
|
5
|
+
BizTxnType.find_or_create('credit_card', 'Credit Card', payment_transactions)
|
6
|
+
BizTxnType.find_or_create('cash', 'Cash', payment_transactions)
|
7
|
+
BizTxnType.find_or_create('pay_pal', 'PayPal', payment_transactions)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
BizTxnType.iid('payment_transaction').destroy
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -2,49 +2,49 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
3
3
|
#fees
|
4
4
|
unless table_exists?(:fees)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
5
|
+
create_table :fees do |t|
|
6
|
+
t.references :fee_record, :polymorphic => true
|
7
|
+
t.references :money
|
8
|
+
t.references :fee_type
|
9
|
+
t.string :description
|
10
|
+
t.datetime :start_date
|
11
|
+
t.datetime :end_date
|
12
|
+
t.string :external_identifier
|
13
|
+
t.string :external_id_source
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :fees, [:fee_record_id, :fee_record_type], :name => 'fee_record_idx'
|
19
|
+
add_index :fees, :fee_type_id
|
20
|
+
add_index :fees, :money_id
|
21
|
+
end
|
22
|
+
|
23
23
|
unless table_exists?(:fee_types)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
|
24
|
+
create_table :fee_types do |t|
|
25
|
+
t.string :internal_identifier
|
26
|
+
t.string :description
|
27
|
+
t.string :comments
|
28
|
+
t.string :external_identifier
|
29
|
+
t.string :external_id_source
|
30
|
+
|
31
|
+
#these columns are required to support the behavior of the plugin 'awesome_nested_set'
|
32
|
+
t.integer :parent_id
|
33
|
+
t.integer :lft
|
34
|
+
t.integer :rgt
|
35
|
+
|
36
|
+
t.timestamps
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
40
|
#pricing tables
|
41
41
|
unless table_exists?(:price_component_types)
|
42
42
|
create_table :price_component_types do |t|
|
43
43
|
|
44
|
-
t.string
|
45
|
-
t.string
|
46
|
-
t.string
|
47
|
-
t.string
|
44
|
+
t.string :description
|
45
|
+
t.string :internal_identifier
|
46
|
+
t.string :external_identifier
|
47
|
+
t.string :external_id_source
|
48
48
|
|
49
49
|
t.timestamps
|
50
50
|
end
|
@@ -53,21 +53,21 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
53
53
|
unless table_exists?(:pricing_plans)
|
54
54
|
create_table :pricing_plans do |t|
|
55
55
|
|
56
|
-
t.string
|
57
|
-
t.string
|
56
|
+
t.string :description
|
57
|
+
t.string :comments
|
58
58
|
|
59
|
-
t.string
|
59
|
+
t.string :internal_identifier
|
60
60
|
|
61
|
-
t.string
|
62
|
-
t.string
|
61
|
+
t.string :external_identifier
|
62
|
+
t.string :external_id_source
|
63
63
|
|
64
|
-
t.date
|
65
|
-
t.date
|
64
|
+
t.date :from_date
|
65
|
+
t.date :thru_date
|
66
66
|
|
67
67
|
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
68
|
-
t.string
|
68
|
+
t.string :matching_rules
|
69
69
|
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
70
|
-
t.string
|
70
|
+
t.string :pricing_calculation
|
71
71
|
|
72
72
|
#support for simple assignment of a single money amount
|
73
73
|
t.boolean :is_simple_amount
|
@@ -82,18 +82,18 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
82
82
|
create_table :pricing_plan_components do |t|
|
83
83
|
|
84
84
|
t.integer :price_component_type_id
|
85
|
-
t.string
|
86
|
-
t.string
|
85
|
+
t.string :description
|
86
|
+
t.string :comments
|
87
87
|
|
88
|
-
t.string
|
89
|
-
t.string
|
90
|
-
t.string
|
88
|
+
t.string :internal_identifier
|
89
|
+
t.string :external_identifier
|
90
|
+
t.string :external_id_source
|
91
91
|
|
92
92
|
|
93
93
|
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
94
|
-
t.string
|
94
|
+
t.string :matching_rules
|
95
95
|
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
96
|
-
t.string
|
96
|
+
t.string :pricing_calculation
|
97
97
|
|
98
98
|
#support for simple assignment of a single money amount
|
99
99
|
t.boolean :is_simple_amount
|
@@ -109,8 +109,8 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
109
109
|
unless table_exists?(:valid_price_plan_components)
|
110
110
|
create_table :valid_price_plan_components do |t|
|
111
111
|
|
112
|
-
t.references
|
113
|
-
t.references
|
112
|
+
t.references :pricing_plan
|
113
|
+
t.references :pricing_plan_component
|
114
114
|
|
115
115
|
t.timestamps
|
116
116
|
|
@@ -122,54 +122,54 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
122
122
|
unless table_exists?(:pricing_plan_assignments)
|
123
123
|
create_table :pricing_plan_assignments do |t|
|
124
124
|
|
125
|
-
t.references
|
125
|
+
t.references :pricing_plan
|
126
126
|
|
127
127
|
#support a polymorhic interface to the thing we want to price
|
128
|
-
t.integer
|
129
|
-
t.string
|
128
|
+
t.integer :priceable_item_id
|
129
|
+
t.string :priceable_item_type
|
130
130
|
|
131
|
-
t.integer
|
131
|
+
t.integer :priority
|
132
132
|
|
133
133
|
t.timestamps
|
134
134
|
|
135
135
|
end
|
136
136
|
add_index :pricing_plan_assignments, :pricing_plan_id
|
137
|
-
add_index :pricing_plan_assignments, [:priceable_item_id
|
137
|
+
add_index :pricing_plan_assignments, [:priceable_item_id, :priceable_item_type], :name => 'priceable_item_idx'
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
unless table_exists?(:prices)
|
141
141
|
create_table :prices do |t|
|
142
|
-
|
143
|
-
t.string
|
144
|
-
|
142
|
+
|
143
|
+
t.string :description
|
144
|
+
|
145
145
|
#support a polymorhic interface to the thing that HAS BEEN priced
|
146
|
-
t.integer
|
147
|
-
t.string
|
148
|
-
|
146
|
+
t.integer :priced_item_id
|
147
|
+
t.string :priced_item_type
|
148
|
+
|
149
149
|
#refer to the pricing plan by which this price was calculated
|
150
|
-
t.references
|
151
|
-
|
152
|
-
t.references
|
153
|
-
|
150
|
+
t.references :pricing_plan
|
151
|
+
|
152
|
+
t.references :money
|
153
|
+
|
154
154
|
t.timestamps
|
155
155
|
|
156
156
|
end
|
157
157
|
add_index :prices, :money_id
|
158
158
|
add_index :prices, :pricing_plan_id
|
159
|
-
add_index :prices, [:priced_item_id
|
159
|
+
add_index :prices, [:priced_item_id, :priced_item_type], :name => 'priced_item_idx'
|
160
160
|
end
|
161
161
|
|
162
162
|
unless table_exists?(:price_components)
|
163
163
|
create_table :price_components do |t|
|
164
164
|
|
165
|
-
t.string
|
166
|
-
t.references
|
167
|
-
t.references
|
168
|
-
t.references
|
165
|
+
t.string :description
|
166
|
+
t.references :pricing_plan_component
|
167
|
+
t.references :price
|
168
|
+
t.references :money
|
169
169
|
|
170
170
|
#polymorphic relationship
|
171
171
|
t.integer :priced_component_id
|
172
|
-
t.string
|
172
|
+
t.string :priced_component_type
|
173
173
|
|
174
174
|
t.timestamps
|
175
175
|
|
@@ -177,33 +177,33 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
177
177
|
add_index :price_components, :money_id
|
178
178
|
add_index :price_components, :pricing_plan_component_id
|
179
179
|
add_index :price_components, :price_id
|
180
|
-
add_index :price_components, [:priced_component_id
|
180
|
+
add_index :price_components, [:priced_component_id, :priced_component_type], :name => 'priced_component_idx'
|
181
181
|
end
|
182
|
-
|
182
|
+
|
183
183
|
#payment tables
|
184
184
|
unless table_exists?(:payments)
|
185
185
|
create_table :payments do |t|
|
186
186
|
|
187
|
-
t.column :success,
|
188
|
-
t.column :reference_number,
|
189
|
-
t.column :financial_txn_id,
|
190
|
-
t.column :current_state,
|
191
|
-
t.column :authorization_code,
|
187
|
+
t.column :success, :boolean
|
188
|
+
t.column :reference_number, :string
|
189
|
+
t.column :financial_txn_id, :integer
|
190
|
+
t.column :current_state, :string
|
191
|
+
t.column :authorization_code, :string
|
192
192
|
t.string :external_identifier
|
193
|
-
|
193
|
+
|
194
194
|
t.timestamps
|
195
195
|
end
|
196
|
-
|
196
|
+
|
197
197
|
add_index :payments, :financial_txn_id
|
198
198
|
end
|
199
199
|
|
200
200
|
unless table_exists?(:payment_gateways)
|
201
201
|
create_table :payment_gateways do |t|
|
202
202
|
|
203
|
-
t.column :params,
|
204
|
-
t.column :payment_gateway_action_id,
|
205
|
-
t.column :payment_id,
|
206
|
-
t.column :response,
|
203
|
+
t.column :params, :string
|
204
|
+
t.column :payment_gateway_action_id, :integer
|
205
|
+
t.column :payment_id, :integer
|
206
|
+
t.column :response, :string
|
207
207
|
|
208
208
|
t.timestamps
|
209
209
|
end
|
@@ -213,48 +213,50 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
213
213
|
create_table :payment_gateway_actions do |t|
|
214
214
|
|
215
215
|
t.column :internal_identifier, :string
|
216
|
-
t.column :description,
|
216
|
+
t.column :description, :string
|
217
217
|
|
218
218
|
t.timestamps
|
219
219
|
end
|
220
|
+
|
221
|
+
add_index :payment_gateway_actions, :internal_identifier
|
220
222
|
end
|
221
223
|
|
222
|
-
add_index :payment_gateway_actions, :internal_identifier
|
223
|
-
|
224
224
|
#tables
|
225
225
|
unless table_exists?(:credit_cards)
|
226
226
|
create_table :credit_cards do |t|
|
227
227
|
|
228
|
-
t.column :crypted_private_card_number,
|
229
|
-
t.column :
|
230
|
-
t.column :
|
228
|
+
t.column :crypted_private_card_number, :string
|
229
|
+
t.column :crypted_private_cvc, :string
|
230
|
+
t.column :expiration_month, :integer
|
231
|
+
t.column :expiration_year, :integer
|
231
232
|
|
232
|
-
t.column :description,
|
233
|
-
t.column :
|
234
|
-
t.column :
|
235
|
-
t.column :card_type, :string
|
233
|
+
t.column :description, :string
|
234
|
+
t.column :name_on_card, :string
|
235
|
+
t.column :card_type, :string
|
236
236
|
|
237
|
-
t.column :postal_address_id,
|
238
|
-
t.column :
|
239
|
-
t.column :credit_card_token, :string
|
237
|
+
t.column :postal_address_id, :integer
|
238
|
+
t.column :credit_card_token, :string
|
240
239
|
|
241
240
|
t.timestamps
|
242
241
|
end
|
243
242
|
end
|
244
|
-
|
243
|
+
|
245
244
|
unless table_exists?(:credit_card_accounts)
|
246
245
|
create_table :credit_card_accounts do |t|
|
246
|
+
t.references :credit_card_account_purpose
|
247
247
|
|
248
248
|
t.timestamps
|
249
249
|
end
|
250
|
+
|
251
|
+
add_index :credit_card_accounts, :credit_card_account_purpose_id, :name => 'credit_card_acct_purpose_idx'
|
250
252
|
end
|
251
|
-
|
253
|
+
|
252
254
|
unless table_exists?(:credit_card_account_party_roles)
|
253
255
|
create_table :credit_card_account_party_roles do |t|
|
254
256
|
t.column :credit_card_account_id, :integer
|
255
|
-
t.column :role_type_id,
|
256
|
-
t.column :party_id,
|
257
|
-
t.column :credit_card_id,
|
257
|
+
t.column :role_type_id, :integer
|
258
|
+
t.column :party_id, :integer
|
259
|
+
t.column :credit_card_id, :integer
|
258
260
|
|
259
261
|
t.timestamps
|
260
262
|
end
|
@@ -264,33 +266,33 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
264
266
|
add_index :credit_card_account_party_roles, :party_id
|
265
267
|
add_index :credit_card_account_party_roles, :credit_card_id
|
266
268
|
end
|
267
|
-
|
269
|
+
|
268
270
|
unless table_exists?(:credit_card_account_purposes)
|
269
271
|
create_table :credit_card_account_purposes do |t|
|
270
272
|
|
271
|
-
t.column
|
272
|
-
t.column
|
273
|
-
t.column
|
273
|
+
t.column :parent_id, :integer
|
274
|
+
t.column :lft, :integer
|
275
|
+
t.column :rgt, :integer
|
274
276
|
|
275
277
|
#custom columns go here
|
276
278
|
|
277
|
-
t.column
|
278
|
-
t.column
|
279
|
+
t.column :description, :string
|
280
|
+
t.column :comments, :string
|
279
281
|
|
280
|
-
t.column
|
281
|
-
t.column
|
282
|
-
t.column
|
282
|
+
t.column :internal_identifier, :string
|
283
|
+
t.column :external_identifier, :string
|
284
|
+
t.column :external_id_source, :string
|
283
285
|
|
284
286
|
t.timestamps
|
285
287
|
end
|
286
288
|
end
|
287
|
-
|
289
|
+
|
288
290
|
unless table_exists?(:accepted_credit_cards)
|
289
291
|
create_table :accepted_credit_cards do |t|
|
290
|
-
|
292
|
+
|
291
293
|
t.references :organization
|
292
294
|
t.string :card_type
|
293
|
-
|
295
|
+
|
294
296
|
t.timestamps
|
295
297
|
end
|
296
298
|
end
|
@@ -317,125 +319,127 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
317
319
|
add_index :bank_accounts, :bank_account_type_id, :name => 'bank_accounts_account_type_idx'
|
318
320
|
end
|
319
321
|
#end tables
|
320
|
-
|
322
|
+
|
321
323
|
#columns
|
322
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
|
324
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('payment_gateway_txn_id')
|
323
325
|
add_column :order_txns, :payment_gateway_txn_id, :string
|
324
326
|
end
|
325
|
-
|
326
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
|
327
|
+
|
328
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('credit_card_id')
|
327
329
|
add_column :order_txns, :credit_card_id, :integer
|
328
330
|
end
|
329
|
-
|
330
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
|
331
|
+
|
332
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_first_name')
|
331
333
|
add_column :order_txns, :bill_to_first_name, :string
|
332
334
|
end
|
333
|
-
|
334
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
|
335
|
+
|
336
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_last_name')
|
335
337
|
add_column :order_txns, :bill_to_last_name, :string
|
336
|
-
end
|
337
|
-
|
338
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_1')
|
338
|
+
end
|
339
|
+
|
340
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_address_line_1')
|
339
341
|
add_column :order_txns, :bill_to_address_line_1, :string
|
340
342
|
end
|
341
343
|
|
342
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_2')
|
344
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_address_line_2')
|
343
345
|
add_column :order_txns, :bill_to_address_line_2, :string
|
344
346
|
end
|
345
|
-
|
346
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
|
347
|
+
|
348
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_city')
|
347
349
|
add_column :order_txns, :bill_to_city, :string
|
348
|
-
end
|
349
|
-
|
350
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
|
350
|
+
end
|
351
|
+
|
352
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_state')
|
351
353
|
add_column :order_txns, :bill_to_state, :string
|
352
354
|
end
|
353
|
-
|
354
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
|
355
|
+
|
356
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_postal_code')
|
355
357
|
add_column :order_txns, :bill_to_postal_code, :string
|
356
|
-
end
|
357
|
-
|
358
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
|
358
|
+
end
|
359
|
+
|
360
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_country')
|
359
361
|
add_column :order_txns, :bill_to_country, :string
|
360
362
|
end
|
361
|
-
|
362
|
-
unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
|
363
|
-
|
364
|
-
|
363
|
+
|
364
|
+
unless columns(:order_txns).collect { |c| c.name }.include?('bill_to_country_name')
|
365
|
+
rename_column :order_txns, :bill_to_country, :bill_to_country_name
|
366
|
+
rename_column :order_txns, :ship_to_country, :ship_to_country_name
|
365
367
|
add_column :order_txns, :bill_to_country, :string
|
366
368
|
add_column :order_txns, :ship_to_country, :string
|
367
369
|
end
|
368
|
-
|
370
|
+
|
371
|
+
add_column :product_types, :available_on_web, :boolean unless column_exists?(:product_types, :available_on_web)
|
372
|
+
add_index :product_types, :available_on_web unless index_exists?(:product_types, :available_on_web)
|
369
373
|
end
|
370
374
|
|
371
375
|
def self.down
|
372
|
-
|
373
|
-
if columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
|
376
|
+
|
377
|
+
if columns(:order_txns).collect { |c| c.name }.include?('payment_gateway_txn_id')
|
374
378
|
remove_column :order_txns, :payment_gateway_txn_id
|
375
379
|
end
|
376
|
-
|
377
|
-
if columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
|
380
|
+
|
381
|
+
if columns(:order_txns).collect { |c| c.name }.include?('credit_card_id')
|
378
382
|
remove_column :order_txns, :credit_card_id, :integer
|
379
383
|
end
|
380
|
-
|
381
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
|
384
|
+
|
385
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_first_name')
|
382
386
|
remove_column :order_txns, :bill_to_first_name, :string
|
383
387
|
end
|
384
|
-
|
385
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
|
388
|
+
|
389
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_last_name')
|
386
390
|
remove_column :order_txns, :bill_to_last_name, :string
|
387
|
-
end
|
388
|
-
|
389
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_address')
|
391
|
+
end
|
392
|
+
|
393
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_address')
|
390
394
|
remove_column :order_txns, :bill_to_address, :string
|
391
395
|
end
|
392
|
-
|
393
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
|
396
|
+
|
397
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_city')
|
394
398
|
remove_column :order_txns, :bill_to_city, :string
|
395
|
-
end
|
396
|
-
|
397
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
|
399
|
+
end
|
400
|
+
|
401
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_state')
|
398
402
|
remove_column :order_txns, :bill_to_state, :string
|
399
403
|
end
|
400
|
-
|
401
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
|
404
|
+
|
405
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_postal_code')
|
402
406
|
remove_column :order_txns, :bill_to_postal_code, :string
|
403
|
-
end
|
404
|
-
|
405
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
|
407
|
+
end
|
408
|
+
|
409
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_country')
|
406
410
|
remove_column :order_txns, :bill_to_country, :string
|
407
411
|
end
|
408
|
-
|
409
|
-
if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
|
410
|
-
|
411
|
-
|
412
|
+
|
413
|
+
if columns(:order_txns).collect { |c| c.name }.include?('bill_to_country_name')
|
414
|
+
remove_column :order_txns, :bill_to_country, :bill_to_country_name
|
415
|
+
remove_column :order_txns, :ship_to_country, :ship_to_country_name
|
412
416
|
end
|
413
|
-
|
417
|
+
|
414
418
|
#tables
|
415
419
|
drop_tables = [
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
420
|
+
:bank_account_types,
|
421
|
+
:bank_accounts,
|
422
|
+
:credit_cards,
|
423
|
+
:credit_card_accounts,
|
424
|
+
:credit_card_account_party_roles,
|
425
|
+
:credit_card_account_purposes,
|
426
|
+
:payments,
|
427
|
+
:payment_gateways,
|
428
|
+
:payment_gateway_actions,
|
429
|
+
:pricing_plans,
|
430
|
+
:pricing_plan_components,
|
431
|
+
:valid_price_plan_components,
|
432
|
+
:pricing_plan_assignments,
|
433
|
+
:prices,
|
434
|
+
:price_components,
|
435
|
+
:price_component_types,
|
436
|
+
:fees, :fee_types
|
433
437
|
]
|
434
438
|
drop_tables.each do |table|
|
435
439
|
if table_exists?(table)
|
436
440
|
drop_table table
|
437
441
|
end
|
438
442
|
end
|
439
|
-
|
443
|
+
|
440
444
|
end
|
441
445
|
end
|