spree_pag_seguro 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/README.md +1 -1
  2. data/app/models/spree/pag_seguro_payment.rb +1 -0
  3. data/lib/spree_pag_seguro/engine.rb +1 -7
  4. data/spec/dummy/Rakefile +7 -0
  5. data/spec/dummy/app/assets/javascripts/admin/all.js +10 -0
  6. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  7. data/spec/dummy/app/assets/javascripts/store/all.js +10 -0
  8. data/spec/dummy/app/assets/stylesheets/admin/all.css +11 -0
  9. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  10. data/spec/dummy/app/assets/stylesheets/store/all.css +11 -0
  11. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  12. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  13. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  14. data/spec/dummy/config.ru +4 -0
  15. data/spec/dummy/config/application.rb +60 -0
  16. data/spec/dummy/config/boot.rb +6 -0
  17. data/spec/dummy/config/database.yml +18 -0
  18. data/spec/dummy/config/environment.rb +7 -0
  19. data/spec/dummy/config/environments/development.rb +30 -0
  20. data/spec/dummy/config/environments/production.rb +60 -0
  21. data/spec/dummy/config/environments/test.rb +39 -0
  22. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  23. data/spec/dummy/config/initializers/inflections.rb +10 -0
  24. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  25. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  26. data/spec/dummy/config/initializers/session_store.rb +8 -0
  27. data/spec/dummy/config/initializers/spree.rb +12 -0
  28. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  29. data/spec/dummy/config/locales/en.yml +5 -0
  30. data/spec/dummy/config/routes.rb +3 -0
  31. data/spec/dummy/config/spree.yml +2 -0
  32. data/spec/dummy/db/dummy_test +0 -0
  33. data/spec/dummy/db/migrate/20120301154050_spree_zero_nine_zero.rb +389 -0
  34. data/spec/dummy/db/migrate/20120301154051_create_indexes_for_inventory_units.rb +6 -0
  35. data/spec/dummy/db/migrate/20120301154052_add_count_on_hand_to_variants_and_products.rb +49 -0
  36. data/spec/dummy/db/migrate/20120301154053_change_taxons_to_nested_set.rb +46 -0
  37. data/spec/dummy/db/migrate/20120301154054_move_to_configurable_gateways.rb +54 -0
  38. data/spec/dummy/db/migrate/20120301154055_product_groups_and_scopes.rb +18 -0
  39. data/spec/dummy/db/migrate/20120301154056_add_open_id_authentication_tables.rb +15 -0
  40. data/spec/dummy/db/migrate/20120301154057_add_openid_field_to_users.rb +24 -0
  41. data/spec/dummy/db/migrate/20120301154058_change_preference_value_type.rb +10 -0
  42. data/spec/dummy/db/migrate/20120301154059_create_billing_integrations.rb +12 -0
  43. data/spec/dummy/db/migrate/20120301154060_charge_refactoring.rb +39 -0
  44. data/spec/dummy/db/migrate/20120301154061_add_some_indexes.rb +11 -0
  45. data/spec/dummy/db/migrate/20120301154062_checkout_state_machine.rb +5 -0
  46. data/spec/dummy/db/migrate/20120301154063_state_for_shipments.rb +5 -0
  47. data/spec/dummy/db/migrate/20120301154064_make_state_events_polymorphic.rb +12 -0
  48. data/spec/dummy/db/migrate/20120301154065_ship_address_id_for_checkouts.rb +5 -0
  49. data/spec/dummy/db/migrate/20120301154066_shipping_method_id_for_checkouts.rb +5 -0
  50. data/spec/dummy/db/migrate/20120301154067_creditcard_last_four_digits.rb +14 -0
  51. data/spec/dummy/db/migrate/20120301154068_populate_legacy_shipment_state.rb +15 -0
  52. data/spec/dummy/db/migrate/20120301154069_add_cost_price.rb +5 -0
  53. data/spec/dummy/db/migrate/20120301154070_shipment_id_for_inventory_units.rb +25 -0
  54. data/spec/dummy/db/migrate/20120301154071_cim_fields_for_creditcards.rb +6 -0
  55. data/spec/dummy/db/migrate/20120301154072_create_return_authorizations.rb +12 -0
  56. data/spec/dummy/db/migrate/20120301154073_add_return_authorization_to_inventory_units.rb +5 -0
  57. data/spec/dummy/db/migrate/20120301154074_create_trackers.rb +10 -0
  58. data/spec/dummy/db/migrate/20120301154075_creditcard_id_for_creditcard_txns.rb +5 -0
  59. data/spec/dummy/db/migrate/20120301154076_original_creditcard_txn_id_for_creditcard_txns.rb +5 -0
  60. data/spec/dummy/db/migrate/20120301154077_add_test_mode_to_billing_integration.rb +6 -0
  61. data/spec/dummy/db/migrate/20120301154078_create_products_product_groups.rb +8 -0
  62. data/spec/dummy/db/migrate/20120301154079_create_payment_methods.rb +16 -0
  63. data/spec/dummy/db/migrate/20120301154080_polymorphic_payments.rb +42 -0
  64. data/spec/dummy/db/migrate/20120301154081_change_payments_payment_method_to_belongs_to.rb +11 -0
  65. data/spec/dummy/db/migrate/20120301154082_assign_creditcard_txns_to_payment.rb +23 -0
  66. data/spec/dummy/db/migrate/20120301154083_sti_for_transactions.rb +15 -0
  67. data/spec/dummy/db/migrate/20120301154084_drop_billing_integrations.rb +16 -0
  68. data/spec/dummy/db/migrate/20120301154085_deleted_at_for_payment_methods.rb +14 -0
  69. data/spec/dummy/db/migrate/20120301154086_add_adjustments_index.rb +6 -0
  70. data/spec/dummy/db/migrate/20120301154087_fix_by_popularity.rb +9 -0
  71. data/spec/dummy/db/migrate/20120301154088_add_alt_text_to_images.rb +5 -0
  72. data/spec/dummy/db/migrate/20120301154089_fix_existing_coupon_credits.rb +13 -0
  73. data/spec/dummy/db/migrate/20120301154090_add_display_to_payment_methods.rb +5 -0
  74. data/spec/dummy/db/migrate/20120301154091_add_addresses_checkouts_indexes.rb +8 -0
  75. data/spec/dummy/db/migrate/20120301154092_add_icon_to_taxons.rb +17 -0
  76. data/spec/dummy/db/migrate/20120301154093_add_description_to_taxons.rb +11 -0
  77. data/spec/dummy/db/migrate/20120301154094_index_for_shipments_number.rb +5 -0
  78. data/spec/dummy/db/migrate/20120301154095_add_index_on_users_persistence_token.rb +5 -0
  79. data/spec/dummy/db/migrate/20120301154096_add_default_to_tax_categories.rb +5 -0
  80. data/spec/dummy/db/migrate/20120301154097_add_display_to_shipping_methods.rb +5 -0
  81. data/spec/dummy/db/migrate/20120301154098_rename_payment_method_display.rb +5 -0
  82. data/spec/dummy/db/migrate/20120301154099_rename_preferences_field.rb +5 -0
  83. data/spec/dummy/db/migrate/20120301154100_add_guest_flag.rb +5 -0
  84. data/spec/dummy/db/migrate/20120301154101_drop_order_token.rb +9 -0
  85. data/spec/dummy/db/migrate/20120301154102_payments_state_and_assigned_to_order_only.rb +14 -0
  86. data/spec/dummy/db/migrate/20120301154103_create_address_keys_for_order.rb +6 -0
  87. data/spec/dummy/db/migrate/20120301154104_payment_total_for_orders.rb +5 -0
  88. data/spec/dummy/db/migrate/20120301154105_shipping_method_id_for_orders.rb +5 -0
  89. data/spec/dummy/db/migrate/20120301154106_add_shipment_and_payment_state.rb +6 -0
  90. data/spec/dummy/db/migrate/20120301154107_refactor_adjustments.rb +29 -0
  91. data/spec/dummy/db/migrate/20120301154108_response_code_and_avs_response_for_payments.rb +6 -0
  92. data/spec/dummy/db/migrate/20120301154109_change_guest_flag_to_anonymous.rb +5 -0
  93. data/spec/dummy/db/migrate/20120301154110_email_for_orders.rb +5 -0
  94. data/spec/dummy/db/migrate/20120301154111_create_mail_methods.rb +10 -0
  95. data/spec/dummy/db/migrate/20120301154112_rename_frozen_to_locked.rb +5 -0
  96. data/spec/dummy/db/migrate/20120301154113_move_special_instructions_to_orders.rb +10 -0
  97. data/spec/dummy/db/migrate/20120301154114_create_log_entries.rb +11 -0
  98. data/spec/dummy/db/migrate/20120301154115_migrate_transactions_to_payment_state.rb +98 -0
  99. data/spec/dummy/db/migrate/20120301154116_delete_in_progress_orders.rb +19 -0
  100. data/spec/dummy/db/migrate/20120301154117_migrate_checkout_to_orders.rb +23 -0
  101. data/spec/dummy/db/migrate/20120301154118_remove_shipped_state.rb +12 -0
  102. data/spec/dummy/db/migrate/20120301154119_prevent_nil_payment_total.rb +8 -0
  103. data/spec/dummy/db/migrate/20120301154120_prevent_nil_email.rb +9 -0
  104. data/spec/dummy/db/migrate/20120301154121_generate_anonymous_users.rb +20 -0
  105. data/spec/dummy/db/migrate/20120301154122_update_order_state.rb +12 -0
  106. data/spec/dummy/db/migrate/20120301154123_cleanup_legacy_tables.rb +11 -0
  107. data/spec/dummy/db/migrate/20120301154124_remove_number_and_cvv_from_credicard.rb +11 -0
  108. data/spec/dummy/db/migrate/20120301154125_drop_anonymous_field_for_user.rb +9 -0
  109. data/spec/dummy/db/migrate/20120301154126_renamed_rma_cancelled_state.rb +9 -0
  110. data/spec/dummy/db/migrate/20120301154127_fix_problematic_index_names.rb +13 -0
  111. data/spec/dummy/db/migrate/20120301154128_add_position_to_variants.rb +5 -0
  112. data/spec/dummy/db/migrate/20120301154129_add_next_state_to_state_events.rb +5 -0
  113. data/spec/dummy/db/migrate/20120301154130_add_position_to_option_types.rb +5 -0
  114. data/spec/dummy/db/migrate/20120301154131_remove_trailing_slashes_in_taxon_permalinks.rb +19 -0
  115. data/spec/dummy/db/migrate/20120301154132_create_activators.rb +14 -0
  116. data/spec/dummy/db/migrate/20120301154133_eligible_for_adjustments.rb +5 -0
  117. data/spec/dummy/db/migrate/20120301154134_namespace_top_level_models.rb +52 -0
  118. data/spec/dummy/db/migrate/20120301154135_migrate_namespaced_polymorphic_models.rb +52 -0
  119. data/spec/dummy/db/migrate/20120301154136_make_adjustments_polymorphic.rb +9 -0
  120. data/spec/dummy/db/migrate/20120301154137_add_company_to_addresses.rb +5 -0
  121. data/spec/dummy/db/migrate/20120301154138_add_inc_tax_to_tax_rates.rb +5 -0
  122. data/spec/dummy/db/migrate/20120301154139_rename_inc_price_attribute.rb +5 -0
  123. data/spec/dummy/db/migrate/20120301154140_add_default_tax_zone.rb +5 -0
  124. data/spec/dummy/db/migrate/20120301154141_associate_shipping_methods_and_shipping_categories.rb +7 -0
  125. data/spec/dummy/db/migrate/20120301154142_add_match_rules_to_shipping_methods.rb +7 -0
  126. data/spec/dummy/db/migrate/20120301154143_new_preferences.rb +48 -0
  127. data/spec/dummy/db/migrate/20120301154144_add_deleted_at_to_tax_category.rb +5 -0
  128. data/spec/dummy/db/migrate/20120301154145_create_spree_payment_notifications.rb +12 -0
  129. data/spec/dummy/db/migrate/20120301154146_create_spree_pag_seguro_payments.rb +8 -0
  130. data/spec/dummy/db/schema.rb +569 -0
  131. data/spec/dummy/db/seeds.rb +11 -0
  132. data/spec/dummy/log/test.log +1073 -0
  133. data/spec/dummy/public/404.html +26 -0
  134. data/spec/dummy/public/422.html +26 -0
  135. data/spec/dummy/public/500.html +26 -0
  136. data/spec/dummy/public/favicon.ico +0 -0
  137. data/spec/dummy/script/rails +6 -0
  138. data/spec/dummy/spec/dummy/script/rails +6 -0
  139. metadata +151 -16
