solidus_core 4.4.2 → 4.5.1

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 (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/core/controller_helpers/auth.rb +66 -0
  3. data/app/helpers/spree/core/controller_helpers/common.rb +82 -0
  4. data/app/helpers/spree/core/controller_helpers/order.rb +86 -0
  5. data/app/helpers/spree/core/controller_helpers/payment_parameters.rb +165 -0
  6. data/app/helpers/spree/core/controller_helpers/pricing.rb +19 -0
  7. data/app/helpers/spree/core/controller_helpers/search.rb +16 -0
  8. data/app/helpers/spree/core/controller_helpers/store.rb +19 -0
  9. data/app/helpers/spree/core/controller_helpers/strong_parameters.rb +74 -0
  10. data/app/models/concerns/spree/metadata.rb +64 -0
  11. data/app/models/concerns/spree/user_address_book.rb +4 -5
  12. data/app/models/spree/core/state_machines/inventory_unit.rb +42 -0
  13. data/app/models/spree/core/state_machines/order/class_methods.rb +217 -0
  14. data/app/models/spree/core/state_machines/order.rb +42 -0
  15. data/app/models/spree/core/state_machines/payment.rb +61 -0
  16. data/app/models/spree/core/state_machines/reimbursement.rb +33 -0
  17. data/app/models/spree/core/state_machines/return_authorization.rb +32 -0
  18. data/app/models/spree/core/state_machines/return_item/acceptance_status.rb +51 -0
  19. data/app/models/spree/core/state_machines/return_item/reception_status.rb +42 -0
  20. data/app/models/spree/core/state_machines/shipment.rb +58 -0
  21. data/app/models/spree/customer_return.rb +2 -0
  22. data/app/models/spree/item_total.rb +28 -0
  23. data/app/models/spree/legacy_user.rb +1 -0
  24. data/app/models/spree/line_item.rb +21 -0
  25. data/app/models/spree/money.rb +120 -0
  26. data/app/models/spree/order.rb +20 -9
  27. data/app/models/spree/order_merger.rb +1 -1
  28. data/app/models/spree/order_taxation.rb +1 -0
  29. data/app/models/spree/order_updater.rb +13 -30
  30. data/app/models/spree/payment.rb +1 -0
  31. data/app/models/spree/permission_sets/base.rb +45 -0
  32. data/app/models/spree/permission_sets/configuration_display.rb +53 -0
  33. data/app/models/spree/permission_sets/configuration_management.rb +52 -0
  34. data/app/models/spree/permission_sets/dashboard_display.rb +28 -0
  35. data/app/models/spree/permission_sets/default_customer.rb +83 -0
  36. data/app/models/spree/permission_sets/order_display.rb +50 -0
  37. data/app/models/spree/permission_sets/order_management.rb +50 -0
  38. data/app/models/spree/permission_sets/product_display.rb +43 -0
  39. data/app/models/spree/permission_sets/product_management.rb +47 -0
  40. data/app/models/spree/permission_sets/restricted_stock_display.rb +33 -0
  41. data/app/models/spree/permission_sets/restricted_stock_management.rb +33 -0
  42. data/app/models/spree/permission_sets/stock_display.rb +26 -0
  43. data/app/models/spree/permission_sets/stock_management.rb +26 -0
  44. data/app/models/spree/permission_sets/super_user.rb +26 -0
  45. data/app/models/spree/permission_sets/user_display.rb +27 -0
  46. data/app/models/spree/permission_sets/user_management.rb +44 -0
  47. data/app/models/spree/product.rb +7 -0
  48. data/app/models/spree/refund.rb +2 -0
  49. data/app/models/spree/return_authorization.rb +2 -0
  50. data/app/models/spree/shipment.rb +2 -0
  51. data/app/models/spree/simple_order_contents.rb +4 -1
  52. data/app/models/spree/store_credit_event.rb +1 -0
  53. data/app/models/spree/tax/tax_helpers.rb +12 -1
  54. data/app/models/spree/tax_calculator/default.rb +1 -1
  55. data/app/models/spree/taxon.rb +22 -2
  56. data/app/models/spree/taxon_brand_selector.rb +22 -0
  57. data/app/models/spree/unauthorized_redirect_handler.rb +24 -0
  58. data/app/models/spree/user_address.rb +9 -3
  59. data/app/models/spree/variant.rb +14 -1
  60. data/config/locales/en.yml +14 -0
  61. data/db/migrate/20220419170826_remove_archived_user_addresses.rb +12 -0
  62. data/db/migrate/20250129061658_add_metadata_to_spree_resources.rb +28 -0
  63. data/db/migrate/20250201172950_add_gtin_and_condition_to_spree_variant.rb +6 -0
  64. data/db/migrate/20250207104016_add_primary_taxon_to_products.rb +7 -0
  65. data/db/migrate/20250221152004_add_metadata_to_users.rb +13 -0
  66. data/lib/generators/solidus/install/app_templates/authentication/custom.rb +0 -5
  67. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
  68. data/lib/generators/spree/dummy/dummy_generator.rb +1 -1
  69. data/lib/generators/spree/dummy/templates/rails/application.rb.tt +1 -1
  70. data/lib/generators/spree/dummy/templates/rails/manifest.js +3 -0
  71. data/lib/spree/app_configuration.rb +49 -0
  72. data/lib/spree/core/controller_helpers/auth.rb +5 -61
  73. data/lib/spree/core/controller_helpers/common.rb +5 -80
  74. data/lib/spree/core/controller_helpers/order.rb +5 -86
  75. data/lib/spree/core/controller_helpers/payment_parameters.rb +5 -163
  76. data/lib/spree/core/controller_helpers/pricing.rb +5 -17
  77. data/lib/spree/core/controller_helpers/search.rb +5 -14
  78. data/lib/spree/core/controller_helpers/store.rb +5 -17
  79. data/lib/spree/core/controller_helpers/strong_parameters.rb +5 -71
  80. data/lib/spree/core/engine.rb +5 -0
  81. data/lib/spree/core/state_machines/inventory_unit.rb +5 -40
  82. data/lib/spree/core/state_machines/order.rb +5 -250
  83. data/lib/spree/core/state_machines/payment.rb +5 -59
  84. data/lib/spree/core/state_machines/reimbursement.rb +5 -31
  85. data/lib/spree/core/state_machines/return_authorization.rb +5 -30
  86. data/lib/spree/core/state_machines/return_item/acceptance_status.rb +5 -49
  87. data/lib/spree/core/state_machines/return_item/reception_status.rb +5 -40
  88. data/lib/spree/core/state_machines/shipment.rb +5 -56
  89. data/lib/spree/core/state_machines.rb +48 -81
  90. data/lib/spree/core/version.rb +2 -2
  91. data/lib/spree/core.rb +0 -10
  92. data/lib/spree/money.rb +5 -118
  93. data/lib/spree/permission_sets/base.rb +5 -42
  94. data/lib/spree/permission_sets/configuration_display.rb +5 -51
  95. data/lib/spree/permission_sets/configuration_management.rb +5 -50
  96. data/lib/spree/permission_sets/dashboard_display.rb +5 -26
  97. data/lib/spree/permission_sets/default_customer.rb +5 -81
  98. data/lib/spree/permission_sets/order_display.rb +5 -48
  99. data/lib/spree/permission_sets/order_management.rb +5 -48
  100. data/lib/spree/permission_sets/product_display.rb +5 -41
  101. data/lib/spree/permission_sets/product_management.rb +5 -45
  102. data/lib/spree/permission_sets/restricted_stock_display.rb +5 -31
  103. data/lib/spree/permission_sets/restricted_stock_management.rb +5 -31
  104. data/lib/spree/permission_sets/stock_display.rb +5 -24
  105. data/lib/spree/permission_sets/stock_management.rb +5 -24
  106. data/lib/spree/permission_sets/super_user.rb +5 -24
  107. data/lib/spree/permission_sets/user_display.rb +5 -25
  108. data/lib/spree/permission_sets/user_management.rb +5 -42
  109. data/lib/spree/permission_sets.rb +5 -16
  110. data/lib/spree/permitted_attributes.rb +18 -7
  111. data/lib/spree/preferences/configuration.rb +4 -0
  112. data/lib/spree/preferences/persistable.rb +1 -1
  113. data/lib/spree/testing_support/capybara_ext.rb +10 -0
  114. data/lib/spree/testing_support/dummy_app.rb +1 -1
  115. data/lib/spree/testing_support/factories/order_factory.rb +9 -1
  116. data/solidus_core.gemspec +1 -1
  117. metadata +65 -24
  118. data/lib/generators/spree/dummy/templates/rails/script/rails +0 -6
@@ -1,50 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Read permissions for orders.
6
- #
7
- # This permission set allows users to view all related information about
8
- # orders, also from the admin panel, including:
9
- #
10
- # - Orders
11
- # - Payments
12
- # - Shipments
13
- # - Adjustments
14
- # - Line items
15
- # - Return authorizations
16
- # - Customer returns
17
- # - Order cancellations
18
- # - Reimbursements
19
- # - Return items
20
- # - Refunds
21
- #
22
- # However, it does not allow any modifications to be made to any of these
23
- # resources.
24
- class OrderDisplay < PermissionSets::Base
25
- class << self
26
- def privilege
27
- :display
28
- end
29
-
30
- def category
31
- :order
32
- end
33
- end
34
-
35
- def activate!
36
- can [:read, :admin, :edit, :cart], Spree::Order
37
- can [:read, :admin], Spree::Payment
38
- can [:read, :admin], Spree::Shipment
39
- can [:read, :admin], Spree::Adjustment
40
- can [:read, :admin], Spree::LineItem
41
- can [:read, :admin], Spree::ReturnAuthorization
42
- can [:read, :admin], Spree::CustomerReturn
43
- can [:read, :admin], Spree::OrderCancellations
44
- can [:read, :admin], Spree::Reimbursement
45
- can [:read, :admin], Spree::ReturnItem
46
- can [:read, :admin], Spree::Refund
47
- end
48
- end
49
- end
50
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,50 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for order management.
6
- #
7
- # This permission set grants full control over all order and related resources,
8
- # including:
9
- #
10
- # - Orders
11
- # - Payments
12
- # - Shipments
13
- # - Adjustments
14
- # - Line items
15
- # - Return authorizations
16
- # - Customer returns
17
- # - Order cancellations
18
- # - Reimbursements
19
- # - Return items
20
- # - Refunds
21
- #
22
- # It also allows reading reimbursement types, but not modifying them.
23
- class OrderManagement < PermissionSets::Base
24
- class << self
25
- def privilege
26
- :management
27
- end
28
-
29
- def category
30
- :order
31
- end
32
- end
33
-
34
- def activate!
35
- can :read, Spree::ReimbursementType
36
- can :manage, Spree::Order
37
- can :manage, Spree::Payment
38
- can :manage, Spree::Shipment
39
- can :manage, Spree::Adjustment
40
- can :manage, Spree::LineItem
41
- can :manage, Spree::ReturnAuthorization
42
- can :manage, Spree::CustomerReturn
43
- can :manage, Spree::OrderCancellations
44
- can :manage, Spree::Reimbursement
45
- can :manage, Spree::ReturnItem
46
- can :manage, Spree::Refund
47
- end
48
- end
49
- end
50
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,43 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Read-only permissions for products.
6
- #
7
- # This permission set allows users to view all related information about
8
- # products, also from the admin panel, including:
9
- #
10
- # - Products
11
- # - Images
12
- # - Variants
13
- # - Option values
14
- # - Product properties
15
- # - Option types
16
- # - Properties
17
- # - Taxonomies
18
- # - Taxons
19
- class ProductDisplay < PermissionSets::Base
20
- class << self
21
- def privilege
22
- :display
23
- end
24
-
25
- def category
26
- :product
27
- end
28
- end
29
-
30
- def activate!
31
- can [:read, :admin, :edit], Spree::Product
32
- can [:read, :admin], Spree::Image
33
- can [:read, :admin], Spree::Variant
34
- can [:read, :admin], Spree::OptionValue
35
- can [:read, :admin], Spree::ProductProperty
36
- can [:read, :admin], Spree::OptionType
37
- can [:read, :admin], Spree::Property
38
- can [:read, :admin], Spree::Taxonomy
39
- can [:read, :admin], Spree::Taxon
40
- end
41
- end
42
- end
43
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,47 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for product management.
6
- #
7
- # This permission set grants full control over all product and related resources,
8
- # including:
9
- #
10
- # - Products
11
- # - Images
12
- # - Variants
13
- # - Option values
14
- # - Product properties
15
- # - Option types
16
- # - Properties
17
- # - Taxonomies
18
- # - Taxons
19
- # - Classifications
20
- # - Prices
21
- class ProductManagement < PermissionSets::Base
22
- class << self
23
- def privilege
24
- :management
25
- end
26
-
27
- def category
28
- :product
29
- end
30
- end
31
-
32
- def activate!
33
- can :manage, Spree::Classification
34
- can :manage, Spree::Image
35
- can :manage, Spree::OptionType
36
- can :manage, Spree::OptionValue
37
- can :manage, Spree::Price
38
- can :manage, Spree::Product
39
- can :manage, Spree::ProductProperty
40
- can :manage, Spree::Property
41
- can :manage, Spree::Taxon
42
- can :manage, Spree::Taxonomy
43
- can :manage, Spree::Variant
44
- end
45
- end
46
- end
47
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,33 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Read permissions for stock limited to allowed locations.
6
- #
7
- # This permission set allows users to view information about stock items and
8
- # locations, both of them limited to locations they have access to.
9
- # Permissions are also granted for the admin panel for items.
10
- class RestrictedStockDisplay < PermissionSets::Base
11
- class << self
12
- def privilege
13
- :display
14
- end
15
-
16
- def category
17
- :restricted_stock
18
- end
19
- end
20
-
21
- def activate!
22
- can [:read, :admin], Spree::StockItem, stock_location_id: location_ids
23
- can :read, Spree::StockLocation, id: location_ids
24
- end
25
-
26
- private
27
-
28
- def location_ids
29
- @ids ||= user.stock_locations.pluck(:id)
30
- end
31
- end
32
- end
33
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,33 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for stock management limited to allowed locations.
6
- #
7
- # This permission set grants full control over all stock items a user has
8
- # access to their locations. Those locations are also readable by the
9
- # corresponding ability.
10
- class RestrictedStockManagement < PermissionSets::Base
11
- class << self
12
- def privilege
13
- :management
14
- end
15
-
16
- def category
17
- :restricted_stock
18
- end
19
- end
20
-
21
- def activate!
22
- can :manage, Spree::StockItem, stock_location_id: location_ids
23
- can :read, Spree::StockLocation, id: location_ids
24
- end
25
-
26
- private
27
-
28
- def location_ids
29
- @ids ||= user.stock_locations.pluck(:id)
30
- end
31
- end
32
- end
33
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Read-only permissions for stock.
6
- #
7
- # This permission set allows users to view information about stock items
8
- # (also from the admin panel) and stock locations.
9
- class StockDisplay < PermissionSets::Base
10
- class << self
11
- def privilege
12
- :display
13
- end
14
-
15
- def category
16
- :stock
17
- end
18
- end
19
-
20
- def activate!
21
- can [:read, :admin], Spree::StockItem
22
- can :read, Spree::StockLocation
23
- end
24
- end
25
- end
26
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for stock management.
6
- #
7
- # This permission set grants full control over all stock items and read
8
- # access to locations.
9
- class StockManagement < PermissionSets::Base
10
- class << self
11
- def privilege
12
- :management
13
- end
14
-
15
- def category
16
- :stock
17
- end
18
- end
19
-
20
- def activate!
21
- can :manage, Spree::StockItem
22
- can :read, Spree::StockLocation
23
- end
24
- end
25
- end
26
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for store administration.
6
- #
7
- # This permission set is always added to users with the `:admin` role.
8
- #
9
- # It grants permission to perform any read or write action on any resource.
10
- class SuperUser < PermissionSets::Base
11
- class << self
12
- def privilege
13
- :other
14
- end
15
-
16
- def category
17
- :super_user
18
- end
19
- end
20
-
21
- def activate!
22
- can :manage, :all
23
- end
24
- end
25
- end
26
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,27 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Read-only permissions for users, roles and store credits.
6
- #
7
- # This permission set allows users to view all related information about
8
- # users, roles and store credits, also from the admin panel.
9
- class UserDisplay < PermissionSets::Base
10
- class << self
11
- def privilege
12
- :display
13
- end
14
-
15
- def category
16
- :user
17
- end
18
- end
19
-
20
- def activate!
21
- can [:read, :admin, :edit, :addresses, :orders, :items], Spree.user_class
22
- can [:read, :admin], Spree::StoreCredit
23
- can :read, Spree::Role
24
- end
25
- end
26
- end
27
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,44 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Spree
4
- module PermissionSets
5
- # Full permissions for user management.
6
- #
7
- # This permission set grants full control over all user and
8
- # related resources, including:
9
- #
10
- # - Users
11
- # - Store credits
12
- # - Roles
13
- # - API keys
14
- class UserManagement < PermissionSets::Base
15
- class << self
16
- def privilege
17
- :management
18
- end
19
-
20
- def category
21
- :user
22
- end
23
- end
24
-
25
- def activate!
26
- can [:admin, :read, :create, :update, :save_in_address_book, :remove_from_address_book, :addresses, :orders, :items], Spree.user_class
27
-
28
- # Note: This does not work with accessible_by.
29
- # See https://github.com/solidusio/solidus/pull/1263
30
- can :update_email, Spree.user_class do |user|
31
- user.spree_roles.none?
32
- end
33
- can :update_password, Spree.user_class do |user|
34
- user.spree_roles.none?
35
- end
36
-
37
- cannot :destroy, Spree.user_class
38
- can :manage, Spree::StoreCredit
39
- can :manage, :api_key
40
- can :read, Spree::Role
41
- end
42
- end
43
- end
44
- end
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -1,18 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/permission_sets/base'
4
- require 'spree/permission_sets/configuration_display'
5
- require 'spree/permission_sets/configuration_management'
6
- require 'spree/permission_sets/dashboard_display'
7
- require 'spree/permission_sets/default_customer'
8
- require 'spree/permission_sets/order_display'
9
- require 'spree/permission_sets/order_management'
10
- require 'spree/permission_sets/product_display'
11
- require 'spree/permission_sets/product_management'
12
- require 'spree/permission_sets/restricted_stock_display'
13
- require 'spree/permission_sets/restricted_stock_management'
14
- require 'spree/permission_sets/stock_display'
15
- require 'spree/permission_sets/stock_management'
16
- require 'spree/permission_sets/super_user'
17
- require 'spree/permission_sets/user_display'
18
- require 'spree/permission_sets/user_management'
3
+ Spree.deprecator.warn(
4
+ <<~MSG
5
+ The file "#{__FILE__}" does not need to be `require`d any longer, it is now autoloaded.
6
+ MSG
7
+ )
@@ -14,6 +14,7 @@ module Spree
14
14
  :checkout_confirm_attributes,
15
15
  :credit_card_update_attributes,
16
16
  :customer_return_attributes,
17
+ :customer_metadata_attributes,
17
18
  :image_attributes,
18
19
  :inventory_unit_attributes,
19
20
  :line_item_attributes,
@@ -55,21 +56,23 @@ module Spree
55
56
  :stock_location_id, return_items_attributes: [
56
57
  :id, :inventory_unit_id, :return_authorization_id, :returned, :amount,
57
58
  :reception_status_event, :acceptance_status, :exchange_variant_id,
58
- :resellable, :return_reason_id
59
+ :resellable, :return_reason_id, customer_metadata: {}
59
60
  ]
60
61
  ]
