solidus_core 1.4.2 → 2.0.0.beta1

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.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (351) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/spree/user_address_book.rb +1 -1
  3. data/app/models/spree/adjustment.rb +0 -19
  4. data/app/models/spree/credit_card.rb +6 -4
  5. data/app/models/spree/inventory_unit.rb +2 -2
  6. data/app/models/spree/item_adjustments.rb +5 -1
  7. data/app/models/spree/order/checkout.rb +1 -1
  8. data/app/models/spree/order/payments.rb +4 -0
  9. data/app/models/spree/order.rb +5 -19
  10. data/app/models/spree/order_capturing.rb +15 -8
  11. data/app/models/spree/order_contents.rb +1 -0
  12. data/app/models/spree/order_update_attributes.rb +0 -2
  13. data/app/models/spree/order_updater.rb +2 -2
  14. data/app/models/spree/payment.rb +3 -2
  15. data/app/models/spree/promotion/actions/create_adjustment.rb +2 -1
  16. data/app/models/spree/promotion/actions/create_item_adjustments.rb +2 -2
  17. data/app/models/spree/shipment.rb +1 -1
  18. data/app/models/spree/stock_transfer.rb +1 -1
  19. data/app/models/spree/tax/item_adjuster.rb +3 -2
  20. data/app/models/spree/tax/order_adjuster.rb +3 -0
  21. data/app/models/spree/tax_rate.rb +3 -3
  22. data/app/models/spree/transfer_item.rb +2 -2
  23. data/app/models/spree/unit_cancel.rb +2 -2
  24. data/db/migrate/20120831092320_spree_one_two.rb +2 -2
  25. data/db/migrate/20120831092359_spree_promo_one_two.rb +2 -2
  26. data/db/migrate/20120905145253_add_tax_rate_label.rb +1 -1
  27. data/db/migrate/20120905151823_add_toggle_tax_rate_display.rb +1 -1
  28. data/db/migrate/20120929093553_remove_unused_preference_columns.rb +1 -1
  29. data/db/migrate/20121009142519_add_lock_version_to_variant.rb +1 -1
  30. data/db/migrate/20121010142909_add_states_required_to_countries.rb +1 -1
  31. data/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb +1 -1
  32. data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +1 -1
  33. data/db/migrate/20121031162139_split_prices_from_variants.rb +1 -1
  34. data/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb +1 -1
  35. data/db/migrate/20121107184631_add_currency_to_line_items.rb +1 -1
  36. data/db/migrate/20121107194006_add_currency_to_orders.rb +1 -1
  37. data/db/migrate/20121109173623_add_cost_currency_to_variants.rb +1 -1
  38. data/db/migrate/20121111231553_remove_display_on_from_payment_methods.rb +1 -1
  39. data/db/migrate/20121124203911_add_position_to_taxonomies.rb +1 -1
  40. data/db/migrate/20121126040517_add_last_ip_to_spree_orders.rb +1 -1
  41. data/db/migrate/20121213162028_add_state_to_spree_adjustments.rb +1 -1
  42. data/db/migrate/20130114053446_add_display_on_to_spree_payment_methods.rb +1 -1
  43. data/db/migrate/20130120201805_add_position_to_product_properties.spree.rb +1 -1
  44. data/db/migrate/20130203232234_add_identifier_to_spree_payments.rb +1 -1
  45. data/db/migrate/20130207155350_add_order_id_index_to_payments.rb +1 -1
  46. data/db/migrate/20130208032954_add_primary_to_spree_products_taxons.rb +1 -1
  47. data/db/migrate/20130211190146_create_spree_stock_items.rb +1 -1
  48. data/db/migrate/20130211191120_create_spree_stock_locations.rb +1 -1
  49. data/db/migrate/20130213191427_create_default_stock.rb +1 -1
  50. data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +1 -1
  51. data/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +1 -1
  52. data/db/migrate/20130226191231_add_stock_location_id_to_spree_shipments.rb +1 -1
  53. data/db/migrate/20130227143905_add_pending_to_inventory_unit.rb +1 -1
  54. data/db/migrate/20130228164411_remove_on_demand_from_product_and_variant.rb +1 -1
  55. data/db/migrate/20130228210442_create_shipping_method_zone.rb +1 -1
  56. data/db/migrate/20130301162745_remove_shipping_category_id_from_shipping_method.rb +1 -1
  57. data/db/migrate/20130301162924_create_shipping_method_categories.rb +1 -1
  58. data/db/migrate/20130301205200_add_tracking_url_to_spree_shipping_methods.rb +1 -1
  59. data/db/migrate/20130304162240_create_spree_shipping_rates.rb +1 -1
  60. data/db/migrate/20130304192936_remove_category_match_attributes_from_shipping_method.rb +1 -1
  61. data/db/migrate/20130305143310_create_stock_movements.rb +1 -1
  62. data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +1 -1
  63. data/db/migrate/20130306191917_add_active_field_to_stock_locations.rb +1 -1
  64. data/db/migrate/20130306195650_add_backorderable_to_stock_item.rb +1 -1
  65. data/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb +1 -1
  66. data/db/migrate/20130318151756_add_source_and_destination_to_stock_movements.rb +1 -1
  67. data/db/migrate/20130319062004_change_orders_total_precision.rb +1 -1
  68. data/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +1 -1
  69. data/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +1 -1
  70. data/db/migrate/20130319082943_change_adjustments_amount_precision.rb +1 -1
  71. data/db/migrate/20130319183250_add_originator_to_stock_movement.rb +1 -1
  72. data/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb +1 -1
  73. data/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb +1 -1
  74. data/db/migrate/20130326175857_add_stock_location_to_rma.rb +1 -1
  75. data/db/migrate/20130328130308_update_shipment_state_for_canceled_orders.rb +1 -1
  76. data/db/migrate/20130328195253_add_seo_metas_to_taxons.rb +1 -1
  77. data/db/migrate/20130329134939_remove_stock_item_and_variant_lock.rb +1 -1
  78. data/db/migrate/20130413230529_add_name_to_spree_credit_cards.rb +1 -1
  79. data/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb +1 -1
  80. data/db/migrate/20130417120034_add_index_to_source_columns_on_adjustments.rb +1 -1
  81. data/db/migrate/20130417120035_update_adjustment_states.rb +1 -1
  82. data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +1 -1
  83. data/db/migrate/20130418125341_create_spree_stock_transfers.rb +1 -1
  84. data/db/migrate/20130423110707_drop_products_count_on_hand.rb +1 -1
  85. data/db/migrate/20130423223847_set_default_shipping_rate_cost.rb +1 -1
  86. data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +1 -1
  87. data/db/migrate/20130514151929_add_sku_index_to_spree_variants.rb +1 -1
  88. data/db/migrate/20130515180736_add_backorderable_default_to_spree_stock_location.rb +1 -1
  89. data/db/migrate/20130516151222_add_propage_all_variants_to_spree_stock_location.rb +1 -1
  90. data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +1 -1
  91. data/db/migrate/20130611185927_add_user_id_index_to_spree_orders.rb +1 -1
  92. data/db/migrate/20130618041418_add_updated_at_to_spree_countries.rb +1 -1
  93. data/db/migrate/20130619012236_add_updated_at_to_spree_states.rb +1 -1
  94. data/db/migrate/20130626232741_add_cvv_result_code_and_cvv_result_message_to_spree_payments.rb +1 -1
  95. data/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb +1 -1
  96. data/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb +1 -1
  97. data/db/migrate/20130708052307_add_deleted_at_to_spree_tax_rates.rb +1 -1
  98. data/db/migrate/20130711200933_remove_lock_version_from_inventory_units.rb +1 -1
  99. data/db/migrate/20130718042445_add_cost_price_to_line_item.rb +1 -1
  100. data/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb +1 -1
  101. data/db/migrate/20130725031716_add_created_by_id_to_spree_orders.rb +1 -1
  102. data/db/migrate/20130729214043_index_completed_at_on_spree_orders.rb +1 -1
  103. data/db/migrate/20130802014537_add_tax_category_id_to_spree_line_items.rb +1 -1
  104. data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +1 -1
  105. data/db/migrate/20130806022521_drop_spree_mail_methods.rb +1 -1
  106. data/db/migrate/20130806145853_set_default_stock_location_on_shipments.rb +1 -1
  107. data/db/migrate/20130807024301_upgrade_adjustments.rb +1 -1
  108. data/db/migrate/20130807024302_rename_adjustment_fields.rb +1 -1
  109. data/db/migrate/20130809164245_add_admin_name_column_to_spree_shipping_methods.rb +1 -1
  110. data/db/migrate/20130809164330_add_admin_name_column_to_spree_stock_locations.rb +1 -1
  111. data/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb +1 -1
  112. data/db/migrate/20130813140619_expand_order_number_size.rb +1 -1
  113. data/db/migrate/20130813232134_rename_activators_to_promotions.rb +1 -1
  114. data/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb +1 -1
  115. data/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb +1 -1
  116. data/db/migrate/20130826062534_add_depth_to_spree_taxons.rb +1 -1
  117. data/db/migrate/20130828234942_add_tax_total_to_line_items_shipments_and_orders.rb +1 -1
  118. data/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +1 -1
  119. data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +1 -1
  120. data/db/migrate/20130903183026_add_code_to_spree_promotion_rules.rb +1 -1
  121. data/db/migrate/20130909115621_change_states_required_for_countries.rb +1 -1
  122. data/db/migrate/20130915032339_add_deleted_at_to_spree_stock_items.rb +1 -1
  123. data/db/migrate/20130917024658_remove_promotions_event_name_field.rb +1 -1
  124. data/db/migrate/20130924040529_add_promo_total_to_line_items_and_shipments_and_orders.rb +1 -1
  125. data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +1 -1
  126. data/db/migrate/20131026154747_add_track_inventory_to_variant.rb +1 -1
  127. data/db/migrate/20131107132123_add_tax_category_to_variants.rb +1 -1
  128. data/db/migrate/20131113035136_add_channel_to_spree_orders.rb +1 -1
  129. data/db/migrate/20131118043959_add_included_to_adjustments.rb +1 -1
  130. data/db/migrate/20131118050234_rename_tax_total_fields.rb +1 -1
  131. data/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb +1 -1
  132. data/db/migrate/20131120234456_add_updated_at_to_variants.rb +1 -1
  133. data/db/migrate/20131127001002_add_position_to_classifications.rb +1 -1
  134. data/db/migrate/20131211112807_create_spree_orders_promotions.rb +1 -1
  135. data/db/migrate/20131211192741_unique_shipping_method_categories.rb +1 -1
  136. data/db/migrate/20131218054603_add_item_count_to_spree_orders.rb +1 -1
  137. data/db/migrate/20140106065820_remove_value_type_from_spree_preferences.rb +1 -1
  138. data/db/migrate/20140106224208_rename_permalink_to_slug_for_products.rb +1 -1
  139. data/db/migrate/20140120160805_add_index_to_variant_id_and_currency_on_prices.rb +1 -1
  140. data/db/migrate/20140124023232_rename_activator_id_in_rules_and_actions_to_promotion_id.rb +1 -1
  141. data/db/migrate/20140129024326_add_deleted_at_to_spree_prices.rb +1 -1
  142. data/db/migrate/20140203161722_add_approver_id_and_approved_at_to_orders.rb +1 -1
  143. data/db/migrate/20140204115338_add_confirmation_delivered_to_spree_orders.rb +1 -1
  144. data/db/migrate/20140204192230_add_auto_capture_to_payment_methods.rb +1 -1
  145. data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +1 -1
  146. data/db/migrate/20140205144710_add_uncaptured_amount_to_payments.rb +1 -1
  147. data/db/migrate/20140205181631_default_variant_weight_to_zero.rb +1 -1
  148. data/db/migrate/20140207085910_add_tax_category_id_to_shipping_methods.rb +1 -1
  149. data/db/migrate/20140207093021_add_tax_rate_id_to_shipping_rates.rb +1 -1
  150. data/db/migrate/20140211040159_add_pre_tax_amount_to_line_items_and_shipments.rb +1 -1
  151. data/db/migrate/20140213184916_add_more_indexes.rb +1 -1
  152. data/db/migrate/20140219060952_add_considered_risky_to_orders.rb +1 -1
  153. data/db/migrate/20140227112348_add_preference_store_to_everything.rb +1 -1
  154. data/db/migrate/20140307235515_add_user_id_to_spree_credit_cards.rb +1 -1
  155. data/db/migrate/20140309023735_migrate_old_preferences.rb +1 -1
  156. data/db/migrate/20140309024355_create_spree_stores.rb +2 -2
  157. data/db/migrate/20140309033438_create_store_from_preferences.rb +1 -1
  158. data/db/migrate/20140315053743_add_timestamps_to_spree_assets.rb +1 -1
  159. data/db/migrate/20140318191500_create_spree_taxons_promotion_rules.rb +1 -1
  160. data/db/migrate/20140331100557_add_additional_store_fields.rb +1 -1
  161. data/db/migrate/20140410141842_add_many_missing_indexes.rb +1 -1
  162. data/db/migrate/20140410150358_correct_some_polymorphic_index_and_add_more_missing.rb +1 -1
  163. data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +1 -1
  164. data/db/migrate/20140508151342_change_spree_price_amount_precision.rb +1 -1
  165. data/db/migrate/20140518174634_add_token_to_spree_orders.rb +1 -1
  166. data/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb +1 -1
  167. data/db/migrate/20140601011216_set_shipment_total_for_users_upgrading.rb +1 -1
  168. data/db/migrate/20140604135309_drop_credit_card_first_name_and_last_name.rb +1 -1
  169. data/db/migrate/20140609201656_add_deleted_at_to_spree_promotion_actions.rb +1 -1
  170. data/db/migrate/20140616202624_remove_uncaptured_amount_from_spree_payments.rb +1 -1
  171. data/db/migrate/20140625214618_create_spree_refunds.rb +1 -1
  172. data/db/migrate/20140702140656_create_spree_return_authorization_inventory_unit.rb +1 -1
  173. data/db/migrate/20140707125621_rename_return_authorization_inventory_unit_to_return_items.rb +1 -1
  174. data/db/migrate/20140708132019_create_order_mutex.rb +1 -1
  175. data/db/migrate/20140709160534_backfill_line_item_pre_tax_amount.rb +1 -1
  176. data/db/migrate/20140710041921_recreate_spree_return_authorizations.rb +2 -2
  177. data/db/migrate/20140710181204_add_amount_fields_to_return_items.rb +1 -1
  178. data/db/migrate/20140710190048_drop_return_authorization_amount.rb +1 -1
  179. data/db/migrate/20140713140455_create_spree_return_authorization_reasons.rb +1 -1
  180. data/db/migrate/20140713140527_create_spree_refund_reasons.rb +1 -1
  181. data/db/migrate/20140713142214_rename_return_authorization_reason.rb +1 -1
  182. data/db/migrate/20140715182625_create_spree_promotion_categories.rb +1 -1
  183. data/db/migrate/20140716204111_drop_received_at_on_return_items.rb +1 -1
  184. data/db/migrate/20140716212330_add_reception_and_acceptance_status_to_return_items.rb +1 -1
  185. data/db/migrate/20140717155155_create_default_refund_reason.rb +1 -1
  186. data/db/migrate/20140717185932_add_default_to_spree_stock_locations.rb +1 -1
  187. data/db/migrate/20140718133010_create_spree_customer_returns.rb +1 -1
  188. data/db/migrate/20140718133349_add_customer_return_id_to_return_item.rb +1 -1
  189. data/db/migrate/20140718195325_create_friendly_id_slugs.rb +1 -1
  190. data/db/migrate/20140723004419_rename_spree_refund_return_authorization_id.rb +1 -1
  191. data/db/migrate/20140723152808_increase_return_item_pre_tax_amount_precision.rb +1 -1
  192. data/db/migrate/20140723214541_copy_product_slugs_to_slug_history.rb +1 -1
  193. data/db/migrate/20140725131539_create_spree_reimbursements.rb +1 -1
  194. data/db/migrate/20140728225422_add_promotionable_to_spree_products.rb +1 -1
  195. data/db/migrate/20140729133613_add_exchange_inventory_unit_foreign_keys.rb +1 -1
  196. data/db/migrate/20140730155938_add_acceptance_status_errors_to_return_item.rb +1 -1
  197. data/db/migrate/20140731150017_create_spree_reimbursement_types.rb +1 -1
  198. data/db/migrate/20140804185157_add_default_to_shipment_cost.rb +1 -1
  199. data/db/migrate/20140805171035_add_default_to_spree_credit_cards.rb +1 -1
  200. data/db/migrate/20140805171219_make_existing_credit_cards_default.rb +1 -1
  201. data/db/migrate/20140806144901_add_type_to_reimbursement_type.rb +1 -1
  202. data/db/migrate/20140808184039_create_spree_reimbursement_credits.rb +1 -1
  203. data/db/migrate/20140827170513_add_meta_title_to_spree_products.rb +1 -1
  204. data/db/migrate/20140924164824_add_code_to_spree_tax_categories.rb +1 -1
  205. data/db/migrate/20140927193717_default_pre_tax_amount_should_be_zero.rb +1 -1
  206. data/db/migrate/20141002191113_add_code_to_spree_shipping_methods.rb +1 -1
  207. data/db/migrate/20141007230328_add_cancel_audit_fields_to_spree_orders.rb +1 -1
  208. data/db/migrate/20141009204607_add_store_id_to_orders.rb +1 -1
  209. data/db/migrate/20141012083513_create_spree_taxons_prototypes.rb +1 -1
  210. data/db/migrate/20141023005240_add_counter_cache_from_spree_variants_to_spree_stock_items.rb +1 -1
  211. data/db/migrate/20141101231208_fix_adjustment_order_presence.rb +1 -1
  212. data/db/migrate/20141105213646_update_classifications_positions.rb +1 -1
  213. data/db/migrate/20141120135441_add_guest_token_index_to_spree_orders.rb +1 -1
  214. data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +1 -1
  215. data/db/migrate/20141217215630_update_product_slug_index.rb +1 -1
  216. data/db/migrate/20141231151320_add_default_column_to_price.rb +1 -1
  217. data/db/migrate/20150112194216_add_position_to_stock_location.rb +1 -1
  218. data/db/migrate/20150113002122_create_spree_promotion_codes.rb +1 -1
  219. data/db/migrate/20150113002123_create_adjustment_promotion_code_association.rb +1 -1
  220. data/db/migrate/20150121022521_remove_environment_from_payment_method.rb +1 -1
  221. data/db/migrate/20150121202544_add_restock_inventory_to_stock_location.rb +1 -1
  222. data/db/migrate/20150122202432_add_code_to_spree_promotion_categories.rb +1 -1
  223. data/db/migrate/20150127161843_create_order_stock_locations.rb +1 -1
  224. data/db/migrate/20150128032538_remove_environment_from_tracker.rb +1 -1
  225. data/db/migrate/20150203151219_add_fulfillable_to_stock_location.rb +1 -1
  226. data/db/migrate/20150205210527_add_code_to_refund_reason.rb +1 -1
  227. data/db/migrate/20150213160148_add_promotion_code_id_to_orders_promotions.rb +1 -1
  228. data/db/migrate/20150213163612_add_approver_name_to_spree_orders.rb +1 -1
  229. data/db/migrate/20150225205344_move_promotion_code_to_promotion_code_value.rb +1 -1
  230. data/db/migrate/20150226195213_downcase_promotion_codes_values.rb +1 -1
  231. data/db/migrate/20150227161934_add_order_ids_to_adjustments_where_missing.rb +1 -1
  232. data/db/migrate/20150303212749_add_per_code_usage_limit_to_promotions.rb +1 -1
  233. data/db/migrate/20150303212826_remove_usage_limit_from_promotion_codes.rb +1 -1
  234. data/db/migrate/20150304211616_add_timestamps_to_order_promotions.rb +1 -1
  235. data/db/migrate/20150305043021_create_spree_cartons.rb +1 -1
  236. data/db/migrate/20150305210403_add_timestamps_to_spree_roles_users.rb +1 -1
  237. data/db/migrate/20150313140507_remove_considered_risky_from_spree_orders.rb +1 -1
  238. data/db/migrate/20150313192827_add_index_to_inventory_units_carton_id.rb +1 -1
  239. data/db/migrate/20150313201235_add_imported_from_shipment_id_to_cartons.rb +1 -1
  240. data/db/migrate/20150313201503_copy_shipped_shipments_to_cartons.rb +1 -1
  241. data/db/migrate/20150330144639_create_spree_user_stock_locations.rb +1 -1
  242. data/db/migrate/20150331134544_add_stock_location_code.rb +1 -1
  243. data/db/migrate/20150402210430_create_unit_cancels.rb +1 -1
  244. data/db/migrate/20150407173305_add_fields_to_stock_transfer.rb +1 -1
  245. data/db/migrate/20150407173531_create_transfer_items.rb +1 -1
  246. data/db/migrate/20150424143547_drop_stock_transfer_type.rb +1 -1
  247. data/db/migrate/20150424161102_add_stock_transfer_finalized_at.rb +1 -1
  248. data/db/migrate/20150429125822_rename_stock_transfer_reference.rb +1 -1
  249. data/db/migrate/20150430233803_create_line_item_actions.rb +1 -1
  250. data/db/migrate/20150506181159_create_spree_store_credit_categories.rb +1 -1
  251. data/db/migrate/20150506181244_create_spree_store_credits.rb +1 -1
  252. data/db/migrate/20150506181539_create_spree_store_credit_events.rb +1 -1
  253. data/db/migrate/20150506181611_create_spree_store_credit_payment_method.rb +1 -1
  254. data/db/migrate/20150506181715_create_store_credit_types.rb +1 -1
  255. data/db/migrate/20150506182045_create_store_credit_reimbursement_type.rb +1 -1
  256. data/db/migrate/20150508044622_add_resellable_to_return_items.rb +1 -1
  257. data/db/migrate/20150514185559_add_invalidated_at_to_spree_store_credits.rb +1 -1
  258. data/db/migrate/20150514201836_migrate_deleted_store_credits_to_invalidated.rb +1 -1
  259. data/db/migrate/20150515170322_add_check_stock_on_transfer.rb +1 -1
  260. data/db/migrate/20150515211137_fix_adjustment_order_id.rb +1 -1
  261. data/db/migrate/20150528125647_delete_inventory_units_without_shipment.rb +1 -1
  262. data/db/migrate/20150601191251_add_deleted_at_to_stock_transfers.rb +1 -1
  263. data/db/migrate/20150601204148_add_deleted_at_to_transfer_items.rb +1 -1
  264. data/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +1 -1
  265. data/db/migrate/20150609193231_add_preferences_to_promotion_actions.rb +1 -1
  266. data/db/migrate/20150610182638_add_id_to_spree_option_values_variants.rb +1 -1
  267. data/db/migrate/20150611200247_add_frontend_viewable_to_spree_orders.rb +1 -1
  268. data/db/migrate/20150612205731_remove_spree_configurations.rb +1 -1
  269. data/db/migrate/20150616204659_add_preference_source_to_spree_payment_methods.rb +1 -1
  270. data/db/migrate/20150618191713_remove_credit_card_address_id.rb +1 -1
  271. data/db/migrate/20150618212517_create_spree_store_credit_update_reasons.rb +1 -1
  272. data/db/migrate/20150619160613_create_adjustment_reason.rb +1 -1
  273. data/db/migrate/20150622144655_add_update_reason_to_store_credit_events.rb +1 -1
  274. data/db/migrate/20150623194316_add_return_authorization_reason_id_to_return_items.rb +1 -1
  275. data/db/migrate/20150623214058_seed_store_credit_update_reasons.rb +1 -1
  276. data/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb +1 -1
  277. data/db/migrate/20150626214817_remove_counter_cache_from_spree_variants_to_spree_stock_items.rb +1 -1
  278. data/db/migrate/20150629175931_add_address_id_to_credit_card.rb +1 -1
  279. data/db/migrate/20150630175644_copy_order_bill_address_to_credit_card.rb +1 -1
  280. data/db/migrate/20150723224133_remove_unnecessary_indexes.rb +1 -1
  281. data/db/migrate/20150724163716_remove_state_lock_version_from_order.rb +1 -1
  282. data/db/migrate/20150731201146_add_spree_user_addresses.rb +1 -1
  283. data/db/migrate/20150806190833_add_id_and_timestamp_to_promotion_rule_user.rb +1 -1
  284. data/db/migrate/20150811210350_remove_mandatory_from_adjustments.rb +1 -1
  285. data/db/migrate/20150811211025_add_finalized_to_spree_adjustments.rb +1 -1
  286. data/db/migrate/20150820160821_add_store_payment_methods.rb +1 -1
  287. data/db/migrate/20150824213633_convert_habtm_to_hmt_for_shipping_methods_zones.rb +1 -1
  288. data/db/migrate/20150824214129_convert_habtm_to_hmt_for_products_promotion_rules.rb +1 -1
  289. data/db/migrate/20150825204216_drop_spree_gateways.rb +1 -1
  290. data/db/migrate/20150826002555_convert_habtm_to_hmt_for_taxon_prototypes.rb +1 -1
  291. data/db/migrate/20150909123605_create_variant_properties_and_rules.rb +1 -1
  292. data/db/migrate/20151001121454_create_spree_shipping_method_stock_locations.rb +1 -1
  293. data/db/migrate/20151002023248_add_foreign_key_to_shipping_method_stock_location.rb +1 -1
  294. data/db/migrate/20151010003252_add_foreign_keys_for_taxons_prototypes.rb +1 -1
  295. data/db/migrate/20151013222921_remove_token_permissions_table.rb +1 -1
  296. data/db/migrate/20151014213349_rename_identifier_to_number_for_payment.rb +1 -1
  297. data/db/migrate/20151015203732_add_foreign_keys_for_product_promotion_rules.rb +1 -1
  298. data/db/migrate/20151021113730_add_sale_to_spree_promotions.rb +1 -1
  299. data/db/migrate/20151021163309_convert_sale_promotions.rb +1 -1
  300. data/db/migrate/20151026093607_change_return_item_pre_tax_amount_to_amount.rb +1 -1
  301. data/db/migrate/20151117063249_convert_habtm_to_hmt_for_properties_prototypes.rb +1 -1
  302. data/db/migrate/20151124062500_convert_habtm_to_hmt_for_option_type_prototypes.rb +1 -1
  303. data/db/migrate/20151126063028_convert_habtm_to_hmt_for_taxons_promotion_rules.rb +1 -1
  304. data/db/migrate/20151219020209_add_stock_item_unique_index.rb +1 -1
  305. data/db/migrate/20160111091912_add_column_available_to_all_on_spree_shipping_method.rb +1 -1
  306. data/db/migrate/20160116133604_add_position_to_spree_payment_methods.rb +1 -1
  307. data/db/migrate/20160122182105_add_carrier_and_service_level_to_spree_shipping_methods.rb +1 -1
  308. data/db/migrate/20160224201413_create_spree_shipping_rate_taxes.rb +1 -1
  309. data/db/migrate/20160229133259_add_cart_tax_country_iso_to_spree_store.rb +1 -1
  310. data/db/migrate/20160301103333_remove_pre_tax_amount_on_line_item_and_shipment.rb +1 -1
  311. data/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb +1 -1
  312. data/db/migrate/20160318145302_add_timestamps_to_prices.rb +1 -1
  313. data/db/migrate/20160330204846_add_missing_timestamp_columns.rb +1 -1
  314. data/db/migrate/20160509181311_add_country_iso_to_prices.rb +1 -1
  315. data/db/migrate/20160527070401_rename_shipment_address_field.rb +1 -1
  316. data/db/migrate/20160608162651_ensure_default_store.rb +1 -1
  317. data/db/migrate/20160608180751_ensure_store_on_orders.rb +1 -1
  318. data/db/migrate/20160616232103_remove_user_id_from_promotion_rules.rb +1 -1
  319. data/db/migrate/20160718205341_add_payment_id_index_to_spree_refunds.rb +1 -1
  320. data/db/migrate/20160718205859_add_reimbursement_id_index_to_spree_refunds.rb +1 -1
  321. data/lib/generators/spree/custom_user/templates/migration.rb.tt +1 -1
  322. data/lib/generators/spree/dummy/dummy_generator.rb +4 -1
  323. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -2
  324. data/lib/spree/core/importer/order.rb +1 -0
  325. data/lib/spree/core/importer/product.rb +2 -2
  326. data/lib/spree/core/version.rb +1 -1
  327. data/lib/spree/deprecation.rb +1 -1
  328. data/lib/spree/testing_support/common_rake.rb +1 -1
  329. data/lib/spree/testing_support/factories/adjustment_factory.rb +14 -19
  330. data/solidus_core.gemspec +4 -4
  331. data/spec/lib/spree/core/controller_helpers/auth_spec.rb +2 -2
  332. data/spec/lib/tasks/order_capturing_spec.rb +1 -1
  333. data/spec/models/spree/adjustment_spec.rb +1 -2
  334. data/spec/models/spree/credit_card_spec.rb +12 -12
  335. data/spec/models/spree/item_adjustments_spec.rb +4 -6
  336. data/spec/models/spree/order/checkout_spec.rb +14 -1
  337. data/spec/models/spree/order/payment_spec.rb +18 -22
  338. data/spec/models/spree/order_cancellations_spec.rb +2 -2
  339. data/spec/models/spree/order_capturing_spec.rb +2 -2
  340. data/spec/models/spree/order_shipping_spec.rb +2 -2
  341. data/spec/models/spree/order_spec.rb +8 -56
  342. data/spec/models/spree/order_update_attributes_spec.rb +1 -5
  343. data/spec/models/spree/payment_spec.rb +1 -2
  344. data/spec/models/spree/preferences/preferable_spec.rb +4 -4
  345. data/spec/models/spree/product_spec.rb +11 -20
  346. data/spec/models/spree/stock_item_spec.rb +19 -32
  347. data/spec/models/spree/store_credit_spec.rb +2 -2
  348. data/spec/models/spree/tax/item_adjuster_spec.rb +2 -1
  349. data/spec/models/spree/tax/order_adjuster_spec.rb +2 -0
  350. data/spec/spec_helper.rb +2 -0
  351. metadata +13 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ed91e331714aac66f2d62d0cd91f38a017ccc33
