solidus_core 4.6.2 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +13 -13
  3. data/app/controllers/spree/base_controller.rb +2 -2
  4. data/app/helpers/spree/base_helper.rb +24 -24
  5. data/app/helpers/spree/checkout_helper.rb +7 -7
  6. data/app/helpers/spree/core/controller_helpers/auth.rb +1 -1
  7. data/app/helpers/spree/core/controller_helpers/common.rb +3 -2
  8. data/app/helpers/spree/core/controller_helpers/order.rb +3 -5
  9. data/app/helpers/spree/core/controller_helpers/payment_parameters.rb +1 -2
  10. data/app/helpers/spree/core/controller_helpers/strong_parameters.rb +10 -10
  11. data/app/helpers/spree/products_helper.rb +5 -5
  12. data/app/helpers/spree/store_helper.rb +1 -1
  13. data/app/mailers/spree/carton_mailer.rb +3 -3
  14. data/app/mailers/spree/order_mailer.rb +4 -4
  15. data/app/mailers/spree/reimbursement_mailer.rb +2 -2
  16. data/app/models/concerns/spree/active_storage_adapter/attachment.rb +5 -5
  17. data/app/models/concerns/spree/active_storage_adapter/normalization.rb +5 -5
  18. data/app/models/concerns/spree/active_storage_adapter.rb +2 -2
  19. data/app/models/concerns/spree/adjustment_source.rb +4 -4
  20. data/app/models/concerns/spree/display_money.rb +2 -2
  21. data/app/models/concerns/spree/named_type.rb +1 -1
  22. data/app/models/concerns/spree/ordered_property_value_list.rb +2 -2
  23. data/app/models/concerns/spree/preferences/persistable.rb +1 -1
  24. data/app/models/concerns/spree/ransackable_attributes.rb +1 -0
  25. data/app/models/concerns/spree/soft_deletable.rb +2 -1
  26. data/app/models/concerns/spree/state_change_tracking.rb +1 -1
  27. data/app/models/concerns/spree/user_address_book.rb +12 -12
  28. data/app/models/concerns/spree/user_methods.rb +9 -9
  29. data/app/models/concerns/spree/user_reporting.rb +1 -0
  30. data/app/models/spree/ability.rb +1 -1
  31. data/app/models/spree/address/name.rb +1 -1
  32. data/app/models/spree/address.rb +7 -7
  33. data/app/models/spree/adjustment.rb +11 -10
  34. data/app/models/spree/adjustment_reason.rb +2 -2
  35. data/app/models/spree/billing_integration.rb +2 -2
  36. data/app/models/spree/calculator/default_tax.rb +2 -2
  37. data/app/models/spree/calculator/flat_fee.rb +1 -1
  38. data/app/models/spree/calculator/flat_rate.rb +2 -2
  39. data/app/models/spree/calculator/returns/default_refund_amount.rb +3 -3
  40. data/app/models/spree/calculator/shipping/flat_percent_item_total.rb +2 -2
  41. data/app/models/spree/calculator/shipping/flat_rate.rb +3 -3
  42. data/app/models/spree/calculator/shipping/flexi_rate.rb +8 -8
  43. data/app/models/spree/calculator/shipping/per_item.rb +3 -3
  44. data/app/models/spree/calculator/shipping/price_sack.rb +3 -3
  45. data/app/models/spree/calculator.rb +31 -6
  46. data/app/models/spree/carton.rb +4 -4
  47. data/app/models/spree/classification.rb +2 -2
  48. data/app/models/spree/core/state_machines/order/class_methods.rb +3 -3
  49. data/app/models/spree/core/state_machines/return_item/acceptance_status.rb +1 -1
  50. data/app/models/spree/country.rb +1 -1
  51. data/app/models/spree/credit_card.rb +27 -27
  52. data/app/models/spree/customer_return.rb +5 -4
  53. data/app/models/spree/distributed_amounts_handler.rb +1 -1
  54. data/app/models/spree/fulfilment_changer.rb +22 -22
  55. data/app/models/spree/image/active_storage_attachment.rb +2 -2
  56. data/app/models/spree/image/paperclip_attachment.rb +8 -8
  57. data/app/models/spree/in_memory_order_updater.rb +262 -0
  58. data/app/models/spree/inventory_unit.rb +11 -11
  59. data/app/models/spree/item_total.rb +1 -1
  60. data/app/models/spree/legacy_user.rb +2 -2
  61. data/app/models/spree/line_item.rb +21 -11
  62. data/app/models/spree/log_entry.rb +3 -3
  63. data/app/models/spree/mergeable_orders_finder.rb +44 -0
  64. data/app/models/spree/money.rb +2 -1
  65. data/app/models/spree/null_promotion_adjuster.rb +1 -1
  66. data/app/models/spree/option_type.rb +1 -1
  67. data/app/models/spree/option_value.rb +2 -2
  68. data/app/models/spree/order/number_generator.rb +1 -1
  69. data/app/models/spree/order.rb +66 -64
  70. data/app/models/spree/order_cancellations.rb +1 -3
  71. data/app/models/spree/order_inventory.rb +5 -8
  72. data/app/models/spree/order_mutex.rb +1 -1
  73. data/app/models/spree/order_shipping.rb +1 -1
  74. data/app/models/spree/order_updater.rb +59 -37
  75. data/app/models/spree/payment/cancellation.rb +2 -2
  76. data/app/models/spree/payment/processing.rb +22 -22
  77. data/app/models/spree/payment.rb +25 -25
  78. data/app/models/spree/payment_capture_event.rb +2 -2
  79. data/app/models/spree/payment_create.rb +1 -1
  80. data/app/models/spree/payment_method/bogus_credit_card.rb +18 -18
  81. data/app/models/spree/payment_method/check.rb +3 -3
  82. data/app/models/spree/payment_method/credit_card.rb +1 -1
  83. data/app/models/spree/payment_method/simple_bogus_credit_card.rb +3 -3
  84. data/app/models/spree/payment_method/store_credit.rb +13 -13
  85. data/app/models/spree/payment_method.rb +12 -11
  86. data/app/models/spree/payment_source.rb +2 -2
  87. data/app/models/spree/permission_sets/dashboard_display.rb +3 -3
  88. data/app/models/spree/permission_sets/default_customer.rb +1 -1
  89. data/app/models/spree/preference.rb +1 -1
  90. data/app/models/spree/price.rb +7 -6
  91. data/app/models/spree/product/scopes.rb +23 -23
  92. data/app/models/spree/product.rb +37 -41
  93. data/app/models/spree/product_option_type.rb +2 -2
  94. data/app/models/spree/product_property.rb +3 -3
  95. data/app/models/spree/refund.rb +10 -10
  96. data/app/models/spree/refund_reason.rb +2 -2
  97. data/app/models/spree/reimbursement/credit.rb +1 -1
  98. data/app/models/spree/reimbursement.rb +8 -8
  99. data/app/models/spree/reimbursement_tax_calculator.rb +1 -1
  100. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -1
  101. data/app/models/spree/reimbursement_type.rb +2 -2
  102. data/app/models/spree/return_authorization.rb +7 -6
  103. data/app/models/spree/return_item/eligibility_validator/base_validator.rb +2 -2
  104. data/app/models/spree/return_item/eligibility_validator/default.rb +1 -1
  105. data/app/models/spree/return_item/eligibility_validator/inventory_shipped.rb +1 -1
  106. data/app/models/spree/return_item/eligibility_validator/no_reimbursements.rb +1 -1
  107. data/app/models/spree/return_item/eligibility_validator/order_completed.rb +1 -1
  108. data/app/models/spree/return_item/eligibility_validator/rma_required.rb +1 -1
  109. data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +1 -1
  110. data/app/models/spree/return_item/exchange_variant_eligibility/same_option_value.rb +6 -6
  111. data/app/models/spree/return_item.rb +31 -30
  112. data/app/models/spree/return_reason.rb +1 -1
  113. data/app/models/spree/role.rb +1 -1
  114. data/app/models/spree/role_user.rb +1 -1
  115. data/app/models/spree/shipment.rb +37 -29
  116. data/app/models/spree/shipping_method.rb +9 -9
  117. data/app/models/spree/shipping_method_category.rb +2 -2
  118. data/app/models/spree/shipping_rate.rb +12 -10
  119. data/app/models/spree/shipping_rate_tax.rb +5 -4
  120. data/app/models/spree/simple_order_contents.rb +2 -2
  121. data/app/models/spree/state.rb +1 -1
  122. data/app/models/spree/stock/availability.rb +9 -9
  123. data/app/models/spree/stock/availability_validator.rb +3 -3
  124. data/app/models/spree/stock/differentiator.rb +2 -2
  125. data/app/models/spree/stock/estimator.rb +4 -4
  126. data/app/models/spree/stock/inventory_validator.rb +1 -1
  127. data/app/models/spree/stock/package.rb +3 -3
  128. data/app/models/spree/stock_item.rb +5 -5
  129. data/app/models/spree/stock_location.rb +6 -6
  130. data/app/models/spree/stock_movement.rb +2 -2
  131. data/app/models/spree/stock_quantities.rb +2 -2
  132. data/app/models/spree/store.rb +3 -3
  133. data/app/models/spree/store_credit.rb +30 -29
  134. data/app/models/spree/store_credit_category.rb +2 -2
  135. data/app/models/spree/store_credit_event.rb +6 -6
  136. data/app/models/spree/store_credit_reason.rb +1 -1
  137. data/app/models/spree/store_credit_type.rb +3 -3
  138. data/app/models/spree/store_selector/by_server_name.rb +1 -1
  139. data/app/models/spree/store_selector/legacy.rb +1 -1
  140. data/app/models/spree/tax/item_tax.rb +1 -0
  141. data/app/models/spree/tax/order_tax.rb +1 -0
  142. data/app/models/spree/tax_category.rb +3 -3
  143. data/app/models/spree/tax_rate.rb +5 -5
  144. data/app/models/spree/tax_rate_tax_category.rb +2 -2
  145. data/app/models/spree/taxon/active_storage_attachment.rb +2 -2
  146. data/app/models/spree/taxon/paperclip_attachment.rb +4 -4
  147. data/app/models/spree/taxon.rb +16 -17
  148. data/app/models/spree/taxon_brand_selector.rb +3 -3
  149. data/app/models/spree/unauthorized_redirect_handler.rb +1 -1
  150. data/app/models/spree/unit_cancel.rb +4 -4
  151. data/app/models/spree/user_address.rb +3 -3
  152. data/app/models/spree/user_last_url_storer/rules/authentication_rule.rb +6 -8
  153. data/app/models/spree/user_last_url_storer.rb +1 -1
  154. data/app/models/spree/variant/price_selector.rb +1 -1
  155. data/app/models/spree/variant/scopes.rb +9 -9
  156. data/app/models/spree/variant.rb +25 -25
  157. data/app/models/spree/variant_property_rule.rb +2 -2
  158. data/app/models/spree/variant_property_rule_condition.rb +1 -1
  159. data/app/models/spree/wallet/add_payment_sources_to_wallet.rb +4 -4
  160. data/app/models/spree/wallet/default_payment_builder.rb +1 -1
  161. data/app/models/spree/wallet_payment_source.rb +2 -2
  162. data/app/models/spree/zone.rb +18 -18
  163. data/app/models/spree/zone_member.rb +1 -1
  164. data/app/subscribers/spree/carton_shipped_mailer_subscriber.rb +2 -2
  165. data/app/subscribers/spree/order_cancel_mailer_subscriber.rb +2 -2
  166. data/app/subscribers/spree/order_confirmation_mailer_subscriber.rb +2 -2
  167. data/app/subscribers/spree/order_inventory_cancellation_mailer_subscriber.rb +2 -2
  168. data/app/subscribers/spree/reimbursement_mailer_subscriber.rb +2 -2
  169. data/config/initializers/assets.rb +1 -1
  170. data/config/initializers/db_query_matchers.rb +9 -0
  171. data/config/initializers/friendly_id.rb +2 -2
  172. data/config/initializers/inflections.rb +1 -1
  173. data/config/initializers/money.rb +1 -1
  174. data/config/locales/en.yml +1 -0
  175. data/db/default/spree/countries.rb +7 -7
  176. data/db/default/spree/return_reasons.rb +11 -11
  177. data/db/default/spree/stock_locations.rb +1 -1
  178. data/db/default/spree/store_credit.rb +3 -4
  179. data/db/default/spree/stores.rb +1 -1
  180. data/db/default/spree/zones.rb +5 -5
  181. data/db/migrate/20160101010000_solidus_one_four.rb +16 -16
  182. data/db/migrate/20160420044191_create_spree_wallet_payment_sources.rb +3 -3
  183. data/db/migrate/20160420181916_migrate_credit_cards_to_wallet_payment_sources.rb +7 -6
  184. data/db/migrate/20161014221052_add_available_to_columns_and_remove_display_on_from_payment_methods.rb +10 -10
  185. data/db/migrate/20161123154034_add_available_to_users_and_remove_display_on_from_shipping_methods.rb +6 -6
  186. data/db/migrate/20161129035810_add_index_to_spree_payments_number.rb +1 -1
  187. data/db/migrate/20170319191942_remove_order_id_from_inventory_units.rb +4 -4
  188. data/db/migrate/20180322142651_add_amount_remaining_to_store_credit_events.rb +9 -16
  189. data/db/migrate/20200320144521_add_default_billng_flag_to_user_addresses.rb +1 -0
  190. data/db/migrate/20210815004823_add_unique_index_to_option_values_variants.rb +3 -3
  191. data/db/migrate/20250207104016_add_primary_taxon_to_products.rb +1 -1
  192. data/db/migrate/20250214094207_add_reverse_charge_status_to_store.rb +1 -1
  193. data/db/migrate/20250225051308_add_vat_id_email_and_reverse_charge_status_to_addresses.rb +1 -1
  194. data/db/seeds.rb +3 -3
  195. data/lib/generators/solidus/install/app_templates/authentication/custom.rb +2 -2
  196. data/lib/generators/solidus/install/app_templates/authentication/devise.rb +3 -3
  197. data/lib/generators/solidus/install/app_templates/authentication/existing.rb +1 -1
  198. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
  199. data/lib/generators/solidus/install/app_templates/payment_method/braintree.rb +1 -1
  200. data/lib/generators/solidus/install/app_templates/payment_method/paypal.rb +1 -1
  201. data/lib/generators/solidus/install/app_templates/payment_method/stripe.rb +2 -2
  202. data/lib/generators/solidus/install/install_generator.rb +51 -51
  203. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -0
  204. data/lib/generators/solidus/update/update_generator.rb +29 -29
  205. data/lib/generators/spree/custom_user/custom_user_generator.rb +6 -6
  206. data/lib/generators/spree/dummy/dummy_generator.rb +22 -24
  207. data/lib/generators/spree/dummy/templates/rails/boot.rb +3 -3
  208. data/lib/generators/spree/dummy/templates/rails/test.rb +4 -4
  209. data/lib/solidus_core.rb +1 -1
  210. data/lib/spree/app_configuration.rb +59 -47
  211. data/lib/spree/bus.rb +1 -1
  212. data/lib/spree/config.rb +1 -1
  213. data/lib/spree/core/active_merchant_dependencies.rb +8 -8
  214. data/lib/spree/core/class_constantizer.rb +1 -1
  215. data/lib/spree/core/engine.rb +15 -15
  216. data/lib/spree/core/environment.rb +1 -1
  217. data/lib/spree/core/environment_extension.rb +2 -2
  218. data/lib/spree/core/importer/order.rb +15 -15
  219. data/lib/spree/core/importer/product.rb +4 -4
  220. data/lib/spree/core/importer.rb +2 -2
  221. data/lib/spree/core/null_promotion_configuration.rb +7 -7
  222. data/lib/spree/core/permalinks.rb +1 -1
  223. data/lib/spree/core/product_filters.rb +94 -93
  224. data/lib/spree/core/role_configuration.rb +3 -3
  225. data/lib/spree/core/search/base.rb +5 -6
  226. data/lib/spree/core/search/variant.rb +3 -3
  227. data/lib/spree/core/stock_configuration.rb +10 -49
  228. data/lib/spree/core/validators/email.rb +1 -1
  229. data/lib/spree/core/version.rb +3 -3
  230. data/lib/spree/core/versioned_value.rb +4 -6
  231. data/lib/spree/core.rb +49 -49
  232. data/lib/spree/deprecated_instance_variable_proxy.rb +1 -1
  233. data/lib/spree/deprecation.rb +1 -1
  234. data/lib/spree/deprecator.rb +2 -2
  235. data/lib/spree/i18n.rb +2 -2
  236. data/lib/spree/localized_number.rb +3 -3
  237. data/lib/spree/manipulative_query_monitor.rb +19 -0
  238. data/lib/spree/migrations.rb +2 -2
  239. data/lib/spree/permitted_attributes.rb +10 -10
  240. data/lib/spree/preferences/configuration.rb +5 -5
  241. data/lib/spree/preferences/preferable.rb +8 -10
  242. data/lib/spree/preferences/preferable_class_methods.rb +16 -16
  243. data/lib/spree/preferences/preference_differentiator.rb +1 -1
  244. data/lib/spree/preferences/scoped_store.rb +2 -2
  245. data/lib/spree/preferences/static_model_preferences.rb +2 -2
  246. data/lib/spree/preferences/store.rb +6 -6
  247. data/lib/spree/testing_support/ability_helpers.rb +30 -30
  248. data/lib/spree/testing_support/authorization_helpers.rb +6 -5
  249. data/lib/spree/testing_support/blacklist_urls.rb +1 -1
  250. data/lib/spree/testing_support/bus_helpers.rb +1 -1
  251. data/lib/spree/testing_support/capybara_driver.rb +1 -1
  252. data/lib/spree/testing_support/capybara_ext.rb +12 -12
  253. data/lib/spree/testing_support/common_rake.rb +17 -16
  254. data/lib/spree/testing_support/dummy_ability.rb +1 -1
  255. data/lib/spree/testing_support/dummy_app/migrations.rb +1 -1
  256. data/lib/spree/testing_support/dummy_app/rake_tasks.rb +5 -5
  257. data/lib/spree/testing_support/dummy_app/routes.rb +1 -1
  258. data/lib/spree/testing_support/dummy_app.rb +34 -34
  259. data/lib/spree/testing_support/extension_rake.rb +2 -2
  260. data/lib/spree/testing_support/factories/address_factory.rb +12 -12
  261. data/lib/spree/testing_support/factories/adjustment_factory.rb +7 -7
  262. data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +1 -1
  263. data/lib/spree/testing_support/factories/calculator_factory.rb +6 -6
  264. data/lib/spree/testing_support/factories/carton_factory.rb +1 -1
  265. data/lib/spree/testing_support/factories/country_factory.rb +3 -3
  266. data/lib/spree/testing_support/factories/credit_card_factory.rb +3 -3
  267. data/lib/spree/testing_support/factories/customer_return_factory.rb +2 -2
  268. data/lib/spree/testing_support/factories/image_factory.rb +2 -2
  269. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +4 -4
  270. data/lib/spree/testing_support/factories/line_item_factory.rb +2 -2
  271. data/lib/spree/testing_support/factories/option_type_factory.rb +2 -2
  272. data/lib/spree/testing_support/factories/option_value_factory.rb +2 -2
  273. data/lib/spree/testing_support/factories/order_factory.rb +16 -16
  274. data/lib/spree/testing_support/factories/payment_factory.rb +9 -9
  275. data/lib/spree/testing_support/factories/payment_method_factory.rb +10 -10
  276. data/lib/spree/testing_support/factories/price_factory.rb +2 -2
  277. data/lib/spree/testing_support/factories/product_factory.rb +2 -2
  278. data/lib/spree/testing_support/factories/product_option_type_factory.rb +1 -1
  279. data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
  280. data/lib/spree/testing_support/factories/property_factory.rb +3 -3
  281. data/lib/spree/testing_support/factories/refund_factory.rb +2 -2
  282. data/lib/spree/testing_support/factories/refund_reason_factory.rb +1 -1
  283. data/lib/spree/testing_support/factories/reimbursement_factory.rb +1 -1
  284. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +1 -1
  285. data/lib/spree/testing_support/factories/return_authorization_factory.rb +3 -3
  286. data/lib/spree/testing_support/factories/return_item_factory.rb +1 -1
  287. data/lib/spree/testing_support/factories/return_reason_factory.rb +1 -1
  288. data/lib/spree/testing_support/factories/role_factory.rb +2 -2
  289. data/lib/spree/testing_support/factories/shipment_factory.rb +3 -3
  290. data/lib/spree/testing_support/factories/shipping_category_factory.rb +1 -1
  291. data/lib/spree/testing_support/factories/shipping_method_factory.rb +7 -7
  292. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +1 -1
  293. data/lib/spree/testing_support/factories/state_factory.rb +4 -4
  294. data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
  295. data/lib/spree/testing_support/factories/stock_location_factory.rb +7 -7
  296. data/lib/spree/testing_support/factories/stock_movement_factory.rb +3 -3
  297. data/lib/spree/testing_support/factories/stock_package_factory.rb +3 -3
  298. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +1 -1
  299. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +8 -8
  300. data/lib/spree/testing_support/factories/store_credit_factory.rb +1 -1
  301. data/lib/spree/testing_support/factories/store_credit_reason_factory.rb +1 -1
  302. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +6 -6
  303. data/lib/spree/testing_support/factories/store_factory.rb +2 -2
  304. data/lib/spree/testing_support/factories/tax_category_factory.rb +1 -1
  305. data/lib/spree/testing_support/factories/tax_rate_factory.rb +1 -1
  306. data/lib/spree/testing_support/factories/taxon_factory.rb +3 -3
  307. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  308. data/lib/spree/testing_support/factories/user_factory.rb +2 -2
  309. data/lib/spree/testing_support/factories/variant_factory.rb +2 -2
  310. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +1 -1
  311. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +1 -1
  312. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +1 -1
  313. data/lib/spree/testing_support/factories/zone_factory.rb +3 -3
  314. data/lib/spree/testing_support/factory_bot.rb +1 -1
  315. data/lib/spree/testing_support/flaky.rb +3 -2
  316. data/lib/spree/testing_support/flash.rb +2 -2
  317. data/lib/spree/testing_support/order_walkthrough.rb +7 -7
  318. data/lib/spree/testing_support/preferences.rb +1 -1
  319. data/lib/spree/testing_support/rake.rb +1 -1
  320. data/lib/spree/testing_support/shared_examples/calculator.rb +1 -1
  321. data/lib/spree/testing_support/shared_examples/gallery.rb +7 -7
  322. data/lib/spree/testing_support/shared_examples/order_factory.rb +9 -9
  323. data/lib/spree/testing_support/shared_examples/working_factory.rb +1 -1
  324. data/lib/spree/testing_support/translations.rb +1 -1
  325. data/lib/spree_core.rb +1 -1
  326. data/lib/tasks/payment_method.rake +2 -2
  327. data/solidus_core.gemspec +49 -49
  328. metadata +60 -54
@@ -19,14 +19,15 @@
19
19
  #
20
20
  require "spree/core/search/base"
21
21
  require "spree/core/search/variant"
22
- require 'spree/preferences/configuration'
23
- require 'spree/core/environment'
22
+ require "spree/preferences/configuration"
23
+ require "spree/core/environment"
24
24
 
25
- require 'uri'
25
+ require "uri"
26
26
 
27
27
  module Spree
28
28
  class AppConfiguration < Preferences::Configuration
29
29
  include Spree::Core::EnvironmentExtension
30
+
30
31
  # Preferences (alphabetized to more easily lookup particular preferences)
31
32
 
32
33
  # @!attribute [rw] address_requires_phone
@@ -39,7 +40,7 @@ module Spree
39
40
 
40
41
  # @!attribute [rw] admin_interface_logo
41
42
  # @return [String] URL of logo used in admin (default: +'logo/solidus.svg'+)
42
- preference :admin_interface_logo, :string, default: 'logo/solidus.svg'
43
+ preference :admin_interface_logo, :string, default: "logo/solidus.svg"
43
44
 
44
45
  # @!attribute [rw] admin_products_per_page
45
46
  # @return [Integer] Number of products to display in admin (default: +10+)
@@ -146,7 +147,7 @@ module Spree
146
147
  # @!attribute [rw] default_country_iso
147
148
  # Default customer country ISO code
148
149
  # @return [String] Two-letter ISO code of a {Spree::Country} to assumed as the country of an unidentified customer (default: "US")
149
- preference :default_country_iso, :string, default: 'US'
150
+ preference :default_country_iso, :string, default: "US"
150
151
 
151
152
  # @!attribute [rw] default_email_regexp
152
153
  # @return [Regexp] Regex to be used in email validations, for example in Spree::EmailValidator
@@ -166,7 +167,7 @@ module Spree
166
167
 
167
168
  # @!attribute [rw] layout
168
169
  # @return [String] template to use for layout on the frontend (default: +"spree/layouts/spree_application"+)
169
- preference :layout, :string, default: 'spree/layouts/spree_application'
170
+ preference :layout, :string, default: "spree/layouts/spree_application"
170
171
 
171
172
  # !@attribute [rw] line_item_comparison_hooks
172
173
  # @return [Array<Symbol>] An array of methods to call on {Spree::Order} to determine if a line item is equal to another
@@ -177,7 +178,7 @@ module Spree
177
178
 
178
179
  # @!attribute [rw] logo
179
180
  # @return [String] URL of logo used on frontend (default: +'logo/solidus.svg'+)
180
- preference :logo, :string, default: 'logo/solidus.svg'
181
+ preference :logo, :string, default: "logo/solidus.svg"
181
182
 