@@ -0,0 +1,46 @@
1
+ class ChangeTaxonsToNestedSet < ActiveRecord::Migration
2
+ def up
3
+ add_column :taxons, :lft, :integer
4
+ add_column :taxons, :rgt, :integer
5
+
6
+ Spree::Taxon.reset_column_information # So the new root ids get saved
7
+
8
+ # Temporarily set the table back to taxons
9
+ Spree::Taxon.table_name = 'taxons'
10
+
11
+ Spree::Taxon.class_eval do
12
+ # adapted from awesome nested set to use 'position' information
13
+ indices = {}
14
+
15
+ left_column_name = 'lft'
16
+ right_column_name = 'rgt'
17
+ quoted_parent_column_name = 'parent_id'
18
+ scope = lambda{|node|}
19
+
20
+ set_left_and_rights = lambda do |node|
21
+ # set left
22
+ node[left_column_name] = indices[scope.call(node)] += 1
23
+ # find
24
+ where("#{quoted_parent_column_name} = ?", node).order('position ASC').each{ |n| set_left_and_rights.call(n) }
25
+ # set right
26
+ node[right_column_name] = indices[scope.call(node)] += 1
27
+ node.save!
28
+ end
29
+
30
+ # Find root node(s)
31
+ where("#{quoted_parent_column_name}" => nil).order('position ASC').each do |root_node|
32
+ # setup index for this scope
33
+ indices[scope.call(root_node)] ||= 0
34
+ set_left_and_rights.call(root_node)
35
+ end
36
+ end
37
+
38
+ # Set it back after the migration
39
+ Spree::Taxon.table_name = 'spree_taxons'
40
+ end
41
+
42
+ def down
43
+ remove_column :taxons, :lft
44
+ remove_column :taxons, :rgt
45
+ end
46
+ end
@@ -0,0 +1,54 @@
1
+ class MoveToConfigurableGateways < ActiveRecord::Migration
2
+ def up
3
+ drop_table :gateways
4
+ drop_table :gateway_options
5
+ drop_table :gateway_option_values
6
+ drop_table :gateway_configurations
7
+
8
+ create_table :gateways, :force => true do |t|
9
+ t.string :type, :name
10
+ t.text :description
11
+ t.boolean :active, :default => true
12
+ t.string :environment, :default => 'development'
13
+ t.string :server, :default => 'test'
14
+ t.boolean :test_mode, :default => true
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+
20
+ def down
21
+ drop_table :gateways
22
+
23
+ create_table :gateway_configurations, :force => true do |t|
24
+ t.references :gateway
25
+
26
+ t.timestamps
27
+ end
28
+
29
+ create_table :gateway_option_values, :force => true do |t|
30
+ t.text :value
31
+ t.references :gateway_configuration
32
+ t.references :gateway_option
33
+
34
+ t.timestamps
35
+ end
36
+
37
+ create_table :gateway_options, :force => true do |t|
38
+ t.string :name
39
+ t.text :description
40
+ t.boolean :textarea, :default => false
41
+ t.references :gateway
42
+
43
+ t.timestamps
44
+ end
45
+
46
+ create_table :gateways, :force => true do |t|
47
+ t.string :clazz, :name
48
+ t.text :description
49
+ t.boolean :active
50
+
51
+ t.timestamps
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,18 @@
1
+ class ProductGroupsAndScopes < ActiveRecord::Migration
2
+ def change
3
+ create_table :product_groups do |t|
4
+ t.string :name, :permalink, :order
5
+ end
6
+
7
+ create_table :product_scopes do |t|
8
+ t.string :name
9
+ t.text :arguments
10
+ t.references :product_group
11
+ end
12
+
13
+ add_index :product_groups, :name
14
+ add_index :product_groups, :permalink
15
+ add_index :product_scopes, :name
16
+ add_index :product_scopes, :product_group_id
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ class AddOpenIdAuthenticationTables < ActiveRecord::Migration
2
+ def change
3
+ create_table :open_id_authentication_associations, :force => true do |t|
4
+ t.integer :issued, :lifetime
5
+ t.string :handle, :assoc_type
6
+ t.binary :server_url, :secret
7
+ end
8
+
9
+ create_table :open_id_authentication_nonces, :force => true do |t|
10
+ t.integer :timestamp, :null => false
11
+ t.string :server_url, :null => true
12
+ t.string :salt, :null => false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
1
+ class AddOpenidFieldToUsers < ActiveRecord::Migration
2
+ def up
3
+ add_column :users, :openid_identifier, :string
4
+ add_index :users, :openid_identifier
5
+
6
+ change_column :users, :login, :string, :default => nil, :null => true
7
+ change_column :users, :crypted_password, :string, :default => nil, :null => true
8
+ change_column :users, :salt, :string, :default => nil, :null => true
9
+ end
10
+
11
+ def down
12
+ remove_column :users, :openid_identifier
13
+
14
+ # Due to namespacing change, temporarily set the table back to users
15
+ Spree::User.table_name = 'users'
16
+
17
+ [:login, :crypted_password, :salt].each do |field|
18
+ Spree::User.where(field => nil).each { |user| user.update_attribute(field, '') if user.send(field).nil? }
19
+ change_column :users, field, :string, :default => '', :null => false
20
+ end
21
+
22
+ Spree::User.table_name = 'spree_users'
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ class ChangePreferenceValueType < ActiveRecord::Migration
2
+ def up
3
+ remove_index :preferences, :name => 'index_preferences_on_owner_and_attribute_and_preference'
4
+ change_column :preferences, :value, :text
5
+ end
6
+
7
+ def down
8
+ change_column :preferences, :value, :string
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBillingIntegrations < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_integrations do |t|
4
+ t.string :type, :name
5
+ t.text :description
6
+ t.boolean :active, :default => true
7
+ t.string :environment, :default => 'development'
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ class Checkout < ActiveRecord::Base; end;
2
+
3
+ # Hack to prevent issues with legacy migrations
4
+ class Order < ActiveRecord::Base
5
+ has_one :checkout
6
+ end
7
+
8
+ class ChargeRefactoring < ActiveRecord::Migration
9
+ def up
10
+ # Temporarily set table name for legacy support
11
+ Spree::Adjustment.table_name = 'adjustments'
12
+
13
+ add_column :orders, :completed_at, :timestamp
14
+ Order.reset_column_information
15
+ Order.all.each { |o| o.update_attribute(:completed_at, o.checkout && o.checkout.read_attribute(:completed_at)) }
16
+ remove_column :checkouts, :completed_at
17
+
18
+ change_column :adjustments, :amount, :decimal, :null => true, :default => nil, :precision => 8, :scale => 2
19
+ Spree::Adjustment.update_all :type => 'secondary_type'
20
+ Spree::Adjustment.where(:type => 'Credit').update_all(:type => 'CouponCredit')
21
+ remove_column :adjustments, :secondary_type
22
+
23
+ # Reset table name
24
+ Spree::Adjustment.table_name = 'spree_adjustments'
25
+ end
26
+
27
+ def down
28
+ add_column :checkouts, :completed_at, :timestamp
29
+ Spree::Checkout.reset_column_information
30
+ Spree::Checkout.all.each { |c| c.update_attribute(:completed_at, c.order && c.order.completed_at) }
31
+ remove_column :orders, :completed_at
32
+
33
+ add_column :adjustments, :secondary_type, :string
34
+ Spree::Adjustment.update_all :secondary_type => 'type'
35
+ Spree::Adjustment.where('type LIKE ?', '%Charge').update_all(:type => 'Charge')
36
+ Spree::Adjustment.where('type LIKE ?', '%Credit').update_all(:type => 'Credit')
37
+ change_column :adjustments, :amount, :decimal, :null => false, :default => 0, :precision => 8, :scale => 2
38
+ end
39
+ end
@@ -0,0 +1,11 @@
1
+ class AddSomeIndexes < ActiveRecord::Migration
2
+ def change
3
+ add_index :taxons, :permalink
4
+ add_index :taxons, :parent_id
5
+ add_index :taxons, :taxonomy_id
6
+ add_index :assets, :viewable_id
7
+ add_index :assets, [:viewable_type, :type]
8
+ add_index :product_properties, :product_id
9
+ add_index :option_values_variants, [:variant_id, :option_value_id]
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class CheckoutStateMachine < ActiveRecord::Migration
2
+ def change
3
+ add_column :checkouts, :state, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class StateForShipments < ActiveRecord::Migration
2
+ def change
3
+ add_column :shipments, :state, :string
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class MakeStateEventsPolymorphic < ActiveRecord::Migration
2
+ def up
3
+ rename_column :state_events, :order_id, :stateful_id
4
+ add_column :state_events, :stateful_type, :string
5
+ execute "UPDATE state_events SET stateful_type = 'Order'"
6
+ end
7
+
8
+ def down
9
+ rename_column :state_events, :stateful_id, :order_id
10
+ remove_column :state_events, :stateful_type
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class ShipAddressIdForCheckouts < ActiveRecord::Migration
2
+ def change
3
+ add_column :checkouts, :ship_address_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ShippingMethodIdForCheckouts < ActiveRecord::Migration
2
+ def change
3
+ add_column :checkouts, :shipping_method_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ class CreditcardLastFourDigits < ActiveRecord::Migration
2
+ def up
3
+ rename_column :creditcards, :display_number, :last_digits
4
+
5
+ creditcards = select_all "SELECT * FROM creditcards"
6
+ creditcards.each do |card|
7
+ execute "UPDATE creditcards SET last_digits = '#{card['last_digits'].gsub('XXXX-XXXX-XXXX-', '')}' WHERE id = #{card['id']}" if card['last_digits'].present?
8
+ end
9
+ end
10
+
11
+ def down
12
+ rename_column :creditcards, :last_digits, :display_number
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ class PopulateLegacyShipmentState < ActiveRecord::Migration
2
+ def up
3
+ shipments = select_all "SELECT * FROM shipments"
4
+ shipments.each do |shipment|
5
+ if shipment['shipped_at']
6
+ execute "UPDATE shipments SET state = 'shipped'"
7
+ else
8
+ execute "UPDATE shipments SET state = 'pending'"
9
+ end
10
+ end
11
+ end
12
+
13
+ def down
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ class AddCostPrice < ActiveRecord::Migration
2
+ def change
3
+ add_column :variants, :cost_price, :decimal, :null => true, :default => nil, :precision => 8, :scale => 2
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ class ShipmentIdForInventoryUnits < ActiveRecord::Migration
2
+ def up
3
+ add_column :inventory_units, :shipment_id, :integer
4
+ add_index :inventory_units, :shipment_id
5
+
6
+ # migrate legacy shipments
7
+ Spree::Shipment.table_name = 'shipments'
8
+
9
+ Spree::Shipment.all.each do |shipment|
10
+ unless shipment.order
11
+ puts "Warning: shipment has invalid order - #{shipment.id}"
12
+ next
13
+ end
14
+ shipment.order.inventory_units.each do |unit|
15
+ unit.update_attribute('shipment_id', shipment.id)
16
+ end
17
+ end
18
+
19
+ Spree::Shipment.table_name = 'spree_shipments'
20
+ end
21
+
22
+ def down
23
+ remove_column :inventory_units, :shipment_id
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ class CimFieldsForCreditcards < ActiveRecord::Migration
2
+ def change
3
+ add_column :creditcards, :gateway_customer_profile_id, :string
4
+ add_column :creditcards, :gateway_payment_profile_id, :string
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ class CreateReturnAuthorizations < ActiveRecord::Migration
2
+ def change
3
+ create_table :return_authorizations do |t|
4
+ t.string :number, :state
5
+ t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false
6
+ t.references :order
7
+ t.text :reason
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class AddReturnAuthorizationToInventoryUnits < ActiveRecord::Migration
2
+ def change
3
+ add_column :inventory_units, :return_authorization_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTrackers < ActiveRecord::Migration
2
+ def change
3
+ create_table :trackers do |t|
4
+ t.string :environment, :analytics_id
5
+ t.boolean :active, :default => true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class CreditcardIdForCreditcardTxns < ActiveRecord::Migration
2
+ def change
3
+ add_column :creditcard_txns, :creditcard_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class OriginalCreditcardTxnIdForCreditcardTxns < ActiveRecord::Migration
2
+ def change
3
+ add_column :creditcard_txns, :original_creditcard_txn_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddTestModeToBillingIntegration < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_integrations, :test_mode, :boolean, :default => true
4
+ add_column :billing_integrations, :server, :string, :default => 'test'
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ class CreateProductsProductGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :product_groups_products, :id => false do |t|
4
+ t.references :product
5
+ t.references :product_group
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ class CreatePaymentMethods < ActiveRecord::Migration
2
+ def change
3
+ create_table :payment_methods do |t|
4
+ t.string :type, :name
5
+ t.text :description
6
+ t.boolean :active, :default => true
7
+ t.string :environment, :default => 'development'
8
+
9
+ t.timestamps
10
+ end
11
+ # TODO - also migrate any legacy configurations for gateways and billing integrations before dropping the old tables
12
+ # we probably also need to do this inside the payment_gateway extension b/c table won't exist yet in fresh bootstrap
13
+ #drop_table :billing_integrations
14
+ #drop_table :gateways
15
+ end
16
+ end