4
- data.tar.gz: d44b301719f10414d45cd960a1d6d9ead7fc8347
3
+ metadata.gz: db4e0e9709867fb934de7f6250cf594afbc087c6
4
+ data.tar.gz: 13f9c0f6043e15d1411234d0a341b80242ba58fb
5
5
  SHA512:
6
- metadata.gz: ea89683585bf67ec9c2dcab332eef19f5badab7780b0534b85cdea8bc645c1ce053decc62859f1f33a14affc1f34df61983e98da3335d2e1f4b05bc60477ea91
7
- data.tar.gz: f7d0fe364457ace7463e77540ea14bfce8df7857b8a157fa717d76b3a3ba16e4a74fc8178bd61939940bcbc107ec649f589e245d3bdf731b0304ed5976a8a87c
6
+ metadata.gz: d1b74e57ddb5daa0c9066ee20766af6bfc5d825fefb21f52c007eb79484599c6590e0acfb445de074b91c7e3de419ad26b4593937842f7601237cad14379426d
7
+ data.tar.gz: 6fe815393c2fbee2d930fc52157e1679c2e8b4b228f3d99ea13a5b54d67161cb4e8aa7affbc1ee0a55e39bdae8be67fe0949c4df9514210d6c8c1eeb45069af7
@@ -92,7 +92,7 @@ module Spree
92
92
  # #default_address or not