182
183
  # @!attribute [rw] log_entry_permitted_classes
183
184
  # @return [Array<String>] An array of extra classes that are allowed to be
@@ -245,6 +246,10 @@ module Spree
245
246
  # @return [Integer] Products to show per-page in the frontend (default: +12+)
246
247
  preference :products_per_page, :integer, default: 12
247
248
 
249
+ # @!attribute [rw] recalculate_cart_prices
250
+ # @return [Boolean] Whether to recalculate cart prices when recalculating (default: +false+)
251
+ versioned_preference :recalculate_cart_prices, :boolean, initial_value: false, boundaries: {"5.0.0.alpha" => true}
252
+
248
253
  # @!attribute [rw] require_master_price
249
254
  # @return [Boolean] Require a price on the master variant of a product (default: +true+)
250
255
  preference :require_master_price, :boolean, default: true
@@ -261,7 +266,7 @@ module Spree
261
266
  # @return [Array] An array of roles where generating an api key for a user
262
267
  # at role_user creation is desired when user has one of these roles.
263
268
  # (default: +['admin']+)
264
- preference :roles_for_auto_api_key, :array, default: ['admin']
269
+ preference :roles_for_auto_api_key, :array, default: ["admin"]
265
270
 
266
271
  # @!attribute [rw] countries_that_use_nested_subregions
267
272
  # @return [Array] An array of countries that use nested subregions, instead
@@ -269,7 +274,7 @@ module Spree
269
274
  # to ensure the correct states are generated, and when running the states
270
275
  # regenerate rake task.
271
276
  # (default: +['IT']+)
272
- preference :countries_that_use_nested_subregions, :array, default: ['IT']
277
+ preference :countries_that_use_nested_subregions, :array, default: ["IT"]
273
278
 
274
279
  # @!attribute [rw] send_core_emails
275
280
  # @return [Boolean] Whether to send transactional emails (default: true)
@@ -318,14 +323,14 @@ module Spree
318
323
  end
319
324
 
320
325
  # searcher_class allows spree extension writers to provide their own Search class
