solidus_core 4.3.5 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +2 -2
  3. data/app/mailers/spree/base_mailer.rb +1 -1
  4. data/app/mailers/spree/carton_mailer.rb +1 -1
  5. data/app/mailers/spree/order_mailer.rb +3 -3
  6. data/app/mailers/spree/reimbursement_mailer.rb +1 -1
  7. data/app/models/concerns/spree/active_storage_adapter/normalization.rb +1 -1
  8. data/app/models/concerns/spree/active_storage_adapter.rb +1 -1
  9. data/app/models/concerns/spree/display_money.rb +1 -1
  10. data/app/models/concerns/spree/ordered_property_value_list.rb +2 -2
  11. data/app/models/concerns/spree/user_address_book.rb +4 -4
  12. data/app/models/concerns/spree/user_methods.rb +3 -3
  13. data/app/models/spree/address.rb +6 -6
  14. data/app/models/spree/adjustment.rb +13 -66
  15. data/app/models/spree/calculator/returns/default_refund_amount.rb +1 -1
  16. data/app/models/spree/carton.rb +2 -2
  17. data/app/models/spree/credit_card.rb +6 -6
  18. data/app/models/spree/deprecated_configurable_class.rb +40 -0
  19. data/app/models/spree/fulfilment_changer.rb +4 -4
  20. data/app/models/spree/inventory_unit.rb +2 -2
  21. data/app/models/spree/line_item.rb +1 -1
  22. data/app/models/spree/null_promotion_adjuster.rb +13 -0
  23. data/app/models/spree/null_promotion_advertiser.rb +9 -0
  24. data/app/models/spree/null_promotion_finder.rb +9 -0
  25. data/app/models/spree/null_promotion_handler.rb +44 -0
  26. data/app/models/spree/order.rb +15 -22
  27. data/app/models/spree/order_cancellations.rb +8 -8
  28. data/app/models/spree/order_mutex.rb +2 -2
  29. data/app/models/spree/order_shipping.rb +9 -9
  30. data/app/models/spree/order_updater.rb +6 -10
  31. data/app/models/spree/payment/processing.rb +2 -2
  32. data/app/models/spree/payment.rb +2 -2
  33. data/app/models/spree/payment_create.rb +1 -1
  34. data/app/models/spree/payment_method/store_credit.rb +1 -1
  35. data/app/models/spree/payment_source.rb +5 -1
  36. data/app/models/spree/permission_set.rb +11 -0
  37. data/app/models/spree/product.rb +7 -28
  38. data/app/models/spree/refund.rb +1 -1
  39. data/app/models/spree/reimbursement.rb +4 -4
  40. data/app/models/spree/reimbursement_performer.rb +3 -3
  41. data/app/models/spree/reimbursement_tax_calculator.rb +2 -2
  42. data/app/models/spree/reimbursement_type/credit.rb +1 -1
  43. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +6 -6
  44. data/app/models/spree/reimbursement_type/store_credit.rb +1 -1
  45. data/app/models/spree/return_item.rb +9 -9
  46. data/app/models/spree/role.rb +3 -1
  47. data/app/models/spree/role_permission.rb +8 -0
  48. data/app/models/spree/shipment.rb +7 -7
  49. data/app/models/spree/shipping_category.rb +2 -0
  50. data/app/models/spree/shipping_rate.rb +1 -1
  51. data/app/models/spree/{order_contents.rb → simple_order_contents.rb} +4 -11
  52. data/app/models/spree/stock/estimator.rb +1 -1
  53. data/app/models/spree/stock/inventory_unit_builder.rb +1 -1
  54. data/app/models/spree/stock/package.rb +2 -2
  55. data/app/models/spree/stock/simple_coordinator.rb +1 -1
  56. data/app/models/spree/stock_location.rb +5 -5
  57. data/app/models/spree/store.rb +1 -1
  58. data/app/models/spree/store_credit.rb +15 -15
  59. data/app/models/spree/store_credit_event.rb +3 -3
  60. data/app/models/spree/tax_calculator/default.rb +2 -2
  61. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -1
  62. data/app/models/spree/tax_category.rb +3 -1
  63. data/app/models/spree/tax_rate.rb +3 -3
  64. data/app/models/spree/taxonomy.rb +2 -2
  65. data/app/models/spree/unit_cancel.rb +1 -2
  66. data/app/models/spree/variant/vat_price_generator.rb +1 -1
  67. data/app/models/spree/variant.rb +7 -2
  68. data/app/models/spree/wallet.rb +2 -2
  69. data/app/views/spree/order_mailer/cancel_email.html.erb +1 -1
  70. data/app/views/spree/order_mailer/cancel_email.text.erb +1 -1
  71. data/app/views/spree/order_mailer/confirm_email.html.erb +5 -5
  72. data/app/views/spree/order_mailer/confirm_email.text.erb +5 -5
  73. data/config/locales/en.yml +4 -90
  74. data/db/default/spree/permission_sets.rb +10 -0
  75. data/db/default/spree/return_reasons.rb +3 -1
  76. data/db/default/spree/states.rb +1 -1
  77. data/db/migrate/20160101010000_solidus_one_four.rb +0 -117
  78. data/db/migrate/20240821173254_create_spree_permission_sets_in_core.rb +9 -0
  79. data/db/migrate/20240821173341_create_spree_roles_permissions_in_core.rb +9 -0
  80. data/db/migrate/20240821173641_add_description_to_spree_roles.rb +5 -0
  81. data/db/migrate/20240904152041_add_privilege_and_category_to_spree_permission_sets.rb +6 -0
  82. data/db/seeds.rb +1 -0
  83. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
  84. data/lib/generators/solidus/update/update_generator.rb +1 -1
  85. data/lib/generators/spree/dummy/templates/rails/test.rb +6 -1
  86. data/lib/spree/app_configuration.rb +53 -84
  87. data/lib/spree/core/class_constantizer.rb +2 -2
  88. data/lib/spree/core/controller_helpers/payment_parameters.rb +1 -1
  89. data/lib/spree/core/engine.rb +1 -0
  90. data/lib/spree/core/environment/calculators.rb +35 -3
  91. data/lib/spree/core/environment/promotions.rb +25 -4
  92. data/lib/spree/core/environment_extension.rb +16 -2
  93. data/lib/spree/core/importer/order.rb +5 -5
  94. data/lib/spree/core/importer/product.rb +3 -3
  95. data/lib/spree/core/nested_class_set.rb +28 -0
  96. data/lib/spree/core/null_promotion_configuration.rb +84 -0
  97. data/lib/spree/core/product_filters.rb +1 -1
  98. data/lib/spree/core/search/variant.rb +2 -2
  99. data/lib/spree/core/state_machines/order.rb +0 -1
  100. data/lib/spree/core/validators/email.rb +1 -1
  101. data/lib/spree/core/version.rb +2 -2
  102. data/lib/spree/core.rb +2 -6
  103. data/lib/spree/deprecator.rb +9 -0
  104. data/lib/spree/i18n.rb +1 -1
  105. data/lib/spree/mailer_previews/carton_preview.rb +1 -1
  106. data/lib/spree/permission_sets/base.rb +13 -1
  107. data/lib/spree/permission_sets/configuration_display.rb +10 -0
  108. data/lib/spree/permission_sets/configuration_management.rb +10 -0
  109. data/lib/spree/permission_sets/dashboard_display.rb +12 -0
  110. data/lib/spree/permission_sets/default_customer.rb +11 -1
  111. data/lib/spree/permission_sets/order_display.rb +10 -0
  112. data/lib/spree/permission_sets/order_management.rb +10 -0
  113. data/lib/spree/permission_sets/product_display.rb +10 -0
  114. data/lib/spree/permission_sets/product_management.rb +10 -0
  115. data/lib/spree/permission_sets/restricted_stock_display.rb +10 -0
  116. data/lib/spree/permission_sets/restricted_stock_management.rb +10 -0
  117. data/lib/spree/permission_sets/stock_display.rb +10 -0
  118. data/lib/spree/permission_sets/stock_management.rb +10 -0
  119. data/lib/spree/permission_sets/super_user.rb +10 -0
  120. data/lib/spree/permission_sets/user_display.rb +10 -0
  121. data/lib/spree/permission_sets/user_management.rb +10 -0
  122. data/lib/spree/permission_sets.rb +0 -2
  123. data/lib/spree/permitted_attributes.rb +2 -2
  124. data/lib/spree/preferences/store.rb +2 -2
  125. data/lib/spree/testing_support/capybara_ext.rb +1 -1
  126. data/lib/spree/testing_support/dummy_ability.rb +7 -0
  127. data/lib/spree/testing_support/dummy_app/database.yml +2 -2
  128. data/lib/spree/testing_support/dummy_app/migrations.rb +8 -15
  129. data/lib/spree/testing_support/dummy_app/rake_tasks.rb +2 -2
  130. data/lib/spree/testing_support/dummy_app.rb +17 -12
  131. data/lib/spree/testing_support/factories/adjustment_factory.rb +1 -2
  132. data/lib/spree/testing_support/factories/calculator_factory.rb +1 -5
  133. data/lib/spree/testing_support/factories/carton_factory.rb +2 -2
  134. data/lib/spree/testing_support/factories/customer_return_factory.rb +2 -2
  135. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +3 -3
  136. data/lib/spree/testing_support/factories/order_factory.rb +5 -24
  137. data/lib/spree/testing_support/factories/product_factory.rb +1 -1
  138. data/lib/spree/testing_support/factories/shipment_factory.rb +1 -1
  139. data/lib/spree/testing_support/factories/stock_item_factory.rb +5 -1
  140. data/lib/spree/testing_support/factories/stock_package_factory.rb +1 -1
  141. data/lib/spree/testing_support/factories/user_factory.rb +1 -1
  142. data/lib/spree/testing_support/factories/zone_factory.rb +1 -1
  143. data/lib/spree/testing_support/order_walkthrough.rb +3 -3
  144. data/lib/spree/testing_support/shared_examples/calculator.rb +10 -0
  145. data/lib/spree/testing_support/shared_examples/order_factory.rb +141 -0
  146. data/lib/spree/testing_support/shared_examples/working_factory.rb +15 -0
  147. data/lib/tasks/colorado_delivery_fee.rake +2 -2
  148. data/solidus_core.gemspec +6 -6
  149. metadata +60 -91
  150. data/app/jobs/spree/promotion_code_batch_job.rb +0 -26
  151. data/app/mailers/spree/promotion_code_batch_mailer.rb +0 -15
  152. data/app/models/spree/calculator/distributed_amount.rb +0 -33
  153. data/app/models/spree/calculator/flat_percent_item_total.rb +0 -23
  154. data/app/models/spree/calculator/flexi_rate.rb +0 -22
  155. data/app/models/spree/calculator/percent_on_line_item.rb +0 -13
  156. data/app/models/spree/calculator/tiered_flat_rate.rb +0 -52
  157. data/app/models/spree/calculator/tiered_percent.rb +0 -62
  158. data/app/models/spree/order_promotion.rb +0 -27
  159. data/app/models/spree/promotion/actions/create_adjustment.rb +0 -81
  160. data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -98
  161. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -139
  162. data/app/models/spree/promotion/actions/free_shipping.rb +0 -59
  163. data/app/models/spree/promotion/order_adjustments_recalculator.rb +0 -92
  164. data/app/models/spree/promotion/rules/first_order.rb +0 -38
  165. data/app/models/spree/promotion/rules/first_repeat_purchase_since.rb +0 -36
  166. data/app/models/spree/promotion/rules/item_total.rb +0 -86
  167. data/app/models/spree/promotion/rules/minimum_quantity.rb +0 -59
  168. data/app/models/spree/promotion/rules/nth_order.rb +0 -45
  169. data/app/models/spree/promotion/rules/one_use_per_user.rb +0 -25
  170. data/app/models/spree/promotion/rules/option_value.rb +0 -50
  171. data/app/models/spree/promotion/rules/product.rb +0 -86
  172. data/app/models/spree/promotion/rules/store.rb +0 -26
  173. data/app/models/spree/promotion/rules/taxon.rb +0 -91
  174. data/app/models/spree/promotion/rules/user.rb +0 -34
  175. data/app/models/spree/promotion/rules/user_logged_in.rb +0 -20
  176. data/app/models/spree/promotion/rules/user_role.rb +0 -45
  177. data/app/models/spree/promotion.rb +0 -271
  178. data/app/models/spree/promotion_action.rb +0 -47
  179. data/app/models/spree/promotion_category.rb +0 -8
  180. data/app/models/spree/promotion_chooser.rb +0 -34
  181. data/app/models/spree/promotion_code/batch_builder.rb +0 -64
  182. data/app/models/spree/promotion_code.rb +0 -54
  183. data/app/models/spree/promotion_code_batch.rb +0 -27
  184. data/app/models/spree/promotion_handler/cart.rb +0 -75
  185. data/app/models/spree/promotion_handler/coupon.rb +0 -123
  186. data/app/models/spree/promotion_handler/page.rb +0 -26
  187. data/app/models/spree/promotion_handler/shipping.rb +0 -61
  188. data/app/models/spree/promotion_rule.rb +0 -55
  189. data/app/models/spree/promotion_rule_store.rb +0 -10
  190. data/app/models/spree/promotion_rule_taxon.rb +0 -8
  191. data/app/models/spree/promotion_rule_user.rb +0 -10
  192. data/app/views/spree/promotion_code_batch_mailer/promotion_code_batch_errored.text.erb +0 -2
  193. data/app/views/spree/promotion_code_batch_mailer/promotion_code_batch_finished.text.erb +0 -2
  194. data/db/migrate/20161017102621_create_spree_promotion_code_batch.rb +0 -38
  195. data/db/migrate/20180202190713_create_promotion_rule_stores.rb +0 -12
  196. data/db/migrate/20180328172631_add_join_characters_to_promotion_code_batch.rb +0 -11
  197. data/db/migrate/20190106184413_remove_code_from_spree_promotions.rb +0 -42
  198. data/db/migrate/20220317165036_set_promotions_with_any_policy_to_all_if_possible.rb +0 -20
  199. data/db/migrate/20230322085416_remove_match_policy_from_spree_promotion.rb +0 -5
  200. data/db/migrate/20230325132905_remove_unused_columns_from_promotion_rules.rb +0 -6
  201. data/db/migrate/20230325161633_drop_unused_promo_action_line_items.rb +0 -13
  202. data/db/migrate/20231027084517_add_order_promotions_foreign_key.rb +0 -10
  203. data/db/migrate/20231031175215_add_promotion_order_promotion_foreign_key.rb +0 -10
  204. data/lib/solidus/migrations/promotions_with_code_handlers.rb +0 -66
  205. data/lib/spree/permission_sets/promotion_display.rb +0 -25
  206. data/lib/spree/permission_sets/promotion_management.rb +0 -25
  207. data/lib/spree/ransack_4_1_patch.rb +0 -16
  208. data/lib/spree/testing_support/factories/order_promotion_factory.rb +0 -8
  209. data/lib/spree/testing_support/factories/promotion_category_factory.rb +0 -7
  210. data/lib/spree/testing_support/factories/promotion_code_factory.rb +0 -8
  211. data/lib/spree/testing_support/factories/promotion_factory.rb +0 -98