93
93
  def save_in_address_book(address_attributes, default = false)
94
94
  return nil unless address_attributes.present?
95
- address_attributes = address_attributes.with_indifferent_access
95
+ address_attributes = address_attributes.to_h.with_indifferent_access
96
96
 
97
97
  new_address = Address.factory(address_attributes)
98
98
  return new_address unless new_address.valid?
@@ -26,11 +26,6 @@ module Spree
26
26
  validates :amount, numericality: true
27
27
  validates :promotion_code, presence: true, if: :require_promotion_code?
28
28
 
29
- # We need to use `after_commit` here because otherwise it's too early to
30
- # tell if any repair is needed.
31
- after_commit :repair_adjustments_associations_on_create, on: [:create]
32
- after_commit :repair_adjustments_associations_on_destroy, on: [:destroy]
33
-
34
29
  scope :not_finalized, -> { where(finalized: false) }
35
30
  scope :open, -> do
36
31
  Spree::Deprecation.warn "Adjustment.open is deprecated. Instead use Adjustment.not_finalized", caller
@@ -182,19 +177,5 @@ module Spree
182
177
  def require_promotion_code?
183
178
  promotion? && source.promotion.codes.any?
184
179
  end
185
-
186
- def repair_adjustments_associations_on_create
187
- if adjustable.adjustments.loaded? && !adjustable.adjustments.include?(self)
188
- Spree::Deprecation.warn("Adjustment was not added to #{adjustable.class}. Add adjustments via `adjustable.adjustments.create!`. Partial call stack: #{caller.select { |line| line =~ %r(/(app|spec)/) }}.", caller)
189
- adjustable.adjustments.proxy_association.add_to_target(self)
190
- end
191
- end
192
-
193
- def repair_adjustments_associations_on_destroy
194
- if adjustable.adjustments.loaded? && adjustable.adjustments.include?(self)
195
- Spree::Deprecation.warn("Adjustment was not removed from #{adjustable.class}. Remove adjustments via `adjustable.adjustments.destroy`. Partial call stack: #{caller.select { |line| line =~ %r(/(app|spec)/) }}.", caller)
196
- adjustable.adjustments.proxy_association.target.delete(self)
197
- end
198
- end
199
180
  end
200
181
  end
@@ -64,10 +64,11 @@ module Spree
64
64
  #
65
65
  # @param num [String] the desired credit card number
66
66
  def number=(num)
67
- @number =
68
- if num.is_a?(String)
69
- num.gsub(/[^0-9]/, '')
70
- end
67
+ @number = begin
68
+ num.gsub(/[^0-9]/, '')
69
+ rescue
70
+ nil
71
+ end
71
72
  end
72
73
 
73
74
  # Sets the credit card type, converting it to the preferred internal
@@ -88,6 +89,7 @@ module Spree
88
89
 
89
90
  # Sets the last digits field based on the assigned credit card number.
90
91
  def set_last_digits
92
+ number.to_s.gsub!(/\s/, '')
91
93
  verification_value.to_s.gsub!(/\s/, '')
92
94
  self.last_digits ||= number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
93
95
  end
@@ -135,12 +135,12 @@ module Spree
135
135
  def ensure_can_destroy
136
136
  if !backordered? && !on_hand?
137
137
  errors.add(:state, :cannot_destroy, state: state)
138
- return false
138
+ throw :abort
139
139
  end
140
140
 
141
141
  unless shipment.pending?
142
142
  errors.add(:base, :cannot_destroy_shipment_state, state: shipment.state)
143
- return false
143
+ throw :abort
144
144
  end
145
145
  end
146
146
  end
@@ -83,7 +83,11 @@ module Spree
83
83
  private
84
84
 
85
85
  def adjustments
86
- @adjustments ||= item.adjustments.to_a
86
+ # This is done intentionally to avoid loading the association. If the
87
+ # association is loaded, the records may become stale due to code
88
+ # elsewhere in spree. When that is remedied, this should be changed to
89
+ # just item.adjustments
90
+ @adjustments ||= item.adjustments.all.to_a
87
91
  end
88
92
  end
89
93
  end
@@ -244,7 +244,7 @@ module Spree
244
244
  checkout_step_index(state) > checkout_step_index(self.state)
245
245
  end
246
246
 
247
- define_callbacks :updating_from_params, terminator: ->(_target, result) { result == false }
247
+ define_callbacks :updating_from_params, terminator: deprecated_false_terminator
248
248
 
249
249
  set_callback :updating_from_params, :before, :update_params_payment_source
250
250
 
@@ -43,6 +43,10 @@ module Spree
43
43
  break if payment_total >= total
44
44
 
45
45
  payment.public_send(method)
46
+
47
+ if payment.completed?
48
+ self.payment_total += payment.amount
49
+ end
46
50
  end
47
51
  rescue Core::GatewayError => e
48
52
  result = !!Spree::Config[:allow_checkout_on_gateway_error]
