spree_mercado_pago_payment_method 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/javascripts/{admin → spree/admin}/spree_mercado_pago_payment_method.js +0 -0
  3. data/app/assets/javascripts/spree/frontend/spree_mercado_pago_payment_method.js +25 -0
  4. data/app/controllers/spree/mercado_pago_controller.rb +53 -31
  5. data/app/models/mercado_pago/client.rb +63 -0
  6. data/app/models/mercado_pago/client/api.rb +43 -0
  7. data/app/models/mercado_pago/client/authentication.rb +36 -0
  8. data/app/models/mercado_pago/client/preferences.rb +20 -0
  9. data/app/models/mercado_pago/notification.rb +8 -0
  10. data/app/models/mercado_pago/order_preferences_builder.rb +68 -0
  11. data/app/models/spree/payment_method/mercado_pago.rb +46 -0
  12. data/app/services/mercado_pago/handle_received_notification.rb +18 -0
  13. data/app/services/mercado_pago/process_notification.rb +54 -0
  14. data/app/views/spree/checkout/payment/_mercadopago.html.erb +15 -1
  15. data/config/locales/en.yml +3 -12
  16. data/config/locales/es.yml +3 -13
  17. data/config/routes.rb +5 -7
  18. data/lib/generators/spree_mercado_pago_payment_method/install/install_generator.rb +15 -10
  19. data/lib/spree_mercado_pago_payment_method.rb +1 -0
  20. data/lib/spree_mercado_pago_payment_method/engine.rb +1 -2
  21. data/lib/tasks/mercado_user.rake +0 -1
  22. data/spec/controllers/spree/mercado_pago_controller_spec.rb +18 -76
  23. data/spec/dummy/README.rdoc +15 -248
  24. data/spec/dummy/Rakefile +1 -2
  25. data/spec/dummy/app/assets/stylesheets/application.css +5 -3
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  27. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/config.ru +1 -1
  32. data/spec/dummy/config/application.rb +0 -36
  33. data/spec/dummy/config/database.yml +3 -5
  34. data/spec/dummy/config/environment.rb +3 -5
  35. data/spec/dummy/config/environments/development.rb +19 -19
  36. data/spec/dummy/config/environments/production.rb +41 -30
  37. data/spec/dummy/config/environments/test.rb +3 -6
  38. data/spec/dummy/config/initializers/assets.rb +8 -0
  39. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  40. data/spec/dummy/config/initializers/devise.rb +3 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/spec/dummy/config/initializers/inflections.rb +6 -5
  43. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  44. data/spec/dummy/config/initializers/session_store.rb +1 -6
  45. data/spec/dummy/config/initializers/spree.rb +4 -4
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  47. data/spec/dummy/config/locales/en.yml +20 -2
  48. data/spec/dummy/config/routes.rb +8 -2
  49. data/spec/dummy/config/secrets.yml +22 -0
  50. data/spec/dummy/config/spree.yml +1 -1
  51. data/spec/dummy/db/migrate/20141112193407_spree_one_two.spree.rb +482 -0
  52. data/spec/dummy/db/migrate/20141112193408_spree_promo_one_two.spree.rb +46 -0
  53. data/spec/dummy/db/migrate/{20121121030242_add_tax_rate_label.spree.rb → 20141112193409_add_tax_rate_label.spree.rb} +0 -0
  54. data/spec/dummy/db/migrate/{20121121030243_add_toggle_tax_rate_display.spree.rb → 20141112193410_add_toggle_tax_rate_display.spree.rb} +0 -0
  55. data/spec/dummy/db/migrate/20141112193411_remove_unused_preference_columns.spree.rb +9 -0
  56. data/spec/dummy/db/migrate/{20121121030244_add_lock_version_to_variant.spree.rb → 20141112193412_add_lock_version_to_variant.spree.rb} +0 -0
  57. data/spec/dummy/db/migrate/20141112193413_add_states_required_to_countries.spree.rb +6 -0
  58. data/spec/dummy/db/migrate/20141112193414_add_on_demand_to_product_and_variant.spree.rb +7 -0
  59. data/spec/dummy/db/migrate/{20121121030245_remove_not_null_constraint_from_products_on_hand.spree.rb → 20141112193415_remove_not_null_constraint_from_products_on_hand.spree.rb} +0 -0
  60. data/spec/dummy/db/migrate/20141112193416_split_prices_from_variants.spree.rb +32 -0
  61. data/spec/dummy/db/migrate/20141112193417_remove_not_null_from_spree_prices_amount.spree.rb +10 -0
  62. data/spec/dummy/db/migrate/20141112193418_add_currency_to_line_items.spree.rb +6 -0
  63. data/spec/dummy/db/migrate/20141112193419_add_currency_to_orders.spree.rb +6 -0
  64. data/spec/dummy/db/migrate/20141112193420_add_cost_currency_to_variants.spree.rb +6 -0
  65. data/spec/dummy/db/migrate/20141112193421_remove_display_on_from_payment_methods.spree.rb +6 -0
  66. data/spec/dummy/db/migrate/20141112193422_add_position_to_taxonomies.spree.rb +6 -0
  67. data/spec/dummy/db/migrate/20141112193423_add_last_ip_to_spree_orders.spree.rb +6 -0
  68. data/spec/dummy/db/migrate/20141112193424_add_state_to_spree_adjustments.spree.rb +7 -0
  69. data/spec/dummy/db/migrate/20141112193425_add_display_on_to_spree_payment_methods.spree.rb +10 -0
  70. data/spec/dummy/db/migrate/20141112193426_add_position_to_product_properties.spree.rb +7 -0
  71. data/spec/dummy/db/migrate/20141112193427_add_identifier_to_spree_payments.spree.rb +6 -0
  72. data/spec/dummy/db/migrate/20141112193428_add_order_id_index_to_payments.spree.rb +10 -0
  73. data/spec/dummy/db/migrate/20141112193429_add_primary_to_spree_products_taxons.spree.rb +6 -0
  74. data/spec/dummy/db/migrate/20141112193430_create_spree_stock_items.spree.rb +15 -0
  75. data/spec/dummy/db/migrate/20141112193431_create_spree_stock_locations.spree.rb +12 -0
  76. data/spec/dummy/db/migrate/20141112193432_create_default_stock.spree.rb +31 -0
  77. data/spec/dummy/db/migrate/20141112193433_add_order_id_index_to_shipments.spree.rb +6 -0
  78. data/spec/dummy/db/migrate/20141112193434_change_meta_description_on_spree_products_to_text.spree.rb +6 -0
  79. data/spec/dummy/db/migrate/20141112193435_add_stock_location_id_to_spree_shipments.spree.rb +6 -0
  80. data/spec/dummy/db/migrate/20141112193436_add_pending_to_inventory_unit.spree.rb +7 -0
  81. data/spec/dummy/db/migrate/20141112193437_remove_on_demand_from_product_and_variant.spree.rb +7 -0
  82. data/spec/dummy/db/migrate/20141112193438_create_shipping_method_zone.spree.rb +23 -0
  83. data/spec/dummy/db/migrate/20141112193439_remove_shipping_category_id_from_shipping_method.spree.rb +6 -0
  84. data/spec/dummy/db/migrate/20141112193440_create_shipping_method_categories.spree.rb +14 -0
  85. data/spec/dummy/db/migrate/20141112193441_add_tracking_url_to_spree_shipping_methods.spree.rb +6 -0
  86. data/spec/dummy/db/migrate/20141112193442_create_spree_shipping_rates.spree.rb +25 -0
  87. data/spec/dummy/db/migrate/20141112193443_remove_category_match_attributes_from_shipping_method.spree.rb +8 -0
  88. data/spec/dummy/db/migrate/20141112193444_create_stock_movements.spree.rb +13 -0
  89. data/spec/dummy/db/migrate/20141112193445_add_address_fields_to_stock_location.spree.rb +23 -0
  90. data/spec/dummy/db/migrate/20141112193446_add_active_field_to_stock_locations.spree.rb +6 -0
  91. data/spec/dummy/db/migrate/20141112193447_add_backorderable_to_stock_item.spree.rb +6 -0
  92. data/spec/dummy/db/migrate/20141112193448_add_default_quantity_to_stock_movement.spree.rb +6 -0
  93. data/spec/dummy/db/migrate/20141112193449_add_source_and_destination_to_stock_movements.spree.rb +9 -0
  94. data/spec/dummy/db/migrate/20141112193450_change_orders_total_precision.spree.rb +9 -0
  95. data/spec/dummy/db/migrate/20141112193451_change_spree_payments_amount_precision.spree.rb +8 -0
  96. data/spec/dummy/db/migrate/20141112193452_change_spree_return_authorization_amount_precision.spree.rb +8 -0
  97. data/spec/dummy/db/migrate/20141112193453_change_adjustments_amount_precision.spree.rb +8 -0
  98. data/spec/dummy/db/migrate/20141112193454_add_originator_to_stock_movement.spree.rb +8 -0
  99. data/spec/dummy/db/migrate/20141112193455_drop_source_and_destination_from_stock_movement.spree.rb +16 -0
  100. data/spec/dummy/db/migrate/20141112193456_migrate_inventory_unit_sold_to_on_hand.spree.rb +10 -0
  101. data/spec/dummy/db/migrate/20141112193457_add_stock_location_to_rma.spree.rb +6 -0
  102. data/spec/dummy/db/migrate/20141112193458_update_shipment_state_for_canceled_orders.spree.rb +16 -0
  103. data/spec/dummy/db/migrate/20141112193459_add_seo_metas_to_taxons.spree.rb +10 -0
  104. data/spec/dummy/db/migrate/20141112193460_remove_stock_item_and_variant_lock.spree.rb +15 -0
  105. data/spec/dummy/db/migrate/20141112193461_add_name_to_spree_credit_cards.spree.rb +6 -0
  106. data/spec/dummy/db/migrate/20141112193462_update_name_fields_on_spree_credit_cards.spree.rb +14 -0
  107. data/spec/dummy/db/migrate/20141112193463_add_index_to_source_columns_on_adjustments.spree.rb +6 -0
  108. data/spec/dummy/db/migrate/20141112193464_update_adjustment_states.spree.rb +17 -0
  109. data/spec/dummy/db/migrate/20141112193465_add_shipping_rates_to_shipments.spree.rb +16 -0
  110. data/spec/dummy/db/migrate/20141112193466_create_spree_stock_transfers.spree.rb +15 -0
  111. data/spec/dummy/db/migrate/20141112193467_drop_products_count_on_hand.spree.rb +6 -0
  112. data/spec/dummy/db/migrate/20141112193468_set_default_shipping_rate_cost.spree.rb +6 -0
  113. data/spec/dummy/db/migrate/20141112193469_add_number_to_stock_transfer.spree.rb +24 -0
  114. data/spec/dummy/db/migrate/20141112193470_add_sku_index_to_spree_variants.spree.rb +6 -0
  115. data/spec/dummy/db/migrate/20141112193471_add_backorderable_default_to_spree_stock_location.spree.rb +6 -0
  116. data/spec/dummy/db/migrate/20141112193472_add_propage_all_variants_to_spree_stock_location.spree.rb +6 -0
  117. data/spec/dummy/db/migrate/20141112193473_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb +11 -0
  118. data/spec/dummy/db/migrate/20141112193474_add_user_id_index_to_spree_orders.spree.rb +6 -0
  119. data/spec/dummy/db/migrate/20141112193475_add_updated_at_to_spree_countries.spree.rb +10 -0
  120. data/spec/dummy/db/migrate/20141112193476_add_updated_at_to_spree_states.spree.rb +10 -0
  121. data/spec/dummy/db/migrate/20141112193477_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb +7 -0
  122. data/spec/dummy/db/migrate/20141112193478_add_unique_index_to_permalink_on_spree_products.spree.rb +6 -0
  123. data/spec/dummy/db/migrate/20141112193479_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb +8 -0
  124. data/spec/dummy/db/migrate/20141112193480_add_deleted_at_to_spree_tax_rates.spree.rb +6 -0
  125. data/spec/dummy/db/migrate/20141112193481_remove_lock_version_from_inventory_units.spree.rb +7 -0
  126. data/spec/dummy/db/migrate/20141112193482_add_cost_price_to_line_item.spree.rb +6 -0
  127. data/spec/dummy/db/migrate/20141112193483_set_backorderable_to_default_to_false.spree.rb +7 -0
  128. data/spec/dummy/db/migrate/20141112193484_add_created_by_id_to_spree_orders.spree.rb +6 -0
  129. data/spec/dummy/db/migrate/20141112193485_index_completed_at_on_spree_orders.spree.rb +6 -0
  130. data/spec/dummy/db/migrate/20141112193486_add_tax_category_id_to_spree_line_items.spree.rb +6 -0
  131. data/spec/dummy/db/migrate/20141112193487_migrate_tax_categories_to_line_items.spree.rb +11 -0
  132. data/spec/dummy/db/migrate/20141112193488_drop_spree_mail_methods.spree.rb +13 -0
  133. data/spec/dummy/db/migrate/20141112193489_set_default_stock_location_on_shipments.spree.rb +9 -0
  134. data/spec/dummy/db/migrate/20141112193490_upgrade_adjustments.spree.rb +40 -0
  135. data/spec/dummy/db/migrate/20141112193491_rename_adjustment_fields.spree.rb +15 -0
  136. data/spec/dummy/db/migrate/20141112193492_add_admin_name_column_to_spree_shipping_methods.spree.rb +6 -0
  137. data/spec/dummy/db/migrate/20141112193493_add_admin_name_column_to_spree_stock_locations.spree.rb +6 -0
  138. data/spec/dummy/db/migrate/20141112193494_add_shipment_total_to_spree_orders.spree.rb +6 -0
  139. data/spec/dummy/db/migrate/20141112193495_expand_order_number_size.spree.rb +10 -0
  140. data/spec/dummy/db/migrate/20141112193496_rename_activators_to_promotions.spree.rb +6 -0
  141. data/spec/dummy/db/migrate/20141112193497_add_adjustment_total_to_line_items.spree.rb +6 -0
  142. data/spec/dummy/db/migrate/20141112193498_add_adjustment_total_to_shipments.spree.rb +6 -0
  143. data/spec/dummy/db/migrate/20141112193499_add_depth_to_spree_taxons.spree.rb +17 -0
  144. data/spec/dummy/db/migrate/20141112193500_add_tax_total_to_line_items_shipments_and_orders.spree.rb +9 -0
  145. data/spec/dummy/db/migrate/20141112193501_add_shipping_category_to_shipping_methods_and_products.spree.rb +16 -0
  146. data/spec/dummy/db/migrate/20141112193502_migrate_old_shipping_calculators.spree.rb +20 -0
  147. data/spec/dummy/db/migrate/20141112193503_add_code_to_spree_promotion_rules.spree.rb +6 -0
  148. data/spec/dummy/db/migrate/20141112193504_change_states_required_for_countries.spree.rb +10 -0
  149. data/spec/dummy/db/migrate/20141112193505_add_deleted_at_to_spree_stock_items.spree.rb +6 -0
  150. data/spec/dummy/db/migrate/20141112193506_remove_promotions_event_name_field.spree.rb +6 -0
  151. data/spec/dummy/db/migrate/20141112193507_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb +8 -0
  152. data/spec/dummy/db/migrate/20141112193508_remove_unused_credit_card_fields.spree.rb +17 -0
  153. data/spec/dummy/db/migrate/20141112193509_add_track_inventory_to_variant.spree.rb +6 -0
  154. data/spec/dummy/db/migrate/20141112193510_add_tax_category_to_variants.spree.rb +7 -0
  155. data/spec/dummy/db/migrate/20141112193511_add_channel_to_spree_orders.spree.rb +6 -0
  156. data/spec/dummy/db/migrate/20141112193512_add_included_to_adjustments.spree.rb +6 -0
  157. data/spec/dummy/db/migrate/20141112193513_rename_tax_total_fields.spree.rb +12 -0
  158. data/spec/dummy/db/migrate/20141112193514_add_line_item_id_to_spree_inventory_units.spree.rb +22 -0
  159. data/spec/dummy/db/migrate/20141112193515_add_updated_at_to_variants.spree.rb +6 -0
  160. data/spec/dummy/db/migrate/20141112193516_add_position_to_classifications.spree.rb +6 -0
  161. data/spec/dummy/db/migrate/20141112193517_create_spree_orders_promotions.spree.rb +9 -0
  162. data/spec/dummy/db/migrate/20141112193518_unique_shipping_method_categories.spree.rb +25 -0
  163. data/spec/dummy/db/migrate/20141112193519_add_item_count_to_spree_orders.spree.rb +6 -0
  164. data/spec/dummy/db/migrate/20141112193520_remove_value_type_from_spree_preferences.spree.rb +9 -0
  165. data/spec/dummy/db/migrate/20141112193521_rename_permalink_to_slug_for_products.spree.rb +6 -0
  166. data/spec/dummy/db/migrate/20141112193522_add_index_to_variant_id_and_currency_on_prices.spree.rb +6 -0
  167. data/spec/dummy/db/migrate/20141112193523_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb +7 -0
  168. data/spec/dummy/db/migrate/20141112193524_add_deleted_at_to_spree_prices.spree.rb +6 -0
  169. data/spec/dummy/db/migrate/20141112193525_add_approver_id_and_approved_at_to_orders.spree.rb +7 -0
  170. data/spec/dummy/db/migrate/20141112193526_add_confirmation_delivered_to_spree_orders.spree.rb +6 -0
  171. data/spec/dummy/db/migrate/20141112193527_add_auto_capture_to_payment_methods.spree.rb +6 -0
  172. data/spec/dummy/db/migrate/20141112193528_create_spree_payment_capture_events.spree.rb +13 -0
  173. data/spec/dummy/db/migrate/20141112193529_add_uncaptured_amount_to_payments.spree.rb +6 -0
  174. data/spec/dummy/db/migrate/20141112193530_default_variant_weight_to_zero.spree.rb +12 -0
  175. data/spec/dummy/db/migrate/20141112193531_add_tax_category_id_to_shipping_methods.spree.rb +6 -0
  176. data/spec/dummy/db/migrate/20141112193532_add_tax_rate_id_to_shipping_rates.spree.rb +6 -0
  177. data/spec/dummy/db/migrate/20141112193533_add_pre_tax_amount_to_line_items_and_shipments.spree.rb +7 -0
  178. data/spec/dummy/db/migrate/20141112193534_add_more_indexes.spree.rb +14 -0
  179. data/spec/dummy/db/migrate/20141112193535_add_considered_risky_to_orders.spree.rb +6 -0
  180. data/spec/dummy/db/migrate/20141112193536_add_preference_store_to_everything.spree.rb +9 -0
  181. data/spec/dummy/db/migrate/20141112193537_add_user_id_to_spree_credit_cards.spree.rb +14 -0
  182. data/spec/dummy/db/migrate/20141112193538_migrate_old_preferences.spree.rb +24 -0
  183. data/spec/dummy/db/migrate/20141112193539_create_spree_stores.spree.rb +26 -0
  184. data/spec/dummy/db/migrate/20141112193540_create_store_from_preferences.spree.rb +31 -0
  185. data/spec/dummy/db/migrate/20141112193541_add_timestamps_to_spree_assets.spree.rb +7 -0
  186. data/spec/dummy/db/migrate/20141112193542_add_additional_store_fields.spree.rb +9 -0
  187. data/spec/dummy/db/migrate/20141112193543_add_many_missing_indexes.spree.rb +19 -0
  188. data/spec/dummy/db/migrate/20141112193544_correct_some_polymorphic_index_and_add_more_missing.spree.rb +67 -0
  189. data/spec/dummy/db/migrate/20141112193545_add_user_id_created_by_id_index_to_order.spree.rb +6 -0
  190. data/spec/dummy/db/migrate/20141112193546_change_spree_price_amount_precision.spree.rb +9 -0
  191. data/spec/dummy/db/migrate/20141112193547_add_token_to_spree_orders.spree.rb +6 -0
  192. data/spec/dummy/db/migrate/20141112193548_move_order_token_from_tokenized_permission.spree.rb +30 -0
  193. data/spec/dummy/db/migrate/20141112193549_set_shipment_total_for_users_upgrading.spree.rb +11 -0
  194. data/spec/dummy/db/migrate/20141112193550_drop_credit_card_first_name_and_last_name.spree.rb +7 -0
  195. data/spec/dummy/db/migrate/20141112193551_add_deleted_at_to_spree_promotion_actions.spree.rb +7 -0
  196. data/spec/dummy/db/migrate/20141112193552_remove_uncaptured_amount_from_spree_payments.spree.rb +6 -0
  197. data/spec/dummy/db/migrate/20141112193553_add_default_to_shipment_cost.spree.rb +11 -0
  198. data/spec/dummy/db/migrate/20141112193554_default_pre_tax_amount_should_be_zero.spree.rb +7 -0
  199. data/spec/dummy/db/migrate/20141112193555_add_state_lock_version_to_order.spree.rb +6 -0
  200. data/spec/dummy/db/migrate/20141112193556_fix_adjustment_order_presence.spree.rb +14 -0
  201. data/spec/dummy/db/migrate/20141112193557_update_classifications_positions.spree.rb +10 -0
  202. data/spec/dummy/db/migrate/20141112193558_add_api_key_to_spree_users.spree_api.rb +8 -0
  203. data/spec/dummy/db/migrate/20141112193559_resize_api_key_field.spree_api.rb +8 -0
  204. data/spec/dummy/db/migrate/20141112193560_rename_api_key_to_spree_api_key.spree_api.rb +8 -0
  205. data/spec/dummy/db/migrate/20141112193561_add_index_to_user_spree_api_key.spree_api.rb +8 -0
  206. data/spec/dummy/db/migrate/{20121121030246_create_users.spree_auth.rb → 20141112193562_create_users.spree_auth.rb} +0 -0
  207. data/spec/dummy/db/migrate/{20121121030247_rename_columns_for_devise.spree_auth.rb → 20141112193563_rename_columns_for_devise.spree_auth.rb} +0 -0
  208. data/spec/dummy/db/migrate/{20121121030248_convert_user_remember_field.spree_auth.rb → 20141112193564_convert_user_remember_field.spree_auth.rb} +0 -0
  209. data/spec/dummy/db/migrate/{20121121030249_add_reset_password_sent_at_to_spree_users.spree_auth.rb → 20141112193565_add_reset_password_sent_at_to_spree_users.spree_auth.rb} +0 -0
  210. data/spec/dummy/db/migrate/{20121121030250_make_users_email_index_unique.spree_auth.rb → 20141112193566_make_users_email_index_unique.spree_auth.rb} +0 -0
  211. data/spec/dummy/db/migrate/20141202172111_create_spree_mercado_pago_notifications.spree_mercado_pago_payment_method_engine.rb +10 -0
  212. data/spec/dummy/db/schema.rb +581 -260
  213. data/spec/dummy/db/seeds.rb +2 -2
  214. data/spec/dummy/db/spree_development.sqlite3 +0 -0
  215. data/spec/dummy/db/spree_test.sqlite3 +0 -0
  216. data/spec/dummy/log/development.log +27822 -1376
  217. data/spec/dummy/log/test.log +87064 -37048
  218. data/spec/dummy/public/404.html +54 -13
  219. data/spec/dummy/public/422.html +54 -13
  220. data/spec/dummy/public/500.html +53 -12
  221. data/spec/dummy/tmp/cache/17E/D61/spree%2Fapp_configuration%2Fdefault_seo_title +1 -0
  222. data/spec/dummy/tmp/cache/2CC/B21/spree%2Fapp_configuration%2Frequire_master_price +1 -0
  223. data/spec/dummy/tmp/cache/334/AA1/spree%2Fapp_configuration%2Fdefault_meta_keywords +1 -0
  224. data/spec/dummy/tmp/cache/397/F31/spree%2Fapp_configuration%2Fbinary_inventory_cache +1 -0
  225. data/spec/dummy/tmp/cache/39C/F91/spree%2Fapp_configuration%2Ftax_using_ship_address +1 -0
  226. data/spec/dummy/tmp/cache/3A7/4A1/spree%2Fapp_configuration%2Faddress_requires_state +1 -0
  227. data/spec/dummy/tmp/cache/3B7/CD1/spree%2Fapp_configuration%2Fredirect_https_to_http +1 -0
  228. data/spec/dummy/tmp/cache/3BE/851/spree%2Fapp_configuration%2Ftrack_inventory_levels +1 -0
  229. data/spec/dummy/tmp/cache/460/D81/spree%2Fapp_configuration%2Fdefault_meta_description +1 -0
  230. data/spec/dummy/tmp/cache/5AE/6A1/spree%2Fapp_configuration%2Falways_include_confirm_step +1 -0
  231. data/spec/dummy/tmp/cache/DD9/320/spree%2Fapp_configuration%2Fsite_url +1 -0
  232. data/spec/dummy/tmp/cache/DDD/2D0/spree%2Fapp_configuration%2Fcurrency +1 -0
  233. data/spec/dummy/tmp/cache/E27/320/spree%2Fapp_configuration%2Fsite_name +1 -0
  234. data/spec/dummy/tmp/cache/E9B/7F0/spree%2Fapp_configuration%2Fmails_from +1 -0
  235. data/spec/dummy/tmp/cache/F01/FD0/spree%2Ffrontend_configuration%2Flocale +1 -0
  236. data/spec/dummy/{app/assets/javascripts/admin → vendor/assets/javascripts/spree/backend}/all.js +2 -1
  237. data/spec/dummy/{app/assets/javascripts/store → vendor/assets/javascripts/spree/frontend}/all.js +2 -1
  238. data/spec/dummy/{app/assets/stylesheets/admin → vendor/assets/stylesheets/spree/backend}/all.css +2 -1
  239. data/spec/dummy/{app/assets/stylesheets/store → vendor/assets/stylesheets/spree/frontend}/all.css +2 -1
  240. data/spec/models/mercado_pago/client_spec.rb +138 -0
  241. data/spec/models/mercado_pago/notification_spec.rb +17 -0
  242. data/spec/models/mercado_pago/order_preferences_builder_spec.rb +66 -0
  243. data/spec/services/mercado_pago/process_notification_spec.rb +57 -0
  244. data/spec/spec_helper.rb +12 -53
  245. metadata +444 -328
  246. data/app/assets/javascripts/store/spree_mercado_pago_payment_method.js +0 -1
  247. data/app/controllers/spree/checkout_controller_decorator.rb +0 -29
  248. data/app/models/payment_method/mercado_pago.rb +0 -33
  249. data/app/models/spree_mercado_pago_client.rb +0 -102
  250. data/app/views/spree/mercado_pago/failure.html.erb +0 -1
  251. data/app/views/spree/mercado_pago/pending.html.erb +0 -1
  252. data/app/views/spree/mercado_pago/success.html.erb +0 -1
  253. data/spec/controllers/spree/checkout_controller_spec.rb +0 -57
  254. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  255. data/spec/dummy/db/migrate/20121121030140_spree_zero_nine_zero.spree.rb +0 -392
  256. data/spec/dummy/db/migrate/20121121030141_create_indexes_for_inventory_units.spree.rb +0 -7
  257. data/spec/dummy/db/migrate/20121121030142_add_count_on_hand_to_variants_and_products.spree.rb +0 -50
  258. data/spec/dummy/db/migrate/20121121030143_change_taxons_to_nested_set.spree.rb +0 -47
  259. data/spec/dummy/db/migrate/20121121030144_move_to_configurable_gateways.spree.rb +0 -55
  260. data/spec/dummy/db/migrate/20121121030145_add_open_id_authentication_tables.spree.rb +0 -16
  261. data/spec/dummy/db/migrate/20121121030146_add_openid_field_to_users.spree.rb +0 -27
  262. data/spec/dummy/db/migrate/20121121030147_change_preference_value_type.spree.rb +0 -11
  263. data/spec/dummy/db/migrate/20121121030148_create_billing_integrations.spree.rb +0 -13
  264. data/spec/dummy/db/migrate/20121121030149_charge_refactoring.spree.rb +0 -40
  265. data/spec/dummy/db/migrate/20121121030150_add_some_indexes.spree.rb +0 -12
  266. data/spec/dummy/db/migrate/20121121030151_checkout_state_machine.spree.rb +0 -6
  267. data/spec/dummy/db/migrate/20121121030152_state_for_shipments.spree.rb +0 -6
  268. data/spec/dummy/db/migrate/20121121030153_make_state_events_polymorphic.spree.rb +0 -13
  269. data/spec/dummy/db/migrate/20121121030154_ship_address_id_for_checkouts.spree.rb +0 -6
  270. data/spec/dummy/db/migrate/20121121030155_shipping_method_id_for_checkouts.spree.rb +0 -6
  271. data/spec/dummy/db/migrate/20121121030156_creditcard_last_four_digits.spree.rb +0 -15
  272. data/spec/dummy/db/migrate/20121121030157_populate_legacy_shipment_state.spree.rb +0 -16
  273. data/spec/dummy/db/migrate/20121121030158_add_cost_price.spree.rb +0 -6
  274. data/spec/dummy/db/migrate/20121121030159_shipment_id_for_inventory_units.spree.rb +0 -26
  275. data/spec/dummy/db/migrate/20121121030160_cim_fields_for_creditcards.spree.rb +0 -7
  276. data/spec/dummy/db/migrate/20121121030161_create_return_authorizations.spree.rb +0 -13
  277. data/spec/dummy/db/migrate/20121121030162_add_return_authorization_to_inventory_units.spree.rb +0 -6
  278. data/spec/dummy/db/migrate/20121121030163_create_trackers.spree.rb +0 -11
  279. data/spec/dummy/db/migrate/20121121030164_creditcard_id_for_creditcard_txns.spree.rb +0 -6
  280. data/spec/dummy/db/migrate/20121121030165_original_creditcard_txn_id_for_creditcard_txns.spree.rb +0 -6
  281. data/spec/dummy/db/migrate/20121121030166_add_test_mode_to_billing_integration.spree.rb +0 -7
  282. data/spec/dummy/db/migrate/20121121030167_create_payment_methods.spree.rb +0 -17
  283. data/spec/dummy/db/migrate/20121121030168_polymorphic_payments.spree.rb +0 -43
  284. data/spec/dummy/db/migrate/20121121030169_change_payments_payment_method_to_belongs_to.spree.rb +0 -12
  285. data/spec/dummy/db/migrate/20121121030170_assign_creditcard_txns_to_payment.spree.rb +0 -24
  286. data/spec/dummy/db/migrate/20121121030171_sti_for_transactions.spree.rb +0 -16
  287. data/spec/dummy/db/migrate/20121121030172_drop_billing_integrations.spree.rb +0 -17
  288. data/spec/dummy/db/migrate/20121121030173_deleted_at_for_payment_methods.spree.rb +0 -15
  289. data/spec/dummy/db/migrate/20121121030174_add_adjustments_index.spree.rb +0 -7
  290. data/spec/dummy/db/migrate/20121121030175_add_alt_text_to_images.spree.rb +0 -6
  291. data/spec/dummy/db/migrate/20121121030176_fix_existing_coupon_credits.spree.rb +0 -14
  292. data/spec/dummy/db/migrate/20121121030177_add_display_to_payment_methods.spree.rb +0 -6
  293. data/spec/dummy/db/migrate/20121121030178_add_addresses_checkouts_indexes.spree.rb +0 -9
  294. data/spec/dummy/db/migrate/20121121030179_add_icon_to_taxons.spree.rb +0 -18
  295. data/spec/dummy/db/migrate/20121121030180_add_description_to_taxons.spree.rb +0 -12
  296. data/spec/dummy/db/migrate/20121121030181_index_for_shipments_number.spree.rb +0 -6
  297. data/spec/dummy/db/migrate/20121121030182_add_index_on_users_persistence_token.spree.rb +0 -8
  298. data/spec/dummy/db/migrate/20121121030183_add_default_to_tax_categories.spree.rb +0 -6
  299. data/spec/dummy/db/migrate/20121121030184_add_display_to_shipping_methods.spree.rb +0 -6
  300. data/spec/dummy/db/migrate/20121121030185_rename_payment_method_display.spree.rb +0 -6
  301. data/spec/dummy/db/migrate/20121121030186_rename_preferences_field.spree.rb +0 -6
  302. data/spec/dummy/db/migrate/20121121030187_add_guest_flag.spree.rb +0 -8
  303. data/spec/dummy/db/migrate/20121121030188_drop_order_token.spree.rb +0 -10
  304. data/spec/dummy/db/migrate/20121121030189_payments_state_and_assigned_to_order_only.spree.rb +0 -15
  305. data/spec/dummy/db/migrate/20121121030190_create_address_keys_for_order.spree.rb +0 -7
  306. data/spec/dummy/db/migrate/20121121030191_payment_total_for_orders.spree.rb +0 -6
  307. data/spec/dummy/db/migrate/20121121030192_shipping_method_id_for_orders.spree.rb +0 -6
  308. data/spec/dummy/db/migrate/20121121030193_add_shipment_and_payment_state.spree.rb +0 -7
  309. data/spec/dummy/db/migrate/20121121030194_refactor_adjustments.spree.rb +0 -30
  310. data/spec/dummy/db/migrate/20121121030195_response_code_and_avs_response_for_payments.spree.rb +0 -7
  311. data/spec/dummy/db/migrate/20121121030196_change_guest_flag_to_anonymous.spree.rb +0 -8
  312. data/spec/dummy/db/migrate/20121121030197_email_for_orders.spree.rb +0 -6
  313. data/spec/dummy/db/migrate/20121121030198_create_mail_methods.spree.rb +0 -11
  314. data/spec/dummy/db/migrate/20121121030199_rename_frozen_to_locked.spree.rb +0 -6
  315. data/spec/dummy/db/migrate/20121121030200_move_special_instructions_to_orders.spree.rb +0 -11
  316. data/spec/dummy/db/migrate/20121121030201_create_log_entries.spree.rb +0 -12
  317. data/spec/dummy/db/migrate/20121121030202_migrate_transactions_to_payment_state.spree.rb +0 -99
  318. data/spec/dummy/db/migrate/20121121030203_delete_in_progress_orders.spree.rb +0 -20
  319. data/spec/dummy/db/migrate/20121121030204_migrate_checkout_to_orders.spree.rb +0 -24
  320. data/spec/dummy/db/migrate/20121121030205_remove_shipped_state.spree.rb +0 -13
  321. data/spec/dummy/db/migrate/20121121030206_prevent_nil_payment_total.spree.rb +0 -9
  322. data/spec/dummy/db/migrate/20121121030207_prevent_nil_email.spree.rb +0 -10
  323. data/spec/dummy/db/migrate/20121121030208_generate_anonymous_users.spree.rb +0 -21
  324. data/spec/dummy/db/migrate/20121121030209_update_order_state.spree.rb +0 -13
  325. data/spec/dummy/db/migrate/20121121030210_cleanup_legacy_tables.spree.rb +0 -12
  326. data/spec/dummy/db/migrate/20121121030211_remove_number_and_cvv_from_credicard.spree.rb +0 -12
  327. data/spec/dummy/db/migrate/20121121030212_drop_anonymous_field_for_user.spree.rb +0 -12
  328. data/spec/dummy/db/migrate/20121121030213_renamed_rma_cancelled_state.spree.rb +0 -10
  329. data/spec/dummy/db/migrate/20121121030214_fix_problematic_index_names.spree.rb +0 -14
  330. data/spec/dummy/db/migrate/20121121030215_add_position_to_variants.spree.rb +0 -6
  331. data/spec/dummy/db/migrate/20121121030216_add_next_state_to_state_events.spree.rb +0 -6
  332. data/spec/dummy/db/migrate/20121121030217_add_position_to_option_types.spree.rb +0 -6
  333. data/spec/dummy/db/migrate/20121121030218_remove_trailing_slashes_in_taxon_permalinks.spree.rb +0 -20
  334. data/spec/dummy/db/migrate/20121121030219_create_activators.spree.rb +0 -15
  335. data/spec/dummy/db/migrate/20121121030220_eligible_for_adjustments.spree.rb +0 -6
  336. data/spec/dummy/db/migrate/20121121030221_namespace_top_level_models.spree.rb +0 -67
  337. data/spec/dummy/db/migrate/20121121030222_migrate_namespaced_polymorphic_models.spree.rb +0 -53
  338. data/spec/dummy/db/migrate/20121121030223_make_adjustments_polymorphic.spree.rb +0 -10
  339. data/spec/dummy/db/migrate/20121121030224_add_company_to_addresses.spree.rb +0 -6
  340. data/spec/dummy/db/migrate/20121121030225_add_inc_tax_to_tax_rates.spree.rb +0 -6
  341. data/spec/dummy/db/migrate/20121121030226_rename_inc_price_attribute.spree.rb +0 -6
  342. data/spec/dummy/db/migrate/20121121030227_add_default_tax_zone.spree.rb +0 -6
  343. data/spec/dummy/db/migrate/20121121030228_associate_shipping_methods_and_shipping_categories.spree.rb +0 -8
  344. data/spec/dummy/db/migrate/20121121030229_add_match_rules_to_shipping_methods.spree.rb +0 -8
  345. data/spec/dummy/db/migrate/20121121030230_new_preferences.spree.rb +0 -49
  346. data/spec/dummy/db/migrate/20121121030231_rename_state_events_to_state_changes.spree.rb +0 -10
  347. data/spec/dummy/db/migrate/20121121030232_add_deleted_at_to_tax_category.spree.rb +0 -6
  348. data/spec/dummy/db/migrate/20121121030233_migrate_images_from_products_to_variants.spree.rb +0 -38
  349. data/spec/dummy/db/migrate/20121121030234_rename_attachment_size_to_attachment_file_size.spree.rb +0 -6
  350. data/spec/dummy/db/migrate/20121121030235_increase_scale_of_tax_rate_amount.spree.rb +0 -10
  351. data/spec/dummy/db/migrate/20121121030236_create_tokenized_permissions_table.spree.rb +0 -17
  352. data/spec/dummy/db/migrate/20121121030237_convert_sales_tax_to_default_tax.spree.rb +0 -10
  353. data/spec/dummy/db/migrate/20121121030238_rename_creditcards_to_credit_cards.spree.rb +0 -12
  354. data/spec/dummy/db/migrate/20121121030239_add_deleted_at_to_spree_shipping_methods.spree.rb +0 -6
  355. data/spec/dummy/db/migrate/20121121030240_remove_credit_total_from_orders.spree.rb +0 -6
  356. data/spec/dummy/db/migrate/20121121030241_add_counter_cache_to_zone_members.spree.rb +0 -15
  357. data/spec/dummy/script/rails +0 -6
  358. data/spec/models/spree_mercado_pago_client_spec.rb +0 -131