@@ -1,98 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- FactoryBot.define do
4
- factory :promotion, class: 'Spree::Promotion' do
5
- name { 'Promo' }
6
-
7
- transient do
8
- code { nil }
9
- end
10
- before(:create) do |promotion, evaluator|
11
- if evaluator.code
12
- promotion.codes << build(:promotion_code, promotion: promotion, value: evaluator.code)
13
- end
14
- end
15
-
16
- trait :with_action do
17
- transient do
18
- promotion_action_class { Spree::Promotion::Actions::CreateAdjustment }
19
- end
20
-
21
- after(:create) do |promotion, evaluator|
22
- promotion.actions << evaluator.promotion_action_class.new
23
- end
24
- end
25
-
26
- trait :with_adjustable_action do
27
- transient do
28
- preferred_amount { 10 }
29
- calculator_class { Spree::Calculator::FlatRate }
30
- promotion_action_class { Spree::Promotion::Actions::CreateItemAdjustments }
31
- end
32
-
33
- after(:create) do |promotion, evaluator|
34
- calculator = evaluator.calculator_class.new
35
- calculator.preferred_amount = evaluator.preferred_amount
36
- evaluator.promotion_action_class.create!(calculator: calculator, promotion: promotion)
37
- end
38
- end
39
-
40
- factory :promotion_with_action_adjustment, traits: [:with_adjustable_action]
41
-
42
- trait :with_line_item_adjustment do
43
- transient do
44
- adjustment_rate { 10 }
45
- end
46
-
47
- with_adjustable_action
48
- preferred_amount { adjustment_rate }
49
- end
50
-
51
- factory :promotion_with_item_adjustment, traits: [:with_line_item_adjustment]
52
-
53
- trait :with_free_shipping do
54
- after(:create) do |promotion|
55
- Spree::Promotion::Actions::FreeShipping.create!(promotion: promotion)
56
- end
57
- end
58
-
59
- trait :with_order_adjustment do
60
- transient do
61
- weighted_order_adjustment_amount { 10 }
62
- end
63
-
64
- with_adjustable_action
65
- preferred_amount { weighted_order_adjustment_amount }
66
- promotion_action_class { Spree::Promotion::Actions::CreateAdjustment }
67
- end
68
-
69
- factory :promotion_with_order_adjustment, traits: [:with_order_adjustment]
70
-
71
- trait :with_item_total_rule do
72
- transient do
73
- item_total_threshold_amount { 10 }
74
- end
75
-
76
- after(:create) do |promotion, evaluator|
77
- rule = Spree::Promotion::Rules::ItemTotal.create!(
78
- promotion: promotion,
79
- preferred_operator: 'gte',
80
- preferred_amount: evaluator.item_total_threshold_amount
81
- )
82
- promotion.rules << rule
83
- promotion.save!
84
- end
85
- end
86
- factory :promotion_with_item_total_rule, traits: [:with_item_total_rule]
87
- trait :with_first_order_rule do
88
- after(:create) do |promotion, _evaluator|
89
- rule = Spree::Promotion::Rules::FirstOrder.create!(
90
- promotion: promotion,
91
- )
92
- promotion.rules << rule
93
- promotion.save!
94
- end
95
- end
96
- factory :promotion_with_first_order_rule, traits: [:with_first_order_rule]
97
- end
98
- end