solidus_promotions 4.6.3 → 4.6.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f0d673a8fd62d82e0efd7cf970a65d91e580c234933414e8a21e9f7d4e94851
4
- data.tar.gz: fafb075b7983e18e6b026a06f17873d835e8218d79a3304d988d010d846208bb
3
+ metadata.gz: fd3c69859107feca6becf3bc1749cd8643b5ad2ae8f299938f788c3aaa2d0700
4
+ data.tar.gz: 652083d2d5f614adc091d5939943309d277a31316bddebf0e55642b9dc52ad90
5
5
  SHA512:
6
- metadata.gz: 245250786e0a04e6137ffbedd7f21b36447b19974c0f636ca1f6d19ce13763505adb5c802f456c0db4fbfaa1cb60a8fc84722e668c32a8c0bec579370cadd245
7
- data.tar.gz: e22b24de21453c50f17eb794a530da1bb361883f6597a86c5fdfcc78f9ea3530522f267a7c62f8493316b91231f5f82438d729b1285d3f8c50b576eeb4164eb4
6
+ metadata.gz: 803178ee5a8e3830b07b8d6521e936f20f28ec2ce5630af05f456140c97970e1e2cfdcceff0dac17b7f35faeda43528463c6929854b85575f67fc988d4428239
7
+ data.tar.gz: 81e15dc5e098cf775cfff74898983d5006acc4b165c8d5496abd6098c2ea999def63287c56a43df46d476f7052d2e9b9887ff6b31a7dd1b41ffe7fe4c0665c2a
@@ -12,7 +12,13 @@ module SolidusPromotions
12
12
  before_destroy :remove_adjustments_from_incomplete_orders
13
13
  before_destroy :raise_for_adjustments_for_completed_orders
14
14
 
15
- belongs_to :promotion, inverse_of: :benefits
15
+ # @!attribute [rw] promotion
16
+ # The owning promotion.
17
+ # @return [SolidusPromotions::Promotion]
18
+ belongs_to :promotion, -> { with_discarded }, inverse_of: :benefits
19
+ # @!attribute [rw] original_promotion_action
20
+ # Back-reference to the original Solidus (Spree) promotion action, when migrated.
21
+ # @return [Spree::PromotionAction, nil]
16
22
  belongs_to :original_promotion_action, class_name: "Spree::PromotionAction", optional: true
17
23
  has_many :adjustments, class_name: "Spree::Adjustment", as: :source, dependent: :restrict_with_error
18
24
  has_many :shipping_rate_discounts, class_name: "SolidusPromotions::ShippingRateDiscount", inverse_of: :benefit, dependent: :restrict_with_error
@@ -12,7 +12,7 @@ module SolidusPromotions
12
12
  optional: true,
13
13
  inverse_of: :promotions
14
14
  belongs_to :original_promotion, class_name: "Spree::Promotion", optional: true
15
- has_many :benefits, class_name: "SolidusPromotions::Benefit", dependent: :destroy
15
+ has_many :benefits, class_name: "SolidusPromotions::Benefit", dependent: :destroy, inverse_of: :promotion
16
16
  has_many :conditions, through: :benefits
17
17
  has_many :codes, class_name: "SolidusPromotions::PromotionCode", dependent: :destroy, inverse_of: :promotion
18
18
  has_many :code_batches, class_name: "SolidusPromotions::PromotionCodeBatch", dependent: :destroy
@@ -171,6 +171,7 @@ module SolidusPromotions
171
171
 
172
172
  def delete_cart_connections
173
173
  order_promotions.where(order: Spree::Order.incomplete).destroy_all
174
+ benefits.each(&:remove_adjustments_from_incomplete_orders)
174
175
  end
175
176
  end
176
177
  end
@@ -5,6 +5,10 @@ module SolidusPromotions
5
5
  class PromotionCategoriesController < BaseController
6
6
  private
7
7
 
8
+ def permitted_resource_params
9
+ params.require(:promotion_category).permit(:name, :code)
10
+ end
11
+
8
12
  def model_class
9
13
  SolidusPromotions::PromotionCategory
10
14
  end
@@ -22,6 +22,10 @@ module SolidusPromotions
22
22
 
23
23
  private
24
24
 
25
+ def permitted_resource_params
26
+ params.require(:promotion_code_batch).permit(:base_code, :number_of_codes, :join_characters, :email)
27
+ end
28
+
25
29
  def build_promotion_code_batch
26
30
  @promotion_code_batch.process
27
31
  end
@@ -29,6 +29,13 @@ module SolidusPromotions
29
29
 
30
30
  private
31
31
 
32
+ def permitted_resource_params
33
+ params.require(:promotion).permit(
34
+ :name, :customer_label, :description, :promotion_category_id, :usage_limit,
35
+ :per_code_usage_limit, :starts_at, :expires_at, :lane, :apply_automatically, :path
36
+ )
37
+ end
38
+
32
39
  def collection
33
40
  return @collection if @collection
34
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.3
4
+ version: 4.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff