solidus_core 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 924090a77efc768ede5475d819872ed30b02cb7990e87d3fdd5877b58b8e7fac
4
- data.tar.gz: 1eeee8182a6f5ade835a347711a9c74b3b29e201bfe93c7fef7c710e6b62b6a1
3
+ metadata.gz: 765367a8eed914a5abca0f078c5ffd7d3e341c504e10311e952d466e10027c32
4
+ data.tar.gz: '08f36210b6b9bbf66d82c5e4bf6fa161c9f1552c003c693d5afd732065c16abc'
5
5
  SHA512:
6
- metadata.gz: 8b6f4995130898a6874b22b97d390b89fa51be305b0d2fcd223c2ee8db2263a30ff599e5109e6eb2e58da33ef2c9014a7f8c980764914d30325997bddc36759d
7
- data.tar.gz: eaba68996368d1569f7e76c348c2126eeedc0fb29cf0378056d6f9e340e0937004661f7a0994284db40e38e5234174d34552700b2a57806fd713fc436dae1938
6
+ metadata.gz: 9b1189c36bd365b71dd7fe4e8ed68402db4c32d1e87ea2571b9c8ae0669ce68a1ffb8a06ec195ccdd06791d942847a10db93248bd71b324d853e724f0b0b7e16
7
+ data.tar.gz: f82f01282ead4f27433e352fb2f7d793187e7efa573fdf9627c37412e944afb312e4d4ef28d4dd550111aa215c0baa47632d9152f09baa1505c2a31186e13e4a
@@ -30,7 +30,9 @@ module Spree
30
30
  size = style_to_size(style)
31
31
  @attachment.variant(
32
32
  resize_to_limit: size,
33
- strip: true
33
+ saver: {
34
+ strip: true
35
+ }
34
36
  ).processed
35
37
  end
36
38
 
@@ -58,7 +60,7 @@ module Spree
58
60
  end
59
61
 
60
62
  def normalize_styles(styles)
61
- styles.transform_values { |v| v.split('x') }
63
+ styles.transform_values { |v| v.split('x').map(&:to_i) }
62
64
  end
63
65
 
64
66
  def style_to_size(style)
@@ -62,18 +62,15 @@ class Spree::OrderShipping
62
62
  end
63
63
 
64
64
  inventory_units.map(&:shipment).uniq.each do |shipment|
65
- # Temporarily propagate the tracking number to the shipment as well
66
- # TODO: Remove tracking numbers from shipments.
67
- shipment.update!(tracking: tracking_number)
68
-
69
- next unless shipment.inventory_units.reload.all? { |iu| iu.shipped? || iu.canceled? }
70
- # TODO: make OrderShipping#ship_shipment call Shipment#ship! rather than
71
- # having Shipment#ship! call OrderShipping#ship_shipment. We only really
72
- # need this `update_columns` for the specs, until we make that change.
73
- shipment.update_columns(state: 'shipped', shipped_at: Time.current)
65
+ if shipment.inventory_units.reload.all? { |iu| iu.shipped? || iu.canceled? }
66
+ shipment.update!(state: "shipped", shipped_at: Time.current, tracking: tracking_number)
67
+ else
68
+ shipment.update!(tracking: tracking_number)
69
+ end
74
70
  end
75
71
 
76
72
  send_shipment_emails(carton) if stock_location.fulfillable? && !suppress_mailer # e.g. digital gift cards that aren't actually shipped
73
+ @order.shipments.reload
77
74
  @order.recalculate
78
75
 
79
76
  carton
@@ -45,6 +45,7 @@ module Spree
45
45
 
46
46
  has_many :variants,
47
47
  -> { where(is_master: false).order(:position) },
48
+ inverse_of: :product,
48
49
  class_name: 'Spree::Variant'
49
50
 
50
51
  has_many :variants_including_master,
@@ -5,12 +5,12 @@ class Spree::PromotionCode < Spree::Base
5
5
  belongs_to :promotion_code_batch, class_name: "Spree::PromotionCodeBatch", optional: true
6
6
  has_many :adjustments
7
7
 
8
+ before_validation :normalize_code
9
+
8
10
  validates :value, presence: true, uniqueness: { allow_blank: true, case_sensitive: true }
9
11
  validates :promotion, presence: true
10
12
  validate :promotion_not_apply_automatically, on: :create
11
13
 
12
- before_save :normalize_code
13
-
14
14
  self.whitelisted_ransackable_attributes = ['value']
15
15
 
16
16
  # Whether the promotion code has exceeded its usage restrictions
@@ -31,6 +31,14 @@ module Spree
31
31
  end
32
32
  end
33
33
 
34
+ # Sets this price's amount to a new value, parsing it if the new value is
35
+ # a string.
36
+ #
37
+ # @param price [String, #to_d] a new amount
38
+ def amount=(price)
39
+ self[:amount] = Spree::LocalizedNumber.parse(price)
40
+ end
41
+
34
42
  def description
35
43
  payment.payment_method.name
36
44
  end
@@ -40,6 +40,14 @@ class Spree::StoreCredit < Spree::PaymentSource
40
40
  extend Spree::DisplayMoney
41
41
  money_methods :amount, :amount_used, :amount_authorized
42
42
 
43
+ # Sets this store credit's amount to a new value,
44
+ # parsing it as a localized number if the new value is a string.
45
+ #
46
+ # @param number [String, #to_d] a new amount
47
+ def amount=(number)
48
+ self[:amount] = Spree::LocalizedNumber.parse(number)
49
+ end
50
+
43
51
  def amount_remaining
44
52
  return 0.0.to_d if invalidated?
45
53
  amount - amount_used - amount_authorized
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "3.1.5"
4
+ VERSION = "3.1.6"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
@@ -96,6 +96,7 @@ module DummyApp
96
96
  }
97
97
  }
98
98
  config.active_storage.service = :test
99
+ config.active_storage.variant_processor = ENV.fetch('ACTIVE_STORAGE_VARIANT_PROCESSOR', :mini_magick).to_sym
99
100
  end
100
101
  end
101
102
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.5
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-20 00:00:00.000000000 Z
11
+ date: 2022-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -954,7 +954,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
954
954
  - !ruby/object:Gem::Version
955
955
  version: 1.8.23
956
956
  requirements: []
957
- rubygems_version: 3.1.2
957
+ rubygems_version: 3.2.31
958
958
  signing_key:
959
959
  specification_version: 4
960
960
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.