321
- class_name_attribute :searcher_class, default: 'Spree::Core::Search::Base'
326
+ class_name_attribute :searcher_class, default: "Spree::Core::Search::Base"
322
327
 
323
328
  # Allows implementing custom pricing for variants
324
329
  # @!attribute [rw] variant_price_selector_class
325
330
  # @see Spree::Variant::PriceSelector
326
331
  # @return [Class] an object that conforms to the API of
327
332
  # the standard variant price selector class Spree::Variant::PriceSelector.
328
- class_name_attribute :variant_price_selector_class, default: 'Spree::Variant::PriceSelector'
333
+ class_name_attribute :variant_price_selector_class, default: "Spree::Variant::PriceSelector"
329
334
 
330
335
  # Shortcut for getting the variant price selector's pricing options class
331
336
  #
@@ -339,7 +344,7 @@ module Spree
339
344
  pricing_options_class.new
340
345
  end
341
346
 
342
- class_name_attribute :variant_search_class, default: 'Spree::Core::Search::Variant'
347
+ class_name_attribute :variant_search_class, default: "Spree::Core::Search::Variant"
343
348
 
344
349
  # Allows implementing custom vat prices generation
345
350
  # @!attribute [rw] variant_vat_prices_generator_class
@@ -347,20 +352,20 @@ module Spree
347
352
  # @return [Class] an object that conforms to the API of
348
353
  # the standard variant vat prices generator class
349
354
  # Spree::Variant::VatPriceGenerator.
350
- class_name_attribute :variant_vat_prices_generator_class, default: 'Spree::Variant::VatPriceGenerator'
355
+ class_name_attribute :variant_vat_prices_generator_class, default: "Spree::Variant::VatPriceGenerator"
351
356
 
352
- class_name_attribute :allocator_class, default: 'Spree::Stock::Allocator::OnHandFirst'
357
+ class_name_attribute :allocator_class, default: "Spree::Stock::Allocator::OnHandFirst"
353
358
 
354
- class_name_attribute :shipping_rate_sorter_class, default: 'Spree::Stock::ShippingRateSorter'
359
+ class_name_attribute :shipping_rate_sorter_class, default: "Spree::Stock::ShippingRateSorter"
355
360
 
356
- class_name_attribute :shipping_rate_selector_class, default: 'Spree::Stock::ShippingRateSelector'
361
+ class_name_attribute :shipping_rate_selector_class, default: "Spree::Stock::ShippingRateSelector"
357
362
 
358
363
  # Allows providing your own class for calculating taxes on a shipping rate.
359
364
  #
360
365
  # @!attribute [rw] shipping_rate_tax_calculator_class
361
366
  # @return [Class] a class with the same public interfaces as
362
367
  # Spree::TaxCalculator::ShippingRate
363
- class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'
368
+ class_name_attribute :shipping_rate_tax_calculator_class, default: "Spree::TaxCalculator::ShippingRate"
364
369
 
365
370
  # Allows providing your own Mailer for order mailer.
366
371
  #
@@ -369,14 +374,14 @@ module Spree
369
374
  # "cancel_email" and "inventory_cancellation_email"
370
375
  # (e.g. an ActionMailer with a "confirm_email" method) with the same
371
376
  # signature as Spree::OrderMailer.confirm_email.
372
- class_name_attribute :order_mailer_class, default: 'Spree::OrderMailer'
377
+ class_name_attribute :order_mailer_class, default: "Spree::OrderMailer"
373
378
 
374
379
  # Allows providing your own order update attributes class for checkout.
375
380
  #
376
381
  # @!attribute [rw] order_update_attributes_class
377
382
  # @return [Class] a class that responds to "call"
378
383
  # with the same signature as Spree::OrderUpdateAttributes.
379
- class_name_attribute :order_update_attributes_class, default: 'Spree::OrderUpdateAttributes'
384
+ class_name_attribute :order_update_attributes_class, default: "Spree::OrderUpdateAttributes"
380
385
 
381
386
  # Allows providing a different order recalculator.
382
387
  # @!attribute [rw] order_recalculator_class
@@ -384,7 +389,7 @@ module Spree
384
389
  # @return [Class] an object that conforms to the API of
385
390
  # the standard order recalculator class
386
391
  # Spree::OrderUpdater.
387
- class_name_attribute :order_recalculator_class, default: 'Spree::OrderUpdater'
392
+ class_name_attribute :order_recalculator_class, default: "Spree::OrderUpdater"
388
393
 
389
394
  # Allows providing your own Mailer for reimbursement mailer.
390
395
  #
@@ -392,7 +397,7 @@ module Spree
392
397
  # @return [ActionMailer::Base] an object that responds to "reimbursement_email"
393
398
  # (e.g. an ActionMailer with a "reimbursement_email" method) with the same
394
399
  # signature as Spree::ReimbursementMailer.reimbursement_email.
395
- class_name_attribute :reimbursement_mailer_class, default: 'Spree::ReimbursementMailer'
400
+ class_name_attribute :reimbursement_mailer_class, default: "Spree::ReimbursementMailer"
396
401
 
397
402
  # Allows providing your own Mailer for shipped cartons.
398
403
  #
@@ -400,14 +405,21 @@ module Spree
400
405
  # @return [ActionMailer::Base] an object that responds to "shipped_email"
401
406
  # (e.g. an ActionMailer with a "shipped_email" method) with the same
402
407
  # signature as Spree::CartonMailer.shipped_email.
403
- class_name_attribute :carton_shipped_email_class, default: 'Spree::CartonMailer'
408
+ class_name_attribute :carton_shipped_email_class, default: "Spree::CartonMailer"
404
409
 
405
410
  # Allows providing your own class for merging two orders.
406
411
  #
407
412
  # @!attribute [rw] order_merger_class
408
413
  # @return [Class] a class with the same public interfaces
409
414
  # as Spree::OrderMerger.
410
- class_name_attribute :order_merger_class, default: 'Spree::OrderMerger'
415
+ class_name_attribute :order_merger_class, default: "Spree::OrderMerger"
416
+
417
+ # Allows providing your own class for selecting which orders to merge.
418
+ #
419
+ # @!attribute [rw] mergeable_orders_finder_class
420
+ # @return [Class] a class with the same public interfaces as
421
+ # Spree::MergeableOrdersFinder.
422
+ class_name_attribute :mergeable_orders_finder_class, default: "Spree::MergeableOrdersFinder"
411
423
 
412
424
  # Allows providing your own class for adding default payments to a user's
413
425
  # order from their "wallet".
@@ -415,21 +427,21 @@ module Spree
415
427
  # @!attribute [rw] default_payment_builder_class
416
428
  # @return [Class] a class with the same public interfaces as
417
429
  # Spree::Wallet::DefaultPaymentBuilder.
418
- class_name_attribute :default_payment_builder_class, default: 'Spree::Wallet::DefaultPaymentBuilder'
430
+ class_name_attribute :default_payment_builder_class, default: "Spree::Wallet::DefaultPaymentBuilder"
419
431
 