61
62
 
63
+ @@customer_metadata_attributes = [customer_metadata: {}]
64
+
62
65
  @@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
63
66
 
64
67
  @@inventory_unit_attributes = [:shipment, :variant_id]
65
68
 
66
- @@line_item_attributes = [:id, :variant_id, :quantity]
69
+ @@line_item_attributes = [:id, :variant_id, :quantity, customer_metadata: {}]
67
70
 
68
71
  @@option_value_attributes = [:name, :presentation]
69
72
 
70
73
  @@option_type_attributes = [:name, :presentation, option_values_attributes: option_value_attributes]
71
74
 
72
- @@payment_attributes = [:amount, :payment_method_id, :payment_method]
75
+ @@payment_attributes = [:amount, :payment_method_id, :payment_method, customer_metadata: {}]
73
76
 
74
77
  @@product_properties_attributes = [:property_name, :value, :position]
75
78
 
@@ -78,16 +81,24 @@ module Spree
78
81
  :meta_keywords, :price, :sku, :deleted_at,
79
82
  :option_values_hash, :weight, :height, :width, :depth,
80
83
  :shipping_category_id, :tax_category_id,
81
- :taxon_ids, :option_type_ids, :cost_currency, :cost_price
84
+ :taxon_ids, :option_type_ids, :cost_currency, :cost_price, :primary_taxon_id,
85
+ :gtin, :condition
82
86
  ]
83
87
 
84
88
  @@property_attributes = [:name, :presentation]
85
89
 
86
- @@return_authorization_attributes = [:memo, :stock_location_id, :return_reason_id, return_items_attributes: [:inventory_unit_id, :exchange_variant_id, :return_reason_id, :preferred_reimbursement_type_id]]
90
+ @@return_authorization_attributes = [:memo, :stock_location_id, :return_reason_id,
91
+ customer_metadata: {},
92
+ return_items_attributes: [
93
+ :inventory_unit_id,
94
+ :exchange_variant_id,
95
+ :return_reason_id,
96
+ :preferred_reimbursement_type_id
97
+ ]]
87
98
 
88
99
  @@shipment_attributes = [
89
100
  :special_instructions, :stock_location_id, :id, :tracking,
90
- :selected_shipping_rate_id
101
+ :selected_shipping_rate_id, customer_metadata: {}
91
102
  ]
92
103
 
93
104
  # month / year may be provided by some sources, or others may elect to use one field
@@ -126,7 +137,7 @@ module Spree
126
137
  # by changing a user with higher priveleges' email to one a lower-priveleged
127
138
  # admin owns. Creating a user with an email is handled separate at the
128
139
  # controller level.
129
- @@user_attributes = [:password, :password_confirmation]
140
+ @@user_attributes = [:password, :password_confirmation, customer_metadata: {}]
130
141
 
131
142
  @@variant_attributes = [
132
143
  :name, :presentation, :cost_price, :lock_version,
@@ -173,6 +173,10 @@ module Spree::Preferences
173
173
  class_name = class_name.constantize if class_name.is_a?(String)
174
174
  class_name
175
175
  end
176
+
177
+ define_method("#{name}_name") do
178
+ instance_variable_get(ivar) || default
179
+ end
176
180
  end
177
181
 
178
182
  def self.by_version(*args)
@@ -8,7 +8,7 @@ module Spree
8
8
  included do
9
9
  include Spree::Preferences::Preferable
10
10
 
11
- if method(:serialize).parameters.include?([:key, :type]) # Rails 7.1+
11
+ if Rails.gem_version >= Gem::Version.new('7.1')
12
12
  serialize :preferences, type: Hash, coder: YAML
13
13
  else
14
14
  serialize :preferences, Hash, coder: YAML
@@ -110,6 +110,16 @@ module Spree
110
110
  # find the original.
111
111
  find('label:not(.select2-offscreen)', text: /#{Regexp.escape(text)}/i, match: :one)
112
112
  end
113
+
114
+ def dialog(parent: 'body', **options)
115
+ within(parent) do
116
+ find('dialog', visible: :all, **options)
117
+ end
118
+ end
119
+
120
+ def turbo_frame_modal
121
+ dialog(parent: find('turbo-frame', visible: :all))
122
+ end
113
123
  end
114
124
  end
115
125
  end
@@ -80,7 +80,7 @@ module DummyApp
80
80
  config.action_dispatch.show_exceptions = false
81
81
  end
82
82
  config.consider_all_requests_local = true
83
- config.active_support.deprecation = :stderr
83
+ config.active_support.deprecation = ENV['RAILS_DEPRECATIONS_BEHAVIOR'].presence&.to_sym || :stderr
84
84
  config.log_level = :debug
85
85
 
86
86
  # Improve test suite performance:
@@ -43,7 +43,15 @@ FactoryBot.define do
43
43
  evaluator.stock_location # must evaluate before creating line items
44
44
 
45
45
  evaluator.line_items_attributes.each do |attributes|
46
- attributes = { order:, price: evaluator.line_items_price }.merge(attributes)
46
+ attributes = { order:, price: evaluator.line_items_price }.merge(attributes).tap do |attrs|
47
+ tax_category = attributes.delete(:tax_category)
48
+ if attrs[:variant] && tax_category
49
+ attrs[:variant].update(tax_category: )
50
+ elsif tax_category
51
+ attrs[:variant] = create(:variant, tax_category: )
52
+ end
53
+ end
54
+
47
55
  create(:line_item, attributes)
48
56
  end
49
57
  order.line_items.reload
data/solidus_core.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  actionmailer actionpack actionview activejob activemodel activerecord
28
28
  activestorage activesupport railties
29
29
  ].each do |rails_dep|
30
- s.add_dependency rails_dep, ['>= 7.0', '< 8.0.0.beta1']
30
+ s.add_dependency rails_dep, ['>= 7.0', '< 8.1.0.beta1']
31
31
  end
32
32
 
33
33
  s.add_dependency 'activemerchant', '~> 1.66'