@@ -47,7 +47,7 @@ module Spree
47
47
  belongs_to :store, class_name: 'Spree::Store'
48
48
  has_many :state_changes, as: :stateful
49
49
  has_many :line_items, -> { order(:created_at, :id) }, dependent: :destroy, inverse_of: :order
50
- has_many :payments, dependent: :destroy, inverse_of: :order
50
+ has_many :payments, dependent: :destroy
51
51
  has_many :return_authorizations, dependent: :destroy, inverse_of: :order
52
52
  has_many :reimbursements, inverse_of: :order
53
53
  has_many :adjustments, -> { order(:created_at) }, as: :adjustable, inverse_of: :adjustable, dependent: :destroy
@@ -503,6 +503,7 @@ module Spree
503
503
  elsif shipments.any? { |s| !s.pending? }
504
504
  raise CannotRebuildShipments.new(Spree.t(:cannot_rebuild_shipments_shipments_not_pending))
505
505
  else
506
+ adjustments.shipping.destroy_all
506
507
  shipments.destroy_all
507
508
  self.shipments = Spree::Config.stock.coordinator_class.new(self).shipments
508
509
  end
@@ -510,7 +511,9 @@ module Spree
510
511
 
511
512
  def apply_free_shipping_promotions
512
513
  Spree::PromotionHandler::FreeShipping.new(self).activate
513
- update!
514
+ shipments.each { |shipment| ItemAdjustments.new(shipment).update }
515
+ updater.update_shipment_total
516
+ persist_totals
514
517
  end
515
518
 
516
519
  # Clean shipments and make order back to address state
@@ -689,23 +692,6 @@ module Spree
689
692
  Spree::Money.new(total_available_store_credit - total_applicable_store_credit, { currency: currency })
690
693
  end
691
694
 
692
- def payments_attributes=(attributes)
693
- validate_payments_attributes(attributes)
694
- super(attributes)
695
- end
696
-
697
- def validate_payments_attributes(attributes)
698
- attributes = Array.wrap(attributes)
699
- # Ensure the payment methods specified are allowed for this user
700
- payment_methods = Spree::PaymentMethod.where(id: available_payment_methods)
701
- attributes.each do |payment_attributes|
702
- payment_method_id = payment_attributes[:payment_method_id]
703
-
704
- # raise RecordNotFound unless it is an allowed payment method
705
- payment_methods.find(payment_method_id) if payment_method_id
706
- end
707
- end
708
-
709
695
  private
710
696
 
711
697
  def associate_store
@@ -21,15 +21,22 @@ class Spree::OrderCapturing
21
21
  Spree::OrderMutex.with_lock!(@order) do
22
22
  uncaptured_amount = @order.display_total.cents
23
23
 
24
- sorted_payments(@order).each do |payment|
25
- amount = [uncaptured_amount, payment.money.cents].min
26
-
27
- if amount > 0
28
- payment.capture!(amount)
29
- uncaptured_amount -= amount
30
- elsif Spree::OrderCapturing.void_unused_payments
31
- payment.void_transaction!
24
+ begin
25
+ sorted_payments(@order).each do |payment|
26
+ amount = [uncaptured_amount, payment.money.cents].min
27
+
28
+ if amount > 0
29
+ payment.capture!(amount)
30
+ uncaptured_amount -= amount
31
+ elsif Spree::OrderCapturing.void_unused_payments
32
+ payment.void_transaction!
33
+ end
32
34
  end
35
+ ensure
36
+ # FIXME: Adding the inverse_of on the payments relation for orders -should- fix this,
37
+ # however it only appears to make it worse (calling with changes three times instead of once.
38
+ # Warrants an investigation. Reloading for now.
39
+ @order.reload.update!
33
40
  end
34
41
  end
35
42
  end
@@ -119,6 +119,7 @@ module Spree
119
119
  shipment = options[:shipment]
120
120
  shipment.present? ? shipment.update_amounts : order.ensure_updated_shipments
121
121
  PromotionHandler::Cart.new(order, line_item).activate
122
+ ItemAdjustments.new(line_item).update
122
123
  reload_totals
123
124
  line_item
124
125
  end
@@ -14,8 +14,6 @@ module Spree
14
14
  # Assign the attributes to the order and save the order
15
15
  # @return true if saved, otherwise false and errors will be set on the order
16
16
  def apply
17
- order.validate_payments_attributes(@payments_attributes)
18
-
19
17
  assign_order_attributes
20
18
  assign_payments_attributes
21
19
 
@@ -80,11 +80,11 @@ module Spree
80
80
 
81
81
  all_items = line_items + shipments
82
82
 
83
- order.adjustment_total = all_items.sum(&:adjustment_total) + adjustments.select(&:eligible?).sum(&:amount)
83
+ order.adjustment_total = all_items.sum(&:adjustment_total) + adjustments.eligible.sum(:amount)
84
84
  order.included_tax_total = all_items.sum(&:included_tax_total)
85
85
  order.additional_tax_total = all_items.sum(&:additional_tax_total)
86
86
 
87
- order.promo_total = all_items.sum(&:promo_total) + adjustments.select(&:eligible?).select(&:promotion?).sum(&:amount)
87
+ order.promo_total = all_items.sum(&:promo_total) + adjustments.promotion.eligible.sum(:amount)
88
88
 
89
89
  update_order_total
90
90
  end
@@ -39,7 +39,6 @@ module Spree
39
39
 
40
40
  validates :amount, numericality: true
41
41
  validates :source, presence: true, if: :source_required?
42
- validates :payment_method, presence: true
43
42
 
44
43
  default_scope -> { order(:created_at) }
45
44
 
@@ -221,7 +220,9 @@ WARN
221
220
  errors.add(Spree.t(source.class.to_s.demodulize.underscore), "#{field_name} #{error}")
222
221
  end
223
222
  end
224
- !errors.present?
223
+ if errors.any?
224
+ throw :abort
225
+ end
225
226
  end
226
227
 
227
228
  def source_required?
@@ -22,9 +22,10 @@ module Spree
22
22
  return if promotion_credit_exists?(order)
23
23
 
24
24
  amount = compute_amount(order)