420
432
  # Allows providing your own class for managing the contents of an order.
421
433
  #
422
434
  # @!attribute [rw] order_contents_class
423
435
  # @return [Class] a class with the same public interfaces as
424
436
  # Spree::OrderContents.
425
- class_name_attribute :order_contents_class, default: 'Spree::SimpleOrderContents'
437
+ class_name_attribute :order_contents_class, default: "Spree::SimpleOrderContents"
426
438
 
427
439
  # Allows providing your own class for shipping an order.
428
440
  #
429
441
  # @!attribute [rw] order_shipping_class
430
442
  # @return [Class] a class with the same public interfaces as
431
443
  # Spree::OrderShipping.
432
- class_name_attribute :order_shipping_class, default: 'Spree::OrderShipping'
444
+ class_name_attribute :order_shipping_class, default: "Spree::OrderShipping"
433
445
 
434
446
  # Allows providing your own class for managing the inventory units of a
435
447
  # completed order.
@@ -437,7 +449,7 @@ module Spree
437
449
  # @!attribute [rw] order_cancellations_class
438
450
  # @return [Class] a class with the same public interfaces as
439
451
  # Spree::OrderCancellations.
440
- class_name_attribute :order_cancellations_class, default: 'Spree::OrderCancellations'
452
+ class_name_attribute :order_cancellations_class, default: "Spree::OrderCancellations"
441
453
 
442
454
  # Allows providing your own class for canceling payments.
443
455
  #
@@ -456,14 +468,14 @@ module Spree
456
468
  # @!attribute [rw] add_payment_sources_to_wallet_class
457
469
  # @return [Class] a class with the same public interfaces
458
470
  # as Spree::Wallet::AddPaymentSourcesToWallet.
459
- class_name_attribute :add_payment_sources_to_wallet_class, default: 'Spree::Wallet::AddPaymentSourcesToWallet'
471
+ class_name_attribute :add_payment_sources_to_wallet_class, default: "Spree::Wallet::AddPaymentSourcesToWallet"
460
472
 
461
473
  # Allows providing your own class for recalculating totals on an item.
462
474
  #
463
475
  # @!attribute [rw] item_total_class
464
476
  # @return [Class] a class with the same public interfaces as
465
477
  # Spree::ItemTotal
466
- class_name_attribute :item_total_class, default: 'Spree::ItemTotal'
478
+ class_name_attribute :item_total_class, default: "Spree::ItemTotal"
467
479
 
468
480
  # Allows providing your own class for calculating taxes on an order.
469
481
  #
@@ -472,42 +484,42 @@ module Spree
472
484
  # @!attribute [rw] tax_adjuster_class
473
485
  # @return [Class] a class with the same public interfaces as
474
486
  # Spree::Tax::OrderAdjuster
475
- class_name_attribute :tax_adjuster_class, default: 'Spree::Tax::OrderAdjuster'
487
+ class_name_attribute :tax_adjuster_class, default: "Spree::Tax::OrderAdjuster"
476
488
 
477
489
  # Allows providing your own class for calculating taxes on an order.
478
490
  #
479
491
  # @!attribute [rw] tax_calculator_class
480
492
  # @return [Class] a class with the same public interfaces as
481
493
  # Spree::TaxCalculator::Default
482
- class_name_attribute :tax_calculator_class, default: 'Spree::TaxCalculator::Default'
494
+ class_name_attribute :tax_calculator_class, default: "Spree::TaxCalculator::Default"
483
495
 
484
496
  # Allows providing your own class for choosing which store to use.
485
497
  #
486
498
  # @!attribute [rw] current_store_selector_class
487
499
  # @return [Class] a class with the same public interfaces as
488
500
  # Spree::CurrentStoreSelector
489
- class_name_attribute :current_store_selector_class, default: 'Spree::StoreSelector::ByServerName'
501
+ class_name_attribute :current_store_selector_class, default: "Spree::StoreSelector::ByServerName"
490
502
 
491
503
  # Allows providing your own class for creating urls on taxons
492
504
  #
493
505
  # @!attribute [rw] taxon_url_parametizer_class
494
506
  # @return [Class] a class that provides a `#parameterize` method that
495
507
  # returns a String
496
- class_name_attribute :taxon_url_parametizer_class, default: 'ActiveSupport::Inflector'
508
+ class_name_attribute :taxon_url_parametizer_class, default: "ActiveSupport::Inflector"
497
509
 
498
510
  # Allows providing your own class for image galleries on Variants
499
511
  #
500
512
  # @!attribute [rw] variant_gallery_class
501
513
  # @return [Class] a class that implements an `images` method and returns an
502
514
  # Enumerable of images adhering to the present_image_class interface
503
- class_name_attribute :variant_gallery_class, default: 'Spree::Gallery::VariantGallery'
515
+ class_name_attribute :variant_gallery_class, default: "Spree::Gallery::VariantGallery"
504
516
 
505
517
  # Allows providing your own class for image galleries on Products
506
518
  #
507
519
  # @!attribute [rw] product_gallery_class
508
520
  # @return [Class] a class that implements an `images` method and returns an
509
521
  # Enumerable of images adhering to the present_image_class interface
510
- class_name_attribute :product_gallery_class, default: 'Spree::Gallery::ProductGallery'
522
+ class_name_attribute :product_gallery_class, default: "Spree::Gallery::ProductGallery"
511
523
 
512
524
  # Allows switching attachment library for Image
513
525
  #
@@ -525,7 +537,7 @@ module Spree
525
537
  # `%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.
526
538
  #
527
539
  # @return [Array]
528
- class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze
540
+ class_name_attribute :allowed_image_mime_types, default: %w[image/jpeg image/jpg image/png image/gif].freeze
529
541
 
530
542
  # @!attribute [rw] product_image_style_default
531
543
  #
@@ -544,10 +556,10 @@ module Spree
544
556
  # large: '1200x1200>' } is the default.
545
557
  #
546
558
  # @return [Hash]
547
- class_name_attribute :product_image_styles, default: { mini: '48x48>',
548
- small: '400x400>',
549
- product: '680x680>',
550
- large: '1200x1200>' }
559
+ class_name_attribute :product_image_styles, default: {mini: "48x48>",
560
+ small: "400x400>",
561
+ product: "680x680>",
562
+ large: "1200x1200>"}
551
563
 
552
564
  # Allows to provide your own class for tracking state changes of stateful models
553
565
  #
@@ -562,14 +574,14 @@ module Spree
562
574
  # @!attribute [rw] store_credit_prioritizer_class
563
575
  # @return [Class] a class with the same public interfaces as
564
576
  # Spree::StoreCreditPrioritizer.
565
- class_name_attribute :store_credit_prioritizer_class, default: 'Spree::StoreCreditPrioritizer'
577
+ class_name_attribute :store_credit_prioritizer_class, default: "Spree::StoreCreditPrioritizer"
566
578
 
567
579
  # Allows finding brand for product.
568
580
  #
569
581
  # @!attribute [rw] brand_selector_class
570
582
  # @return [Class] a class with the same public interfaces as