@@ -0,0 +1,46 @@
1
+ # This migration comes from spree (originally 20120831092359)
2
+ class SpreePromoOneTwo < ActiveRecord::Migration
3
+ def up
4
+ # This migration is just a compressed migration for all previous versions of spree_promo
5
+ return if table_exists?(:spree_products_promotion_rules)
6
+
7
+ create_table :spree_products_promotion_rules, :id => false, :force => true do |t|
8
+ t.references :product
9
+ t.references :promotion_rule
10
+ end
11
+
12
+ add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id'
13
+ add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id'
14
+
15
+ create_table :spree_promotion_action_line_items, :force => true do |t|
16
+ t.references :promotion_action
17
+ t.references :variant
18
+ t.integer :quantity, :default => 1
19
+ end
20
+
21
+ create_table :spree_promotion_actions, :force => true do |t|
22
+ t.references :activator
23
+ t.integer :position
24
+ t.string :type
25
+ end
26
+
27
+ create_table :spree_promotion_rules, :force => true do |t|
28
+ t.references :activator
29
+ t.references :user
30
+ t.references :product_group
31
+ t.string :type
32
+ t.timestamps
33
+ end
34
+
35
+ add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id'
36
+ add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id'
37
+
38
+ create_table :spree_promotion_rules_users, :id => false, :force => true do |t|
39
+ t.references :user
40
+ t.references :promotion_rule
41
+ end
42
+
43
+ add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id'
44
+ add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id'
45
+ end
46
+ end
@@ -0,0 +1,9 @@
1
+ # This migration comes from spree (originally 20120929093553)
2
+ class RemoveUnusedPreferenceColumns < ActiveRecord::Migration
3
+ def change
4
+ # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps.
5
+ remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name)
6
+ remove_column :spree_preferences, :owner_id if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_id)
7
+ remove_column :spree_preferences, :owner_type if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_type)
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121010142909)
2
+ class AddStatesRequiredToCountries < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_countries, :states_required, :boolean,:default => true
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20121012071449)
2
+ class AddOnDemandToProductAndVariant < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_products, :on_demand, :boolean, :default => false
5
+ add_column :spree_variants, :on_demand, :boolean, :default => false
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ # This migration comes from spree (originally 20121031162139)
2
+ class SplitPricesFromVariants < ActiveRecord::Migration
3
+ def up
4
+ create_table :spree_prices do |t|
5
+ t.integer :variant_id, :null => false
6
+ t.decimal :amount, :precision => 8, :scale => 2, :null => false
7
+ t.string :currency
8
+ end
9
+
10
+ Spree::Variant.all.each do |variant|
11
+ Spree::Price.create!(
12
+ :variant_id => variant.id,
13
+ :amount => variant[:price],
14
+ :currency => Spree::Config[:currency]
15
+ )
16
+ end
17
+
18
+ remove_column :spree_variants, :price
19
+ end
20
+
21
+ def down
22
+ prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices")
23
+ add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8
24
+
25
+ prices.each do |price|
26
+ ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}")
27
+ end
28
+
29
+ change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false
30
+ drop_table :spree_prices
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from spree (originally 20121107003422)
2
+ class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration
3
+ def up
4
+ change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true
5
+ end
6
+
7
+ def down
8
+ change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121107184631)
2
+ class AddCurrencyToLineItems < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_line_items, :currency, :string
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121107194006)
2
+ class AddCurrencyToOrders < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_orders, :currency, :string
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121109173623)
2
+ class AddCostCurrencyToVariants < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_variants, :cost_currency, :string, :after => :cost_price
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121111231553)
2
+ class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration
3
+ def up
4
+ remove_column :spree_payment_methods, :display_on
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121124203911)
2
+ class AddPositionToTaxonomies < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_taxonomies, :position, :integer, :default => 0
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20121126040517)
2
+ class AddLastIpToSpreeOrders < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_orders, :last_ip_address, :string
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20121213162028)
2
+ class AddStateToSpreeAdjustments < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_adjustments, :state, :string
5
+ remove_column :spree_adjustments, :locked
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from spree (originally 20130114053446)
2
+ class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration
3
+ def self.up
4
+ add_column :spree_payment_methods, :display_on, :string
5
+ end
6
+
7
+ def self.down
8
+ remove_column :spree_payment_methods, :display_on
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20130120201805)
2
+ class AddPositionToProductProperties < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_product_properties, :position, :integer, :default => 0
5
+ end
6
+ end
7
+
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130203232234)
2
+ class AddIdentifierToSpreePayments < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_payments, :identifier, :string
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from spree (originally 20130207155350)
2
+ class AddOrderIdIndexToPayments < ActiveRecord::Migration
3
+ def self.up
4
+ add_index :spree_payments, :order_id
5
+ end
6
+
7
+ def self.down
8
+ remove_index :spree_payments, :order_id
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130208032954)
2
+ class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_products_taxons, :id, :primary_key
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from spree (originally 20130211190146)
2
+ class CreateSpreeStockItems < ActiveRecord::Migration
3
+ def change
4
+ create_table :spree_stock_items do |t|
5
+ t.belongs_to :stock_location
6
+ t.belongs_to :variant
7
+ t.integer :count_on_hand, null: false, default: 0
8
+ t.integer :lock_version
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :spree_stock_items, :stock_location_id
13
+ add_index :spree_stock_items, [:stock_location_id, :variant_id], :name => 'stock_item_by_loc_and_var_id'
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from spree (originally 20130211191120)
2
+ class CreateSpreeStockLocations < ActiveRecord::Migration
3
+ def change
4
+ create_table :spree_stock_locations do |t|
5
+ t.string :name
6
+ t.belongs_to :address
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :spree_stock_locations, :address_id
11
+ end
12
+ end
@@ -0,0 +1,31 @@
1
+ # This migration comes from spree (originally 20130213191427)
2
+ class CreateDefaultStock < ActiveRecord::Migration
3
+ def up
4
+ Spree::StockLocation.skip_callback(:create, :after, :create_stock_items)
5
+ Spree::StockItem.skip_callback(:save, :after, :process_backorders)
6
+ location = Spree::StockLocation.new(name: 'default')
7
+ location.save(validate: false)
8
+
9
+ Spree::Variant.find_each do |variant|
10
+ stock_item = Spree::StockItem.unscoped.build(stock_location: location, variant: variant)
11
+ stock_item.send(:count_on_hand=, variant.count_on_hand)
12
+ # Avoid running default_scope defined by acts_as_paranoid, related to #3805,
13
+ # validations would run a query with a delete_at column that might not be present yet
14
+ stock_item.save! validate: false
15
+ end
16
+
17
+ remove_column :spree_variants, :count_on_hand
18
+ end
19
+
20
+ def down
21
+ add_column :spree_variants, :count_on_hand, :integer
22
+
23
+ Spree::StockItem.find_each do |stock_item|
24
+ stock_item.variant.update_column :count_on_hand, stock_item.count_on_hand
25
+ end
26
+
27
+ Spree::StockLocation.delete_all
28
+ Spree::StockItem.delete_all
29
+ end
30
+ end
31
+
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130222032153)
2
+ class AddOrderIdIndexToShipments < ActiveRecord::Migration
3
+ def change
4
+ add_index :spree_shipments, :order_id
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130226032817)
2
+ class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration
3
+ def change
4
+ change_column :spree_products, :meta_description, :text, :limit => nil
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130226191231)
2
+ class AddStockLocationIdToSpreeShipments < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_shipments, :stock_location_id, :integer
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20130227143905)
2
+ class AddPendingToInventoryUnit < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_inventory_units, :pending, :boolean, :default => true
5
+ Spree::InventoryUnit.update_all(:pending => false)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20130228164411)
2
+ class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration
3
+ def change
4
+ remove_column :spree_products, :on_demand
5
+ remove_column :spree_variants, :on_demand
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ # This migration comes from spree (originally 20130228210442)
2
+ class CreateShippingMethodZone < ActiveRecord::Migration
3
+ def up
4
+ create_table :shipping_methods_zones, :id => false do |t|
5
+ t.integer :shipping_method_id
6
+ t.integer :zone_id
7
+ end
8
+ # This association has been corrected in a latter migration
9
+ # but when this database migration runs, the table is still incorrectly named
10
+ # 'shipping_methods_zones' instead of 'spre_shipping_methods_zones'
11
+ Spree::ShippingMethod.has_and_belongs_to_many :zones, :join_table => 'shipping_methods_zones',
12
+ :class_name => 'Spree::Zone',
13
+ :foreign_key => 'shipping_method_id'
14
+ Spree::ShippingMethod.all.each{|sm| sm.zones << Spree::Zone.find(sm.zone_id)}
15
+
16
+ remove_column :spree_shipping_methods, :zone_id
17
+ end
18
+
19
+ def down
20
+ drop_table :shipping_methods_zones
21
+ add_column :spree_shipping_methods, :zone_id, :integer
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130301162745)
2
+ class RemoveShippingCategoryIdFromShippingMethod < ActiveRecord::Migration
3
+ def change
4
+ remove_column :spree_shipping_methods, :shipping_category_id
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ # This migration comes from spree (originally 20130301162924)
2
+ class CreateShippingMethodCategories < ActiveRecord::Migration
3
+ def change
4
+ create_table :spree_shipping_method_categories do |t|
5
+ t.integer :shipping_method_id, :null => false
6
+ t.integer :shipping_category_id, :null => false
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :spree_shipping_method_categories, :shipping_method_id
12
+ add_index :spree_shipping_method_categories, :shipping_category_id
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20130301205200)
2
+ class AddTrackingUrlToSpreeShippingMethods < ActiveRecord::Migration
3
+ def change
4
+ add_column :spree_shipping_methods, :tracking_url, :string
5
+ end
6
+ end
@@ -0,0 +1,25 @@
1
+ # This migration comes from spree (originally 20130304162240)
2
+ class CreateSpreeShippingRates < ActiveRecord::Migration
3
+ def up
4
+ create_table :spree_shipping_rates do |t|
5
+ t.belongs_to :shipment
6
+ t.belongs_to :shipping_method
7
+ t.boolean :selected, :default => false
8
+ t.decimal :cost, :precision => 8, :scale => 2
9
+ t.timestamps
10
+ end
11
+ add_index(:spree_shipping_rates, [:shipment_id, :shipping_method_id],
12
+ :name => 'spree_shipping_rates_join_index',
13
+ :unique => true)
14
+
15
+ # Spree::Shipment.all.each do |shipment|
16
+ # shipping_method = Spree::ShippingMethod.find(shipment.shipment_method_id)
17
+ # shipment.add_shipping_method(shipping_method, true)
18
+ # end
19
+ end
20
+
21
+ def down
22
+ # add_column :spree_shipments, :shipping_method_id, :integer
23
+ drop_table :spree_shipping_rates
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ # This migration comes from spree (originally 20130304192936)
2
+ class RemoveCategoryMatchAttributesFromShippingMethod < ActiveRecord::Migration
3
+ def change
4
+ remove_column :spree_shipping_methods, :match_none
5
+ remove_column :spree_shipping_methods, :match_one
6
+ remove_column :spree_shipping_methods, :match_all
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ # This migration comes from spree (originally 20130305143310)
2
+ class CreateStockMovements < ActiveRecord::Migration
3
+ def change
4
+ create_table :spree_stock_movements do |t|
5
+ t.belongs_to :stock_item
6
+ t.integer :quantity
7
+ t.string :action
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :spree_stock_movements, :stock_item_id
12
+ end
13
+ end