25
- order.adjustments.create!(
25
+ Spree::Adjustment.create!(
26
26
  amount: amount,
27
27
  order: order,
28
+ adjustable: order,
28
29
  source: self,
29
30
  promotion_code: options[:promotion_code],
30
31
  label: "#{Spree.t(:promotion)} (#{promotion.name})"
@@ -40,9 +40,9 @@ module Spree
40
40
  def create_adjustment(adjustable, order, promotion_code)
41
41
  amount = compute_amount(adjustable)
42
42
  return if amount == 0
43
- adjustable.adjustments.create!(
44
- source: self,
43
+ adjustments.create!(
45
44
  amount: amount,
45
+ adjustable: adjustable,
46
46
  order: order,
47
47
  promotion_code: promotion_code,
48
48
  label: "#{Spree.t(:promotion)} (#{promotion.name})"
@@ -409,7 +409,7 @@ module Spree
409
409
  def ensure_can_destroy
410
410
  unless pending?
411
411
  errors.add(:state, :cannot_destroy, state: state)
412
- return false
412
+ throw :abort
413
413
  end
414
414
  end
415
415
  end
@@ -103,7 +103,7 @@ module Spree
103
103
  def ensure_not_finalized
104
104
  if finalized?
105
105
  errors.add(:base, Spree.t('errors.messages.cannot_delete_finalized_stock_transfer'))
106
- return false
106
+ throw :abort
107
107
  end
108
108
  end
109
109
  end
@@ -15,6 +15,7 @@ module Spree
15
15
  @rates_for_order_zone = options[:rates_for_order_zone]
16
16
  @rates_for_default_zone = options[:rates_for_default_zone]
17
17
  @order_tax_zone = options[:order_tax_zone]
18
+ @skip_destroy_adjustments = options[:skip_destroy_adjustments]
18
19
  end
19
20
 
20
21
  # Deletes all existing tax adjustments and creates new adjustments for all
@@ -26,8 +27,8 @@ module Spree
26
27
  # @return [Array<Spree::Adjustment>] newly created adjustments
27
28
  def adjust!
28
29
  return unless order_tax_zone(order)
29
-
30
- item.adjustments.destroy(item.adjustments.select(&:tax?))
30
+ # Using .destroy_all to make sure callbacks fire
31
+ item.adjustments.tax.destroy_all unless @skip_destroy_adjustments
31
32
 
32
33
  rates_for_item(item).map { |rate| rate.adjust(order_tax_zone(order), item) }
33
34
  end
@@ -16,6 +16,8 @@ module Spree
16
16
  def adjust!
17
17
  return unless order_tax_zone(order)
18
18
 
19
+ order.all_adjustments.tax.destroy_all
20
+
19
21
  (order.line_items + order.shipments).each do |item|
20
22
  ItemAdjuster.new(item, order_wide_options).adjust!
21
23
  end
@@ -28,6 +30,7 @@ module Spree
28
30
  rates_for_order_zone: rates_for_order_zone(order),
29
31
  rates_for_default_zone: rates_for_default_zone,
30
32
  order_tax_zone: order_tax_zone(order),
33
+ skip_destroy_adjustments: true
31
34
  }
32
35
  end
33
36
  end
@@ -85,13 +85,13 @@ module Spree
85
85
 
86
86
  included = included_in_price && amount > 0
87
87
 
88
- item.adjustments.create!(
89
- source: self,
88
+ adjustments.create!({
89
+ adjustable: item,
90
90
  amount: amount,
91
91
  order_id: item.order_id,
92
92
  label: adjustment_label(amount),
93
93
  included: included
94
- )
94
+ })
95
95
  end
96
96
 
97
97
  # This method is used by Adjustment#update to recalculate the cost.
@@ -29,14 +29,14 @@ module Spree
29
29
  def ensure_stock_transfer_not_finalized
30
30
  unless stock_transfer.finalizable?
31
31
  errors.add(:base, Spree.t('errors.messages.cannot_delete_transfer_item_with_finalized_stock_transfer'))
32
- return false
32
+ throw :abort
33
33
  end
34
34
  end
35
35
 
36
36
  def prevent_expected_quantity_update_stock_transfer_finalized
37
37
  if expected_quantity_changed? && stock_transfer.finalized?
38
38
  errors.add(:base, Spree.t('errors.messages.cannot_update_expected_transfer_item_with_finalized_stock_transfer'))
39
- return false
39
+ throw :abort
40
40
  end
41
41
  end
42
42
 
@@ -16,8 +16,8 @@ class Spree::UnitCancel < Spree::Base
16
16
 
17
17
  amount = compute_amount(inventory_unit.line_item)
18
18
 
19
- self.adjustment = inventory_unit.line_item.adjustments.create!(
20
- source: self,
19
+ create_adjustment!(
20
+ adjustable: inventory_unit.line_item,
21
21
  amount: amount,
22
22
  order: inventory_unit.order,
23
23
  label: "#{Spree.t(:cancellation)} - #{reason}",
@@ -1,9 +1,9 @@
1
- class SpreeOneTwo < ActiveRecord::Migration
1
+ class SpreeOneTwo < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  # This migration is just a compressed version of all the previous
4
4
  # migrations for spree_core. Do not run it if one of the core tables
5
5
  # already exists. Assume the best.
6
- return if table_exists?(:spree_addresses)
6
+ return if data_source_exists?(:spree_addresses)
7
7
 
8
8
  create_table :spree_activators do |t|
9
9
  t.string :description
@@ -1,7 +1,7 @@
1
- class SpreePromoOneTwo < ActiveRecord::Migration
1
+ class SpreePromoOneTwo < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  # This migration is just a compressed migration for all previous versions of spree_promo
4
- return if table_exists?(:spree_products_promotion_rules)
4
+ return if data_source_exists?(:spree_products_promotion_rules)
5
5
 
6
6
  create_table :spree_products_promotion_rules, id: false, force: true do |t|
7
7
  t.references :product
@@ -1,4 +1,4 @@
1
- class AddTaxRateLabel < ActiveRecord::Migration
1
+ class AddTaxRateLabel < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_tax_rates, :name, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddToggleTaxRateDisplay < ActiveRecord::Migration
1
+ class AddToggleTaxRateDisplay < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_tax_rates, :show_rate_in_label, :boolean, default: true
4
4
  end
@@ -1,4 +1,4 @@
1
- class RemoveUnusedPreferenceColumns < ActiveRecord::Migration
1
+ class RemoveUnusedPreferenceColumns < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps.
4
4
  remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name)
@@ -1,4 +1,4 @@
1
- class AddLockVersionToVariant < ActiveRecord::Migration
1
+ class AddLockVersionToVariant < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_variants, :lock_version, :integer, default: 0
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddStatesRequiredToCountries < ActiveRecord::Migration
1
+ class AddStatesRequiredToCountries < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_countries, :states_required, :boolean, default: true
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddOnDemandToProductAndVariant < ActiveRecord::Migration
1
+ class AddOnDemandToProductAndVariant < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_products, :on_demand, :boolean, default: false
4
4
  add_column :spree_variants, :on_demand, :boolean, default: false
@@ -1,4 +1,4 @@
1
- class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration
1
+ class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  change_column :spree_products, :count_on_hand, :integer, null: true
4
4
  change_column :spree_variants, :count_on_hand, :integer, null: true
@@ -1,4 +1,4 @@
1
- class SplitPricesFromVariants < ActiveRecord::Migration
1
+ class SplitPricesFromVariants < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  create_table :spree_prices do |t|
4
4
  t.integer :variant_id, null: false
@@ -1,4 +1,4 @@
1
- class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration
1
+ class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  change_column :spree_prices, :amount, :decimal, precision: 8, scale: 2, null: true
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddCurrencyToLineItems < ActiveRecord::Migration
1
+ class AddCurrencyToLineItems < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_line_items, :currency, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddCurrencyToOrders < ActiveRecord::Migration
1
+ class AddCurrencyToOrders < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_orders, :currency, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddCostCurrencyToVariants < ActiveRecord::Migration
1
+ class AddCostCurrencyToVariants < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_variants, :cost_currency, :string, after: :cost_price
4
4
  end
@@ -1,4 +1,4 @@
1
- class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration
1
+ class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  remove_column :spree_payment_methods, :display_on
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddPositionToTaxonomies < ActiveRecord::Migration
1
+ class AddPositionToTaxonomies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_taxonomies, :position, :integer, default: 0
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddLastIpToSpreeOrders < ActiveRecord::Migration
1
+ class AddLastIpToSpreeOrders < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_orders, :last_ip_address, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddStateToSpreeAdjustments < ActiveRecord::Migration
1
+ class AddStateToSpreeAdjustments < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_adjustments, :state, :string
4
4
  remove_column :spree_adjustments, :locked
@@ -1,4 +1,4 @@
1
- class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration
1
+ class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_column :spree_payment_methods, :display_on, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddPositionToProductProperties < ActiveRecord::Migration
1
+ class AddPositionToProductProperties < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_product_properties, :position, :integer, default: 0
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddIdentifierToSpreePayments < ActiveRecord::Migration
1
+ class AddIdentifierToSpreePayments < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_payments, :identifier, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddOrderIdIndexToPayments < ActiveRecord::Migration
1
+ class AddOrderIdIndexToPayments < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_index :spree_payments, :order_id
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration
1
+ class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_products_taxons, :id, :primary_key
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateSpreeStockItems < ActiveRecord::Migration
1
+ class CreateSpreeStockItems < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spree_stock_items do |t|
4
4
  t.belongs_to :stock_location
@@ -1,4 +1,4 @@
1
- class CreateSpreeStockLocations < ActiveRecord::Migration
1
+ class CreateSpreeStockLocations < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spree_stock_locations do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class CreateDefaultStock < ActiveRecord::Migration
1
+ class CreateDefaultStock < ActiveRecord::Migration[4.2]
2
2
  class Variant < ActiveRecord::Base
3
3
  self.table_name = 'spree_variants'
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddOrderIdIndexToShipments < ActiveRecord::Migration
1
+ class AddOrderIdIndexToShipments < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_index :spree_shipments, :order_id
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration
1
+ class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_column :spree_products, :meta_description, :text, limit: nil
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddStockLocationIdToSpreeShipments < ActiveRecord::Migration
1
+ class AddStockLocationIdToSpreeShipments < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_shipments, :stock_location_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddPendingToInventoryUnit < ActiveRecord::Migration
1
+ class AddPendingToInventoryUnit < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_inventory_units, :pending, :boolean, default: true
4
4
  Spree::InventoryUnit.update_all(pending: false)
@@ -1,4 +1,4 @@
1
- class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration
1
+ class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  remove_column :spree_products, :on_demand
4
4
  remove_column :spree_variants, :on_demand