571
583
  # Spree::TaxonBrandSelector.
572
- class_name_attribute :brand_selector_class, default: 'Spree::TaxonBrandSelector'
584
+ class_name_attribute :brand_selector_class, default: "Spree::TaxonBrandSelector"
573
585
 
574
586
  # @!attribute [rw] taxon_image_style_default
575
587
  #
@@ -588,7 +600,7 @@ module Spree
588
600
  # large: '1200x1200>' } is the default.
589
601
  #
590
602
  # @return [Hash]
591
- class_name_attribute :taxon_image_styles, default: { mini: '32x32>', normal: '128x128>' }
603
+ class_name_attribute :taxon_image_styles, default: {mini: "32x32>", normal: "128x128>"}
592
604
 
593
605
  # Allows switching attachment library for Taxon
594
606
  #
@@ -618,7 +630,7 @@ module Spree
618
630
  # @return [Pathname] the configured path. (default: `Rails.root.join('db', 'migrate')`)
619
631
  attr_writer :migration_path
620
632
  def migration_path
621
- @migration_path ||= ::Rails.root.join('db', 'migrate')
633
+ @migration_path ||= ::Rails.root.join("db", "migrate")
622
634
  end
623
635
 
624
636
  # Allows providing your own class instance for generating order numbers.
@@ -694,14 +706,14 @@ module Spree
694
706
 
695
707
  def roles
696
708
  @roles ||= Spree::RoleConfiguration.new.tap do |roles|
697
- roles.assign_permissions :default, ['Spree::PermissionSets::DefaultCustomer']
698
- roles.assign_permissions :admin, ['Spree::PermissionSets::SuperUser']
709
+ roles.assign_permissions :default, ["Spree::PermissionSets::DefaultCustomer"]
710
+ roles.assign_permissions :admin, ["Spree::PermissionSets::SuperUser"]
699
711
  end
700
712
  end
701
713
 
702
714
  def user_last_url_storer_rules
703
715
  @user_last_url_storer_rules ||= ::Spree::Core::ClassConstantizer::Set.new.tap do |set|
704
- set << 'Spree::UserLastUrlStorer::Rules::AuthenticationRule'
716
+ set << "Spree::UserLastUrlStorer::Rules::AuthenticationRule"
705
717
  end
706
718
  end
707
719
 
data/lib/spree/bus.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'omnes'
3
+ require "omnes"
4
4
 
5
5
  module Spree
6
6
  # Global [Omnes](https://github.com/nebulab/omnes) bus.
data/lib/spree/config.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/app_configuration'
3
+ require "spree/app_configuration"
4
4
 
5
5
  Spree::Config = Spree::AppConfiguration.new
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_merchant/errors'
3
+ require "active_merchant/errors"
4
4
 
5
- require 'active_merchant/billing/base'
5
+ require "active_merchant/billing/base"
6
6
 
7
- require 'active_merchant/billing/avs_result'
8
- require 'active_merchant/billing/cvv_result'
9
- require 'active_merchant/billing/response'
7
+ require "active_merchant/billing/avs_result"
8
+ require "active_merchant/billing/cvv_result"
9
+ require "active_merchant/billing/response"
10
10
 
11
- require 'active_merchant/billing/credit_card_methods'
12
- require 'active_merchant/billing/credit_card_formatting'
13
- require 'active_merchant/billing/credit_card'
11
+ require "active_merchant/billing/credit_card_methods"
12
+ require "active_merchant/billing/credit_card_formatting"
13
+ require "active_merchant/billing/credit_card"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/module'
3
+ require "active_support/core_ext/module"
4
4
 
5
5
  module Spree
6
6
  module Core
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core'
3
+ require "spree/core"
4
4
 
5
5
  module Spree
6
6
  module Core
@@ -9,7 +9,7 @@ module Spree
9
9
  CREDIT_CARD_VERIFICATION_VALUE_PARAM = /payment.*source.*\.verification_value$/
10
10
 
11
11
  isolate_namespace Spree
12
- engine_name 'spree'
12
+ engine_name "spree"
13
13
 
14
14
  config.generators do |generator|
15
15
  generator.test_framework :rspec
@@ -31,15 +31,15 @@ module Spree
31
31
  end
32
32
 
33
33
  # leave empty initializers for backwards-compatability. Other apps might still rely on these events
34
- initializer "spree.default_permissions", before: :load_config_initializers do; end
35
- initializer "spree.register.calculators", before: :load_config_initializers do; end
36
- initializer "spree.register.stock_splitters", before: :load_config_initializers do; end
37
- initializer "spree.register.payment_methods", before: :load_config_initializers do; end
38
- initializer 'spree.promo.environment', before: :load_config_initializers do; end
39
- initializer 'spree.promo.register.promotion.calculators', before: :load_config_initializers do; end
40
- initializer 'spree.promo.register.promotion.rules', before: :load_config_initializers do; end
41
- initializer 'spree.promo.register.promotions.actions', before: :load_config_initializers do; end
42
- initializer 'spree.promo.register.promotions.shipping_actions', before: :load_config_initializers do; end
34
+ initializer("spree.default_permissions", before: :load_config_initializers) {}
35
+ initializer("spree.register.calculators", before: :load_config_initializers) {}
36
+ initializer("spree.register.stock_splitters", before: :load_config_initializers) {}
37
+ initializer("spree.register.payment_methods", before: :load_config_initializers) {}
38
+ initializer("spree.promo.environment", before: :load_config_initializers) {}
39
+ initializer("spree.promo.register.promotion.calculators", before: :load_config_initializers) {}
40
+ initializer("spree.promo.register.promotion.rules", before: :load_config_initializers) {}
41
+ initializer("spree.promo.register.promotions.actions", before: :load_config_initializers) {}
42
+ initializer("spree.promo.register.promotions.shipping_actions", before: :load_config_initializers) {}
43
43
 
44
44
  # Filter sensitive information during logging
45
45
  initializer "spree.params.filter", before: :load_config_initializers do |app|
@@ -47,7 +47,7 @@ module Spree
47
47
  %r{^password$},
48
48
  %r{^password_confirmation$},
49
49
  CREDIT_CARD_NUMBER_PARAM,
50
- CREDIT_CARD_VERIFICATION_VALUE_PARAM,
50
+ CREDIT_CARD_VERIFICATION_VALUE_PARAM
51
51
  ]
52
52
  end
53
53
 
@@ -56,7 +56,7 @@ module Spree
56
56
  end
57
57
 
58
58
  # Setup pub/sub
59
- initializer 'spree.core.pub_sub' do |app|
59
+ initializer "spree.core.pub_sub" do |app|
60
60
  app.reloader.to_prepare do
61
61
  Spree::Bus.clear
62
62
 
@@ -95,13 +95,13 @@ module Spree
95
95
  end
96
96
 
97
97
  config.after_initialize do
98
- Spree::Config.check_load_defaults_called('Spree::Config')
98
+ Spree::Config.check_load_defaults_called("Spree::Config")
99
99
  Spree::Config.static_model_preferences.validate!
100
100
  end
101
101
 
102
102
  config.after_initialize do
103
103
  if defined?(Spree::Auth::Engine) &&
104
- Gem::Version.new(Spree::Auth::VERSION) < Gem::Version.new('2.5.4') &&
104
+ Gem::Version.new(Spree::Auth::VERSION) < Gem::Version.new("2.5.4") &&
105
105
  defined?(Spree::UsersController)
106
106
  Spree::UsersController.protect_from_forgery with: :exception
107
107
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core/environment_extension'
3
+ require "spree/core/environment_extension"
4
4
 
5
5
  module Spree
6
6
  module Core
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core/class_constantizer'
4
- require 'spree/core/nested_class_set'
3
+ require "spree/core/class_constantizer"
4
+ require "spree/core/nested_class_set"
5
5
 
6
6
  module Spree
7
7
  module Core
@@ -35,7 +35,7 @@ module Spree
35
35
 
36
36
  if completed_at
37
37
  order.completed_at = completed_at
38
- order.state = 'complete'
38
+ order.state = "complete"
39
39
  order.save!
40
40
  end
41
41
 
@@ -55,7 +55,7 @@ module Spree
55
55
 
56
56
  shipments_hash.each do |target|
57
57
  shipment = Shipment.new
58
- shipment.tracking = target[:tracking]
58
+ shipment.tracking = target[:tracking]
59
59
  shipment.stock_location = Spree::StockLocation.find_by(id: target[:stock_location_id]) ||
60
60
  Spree::StockLocation.find_by(admin_name: target[:stock_location]) ||
61
61
  Spree::StockLocation.find_by!(name: target[:stock_location])
@@ -64,7 +64,7 @@ module Spree
64
64
  inventory_units.each do |inventory_unit|
65
65
  ensure_variant_id_from_params(inventory_unit)
66
66
 
67
- unless line_item = order.line_items.find_by(variant_id: inventory_unit[:variant_id])
67
+ unless (line_item = order.line_items.find_by(variant_id: inventory_unit[:variant_id]))
68
68
  line_item = order.contents.add(Spree::Variant.find(inventory_unit[:variant_id]), 1)
69
69
  end
70
70
 
@@ -81,9 +81,9 @@ module Spree
81
81
  # Mark shipped if it should be.
82
82
  if target[:shipped_at].present?
83
83
  shipment.shipped_at = target[:shipped_at]
84
- shipment.state = 'shipped'
84
+ shipment.state = "shipped"
85
85
  shipment.inventory_units.each do |unit|
86
- unit.state = 'shipped'
86
+ unit.state = "shipped"
87
87
  end
88
88
  end
89
89
 
@@ -92,7 +92,7 @@ module Spree
92
92
 
93
93
  shipping_method = Spree::ShippingMethod.find_by(name: target[:shipping_method]) || Spree::ShippingMethod.find_by!(admin_name: target[:shipping_method])
94
94
  rate = shipment.shipping_rates.create!(shipping_method:,
95
- cost: target[:cost])
95
+ cost: target[:cost])
96
96
  shipment.selected_shipping_rate_id = rate.id
97
97
  shipment.update_amounts
98
98
  end
@@ -131,7 +131,7 @@ module Spree
131
131
  adjustment = order.adjustments.build(
132
132
  order:,
133
133
  amount: target[:amount].to_d,
134
- label: target[:label]
134
+ label: target[:label]
135
135
  )
136
136
  adjustment.save!
137
137
  adjustment.finalize!
@@ -145,7 +145,7 @@ module Spree
145
145
  payment.amount = target[:amount].to_f
146
146
  # Order API should be using state as that's the normal payment field.
147
147
  # spree_wombat serializes payment state as status so imported orders should fall back to status field.
148
- payment.state = target[:state] || target[:status] || 'completed'
148
+ payment.state = target[:state] || target[:status] || "completed"
149
149
  payment.payment_method = Spree::PaymentMethod.find_by!(name: target[:payment_method])
150
150
  source_attributes = target[:source] || target[:source_attributes]
151
151
  payment.source = create_source_payment_from_params(source_attributes, payment) if source_attributes
@@ -179,13 +179,13 @@ module Spree
179
179
  return if address.nil? || address[:country_id].present? || address[:country].nil?
180
180
 
181
181
  search = {}
182
- if name = address[:country]['name']
182
+ if (name = address[:country]["name"])
183
183
  search[:name] = name
184
- elsif iso_name = address[:country]['iso_name']
184
+ elsif (iso_name = address[:country]["iso_name"])
185
185
  search[:iso_name] = iso_name.upcase
186
- elsif iso = address[:country]['iso']
186
+ elsif (iso = address[:country]["iso"])
187
187
  search[:iso] = iso.upcase
188
- elsif iso_three = address[:country]['iso3']
188
+ elsif (iso_three = address[:country]["iso3"])
189
189
  search[:iso3] = iso_three.upcase
190
190
  end
191
191
 
@@ -197,16 +197,16 @@ module Spree
197
197
  return if address.nil? || address[:state_id].present? || address[:state].nil?
198
198
 
199
199
  search = {}
200
- if name = address[:state]['name']
200
+ if (name = address[:state]["name"])
201
201
  search[:name] = name
202
- elsif abbr = address[:state]['abbr']
202
+ elsif (abbr = address[:state]["abbr"])
203
203
  search[:abbr] = abbr.upcase
204
204
  end
205
205
 
206
206
  address.delete(:state)
207
207
  search[:country_id] = address[:country_id]
208
208
 
209
- if state = Spree::State.where(search).first
209
+ if (state = Spree::State.where(search).first)
210
210
  address[:state_id] = state.id
211
211
  else
212
212
  address[:state_name] = search[:name] || search[:abbr]
@@ -18,7 +18,7 @@ module Spree
18
18
  if product.save
19
19
  variants_attrs.each do |variant_attribute|
20
20
  # make sure the product is assigned before the options=
21
- product.variants.create({ product: }.merge(variant_attribute))
21
+ product.variants.create({product:}.merge(variant_attribute))
22
22
  end
23
23
 
24
24
  set_up_options
@@ -31,11 +31,11 @@ module Spree
31
31
  if product.update(product_attrs)
32
32
  variants_attrs.each do |variant_attribute|
33
33
  # update the variant if the id is present in the payload
34
- if variant_attribute['id'].present?
35
- product.variants.find(variant_attribute['id'].to_i).update(variant_attribute)
34
+ if variant_attribute["id"].present?
35
+ product.variants.find(variant_attribute["id"].to_i).update(variant_attribute)
36
36
  else
37
37
  # make sure the product is assigned before the options=
38
- product.variants.create({ product: }.merge(variant_attribute))
38
+ product.variants.create({product:}.merge(variant_attribute))
39
39
  end
40
40
  end
41
41
 
@@ -7,5 +7,5 @@ module Spree
7
7
  end
8
8
  end
9
9
 
10
- require 'spree/core/importer/order'
11
- require 'spree/core/importer/product'
10
+ require "spree/core/importer/order"
11
+ require "spree/core/importer/product"