solidus_core 2.6.6 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 0b9d1c95266b86c40ea5b48169a7ed167f400f73705eca32692e9e8e7fe9f2f7
4
- data.tar.gz: 97a277fb97d84e1d4fb27eea25326c3132d7218ecd8f8d03a8358fbe217530a1
2
+ SHA1:
3
+ metadata.gz: eb1818adf868e3d8d1e880f8f6b50c544b9d6a8d
4
+ data.tar.gz: ef14156407da2c1e067a74e718cfe96ca9843380
5
5
  SHA512:
6
- metadata.gz: 65795d1ede7bf14be214725f161c0ab4f834cc91bc6444c06125950aebb590465ef4dbb19bdf63eca297f3241e520beeddea614f754784c70a3372fbcf7a52a2
7
- data.tar.gz: 9fff27c8dd410fcd86c79e3ca80ccbc4b620d34030476bf3032e2fc8148bc8d5119a96f0be37e47137f231035de01ba3864bc1f0289a6b46d548019d330fe4c9
6
+ metadata.gz: fa66bde468ab5d0a0225f3de3e85ec8753abbded64ec884bf2fc49262dc08c122b700c60bcd19cd311506db616bd08cd2aeaee693a6e333462de7d7e6869aa82
7
+ data.tar.gz: 79750dd5214ba7c407f03d736bd5e1f537a69efaee2ba00465758a949f80f4e021fedeec4963cddf65883e65623a71bfcb426104191a906aa74a0da4cedd7251
@@ -7,12 +7,12 @@ module Spree
7
7
  # to show the most popular products for a particular taxon (that is an exercise left to the developer.)
8
8
  def taxon_preview(taxon, max = 4)
9
9
  price_scope = Spree::Price.where(current_pricing_options.search_arguments)
10
- products = taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT spree_products.*, spree_products_taxons.position").limit(max)
10
+ products = taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").limit(max)
11
11
  if products.size < max
12
12
  products_arel = Spree::Product.arel_table
13
13
  taxon.descendants.each do |descendent_taxon|
14
14
  to_get = max - products.length
15
- products += descendent_taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT spree_products.*, spree_products_taxons.position").where(products_arel[:id].not_in(products.map(&:id))).limit(to_get)
15
+ products += descendent_taxon.active_products.joins(:prices).merge(price_scope).select("DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position").where(products_arel[:id].not_in(products.map(&:id))).limit(to_get)
16
16
  break if products.size >= max
17
17
  end
18
18
  end
@@ -10,13 +10,13 @@ module Spree
10
10
  ).build_promotion_codes
11
11
 
12
12
  if promotion_code_batch.email?
13
- Spree::PromotionCodeBatchMailer
13
+ Spree::Config.promotion_code_batch_mailer_class
14
14
  .promotion_code_batch_finished(promotion_code_batch)
15
15
  .deliver_now
16
16
  end
17
17
  rescue StandardError => e
18
18
  if promotion_code_batch.email?
19
- Spree::PromotionCodeBatchMailer
19
+ Spree::Config.promotion_code_batch_mailer_class
20
20
  .promotion_code_batch_errored(promotion_code_batch)
21
21
  .deliver_now
22
22
  end
@@ -448,7 +448,7 @@ module Spree
448
448
  end
449
449
 
450
450
  def deliver_order_confirmation_email
451
- Spree::OrderMailer.confirm_email(self).deliver_later
451
+ Spree::Config.order_mailer_class.confirm_email(self).deliver_later
452
452
  update_column(:confirmation_delivered, true)
453
453
  end
454
454
 
@@ -552,7 +552,6 @@ module Spree
552
552
  Spree::PromotionHandler::Shipping.new(self).activate
553
553
  recalculate
554
554
  end
555
- alias_method :apply_free_shipping_promotions, :apply_shipping_promotions
556
555
  deprecate apply_free_shipping_promotions: :apply_shipping_promotions, deprecator: Spree::Deprecation
557
556
 
558
557
  # Clean shipments and make order back to address state
@@ -890,7 +889,7 @@ module Spree
890
889
  end
891
890
 
892
891
  def send_cancel_email
893
- Spree::OrderMailer.cancel_email(self).deliver_later
892
+ Spree::Config.order_mailer_class.cancel_email(self).deliver_later
894
893
  end
895
894
 
896
895
  def after_resume
@@ -40,7 +40,7 @@ class Spree::OrderCancellations
40
40
  end
41
41
 
42
42
  update_shipped_shipments(inventory_units)
43
- Spree::OrderMailer.inventory_cancellation_email(@order, inventory_units.to_a).deliver_later if Spree::OrderCancellations.send_cancellation_mailer
43
+ Spree::Config.order_mailer_class.inventory_cancellation_email(@order, inventory_units.to_a).deliver_later if Spree::OrderCancellations.send_cancellation_mailer
44
44
  end
45
45
 
46
46
  @order.recalculate
@@ -26,7 +26,7 @@ module Spree
26
26
  validates :currency, inclusion: { in: ::Money::Currency.all.map(&:iso_code), message: :invalid_code }
27
27
  validates :country, presence: true, unless: -> { for_any_country? }
28
28
 
29
- scope :currently_valid, -> { order(Arel.sql("country_iso IS NULL, updated_at DESC, id DESC")) }
29
+ scope :currently_valid, -> { order(Arel.sql("country_iso IS NULL")).order(updated_at: :DESC, id: :DESC) }
30
30
  scope :for_master, -> { joins(:variant).where(spree_variants: { is_master: true }) }
31
31
  scope :for_variant, -> { joins(:variant).where(spree_variants: { is_master: false }) }
32
32
  scope :for_any_country, -> { where(country: nil) }
@@ -63,10 +63,9 @@ module Spree
63
63
  #
64
64
  # SELECT COUNT(*) ...
65
65
  add_search_scope :in_taxon do |taxon|
66
- includes(:classifications)
67
- .where('spree_products_taxons.taxon_id' => taxon.self_and_descendants.pluck(:id))
68
- .select(Spree::Classification.arel_table[:position])
69
- .order(Spree::Classification.arel_table[:position].asc)
66
+ includes(:classifications).
67
+ where("spree_products_taxons.taxon_id" => taxon.self_and_descendants.pluck(:id)).
68
+ order(Spree::Classification.arel_table[:position].asc)
70
69
  end
71
70
 
72
71
  # This scope selects products in all taxons AND all its descendants
@@ -162,7 +162,7 @@ module Spree
162
162
  end
163
163
 
164
164
  def send_reimbursement_email
165
- Spree::ReimbursementMailer.reimbursement_email(id).deliver_later
165
+ Spree::Config.reimbursement_mailer_class.reimbursement_email(id).deliver_later
166
166
  end
167
167
 
168
168
  # If there are multiple different reimbursement types for a single
@@ -28,7 +28,7 @@ module Spree
28
28
  scope :by_url, lambda { |url| where("url like ?", "%#{url}%") }
29
29
 
30
30
  class << self
31
- deprecate by_url: "Spree::Store.by_url is DEPRECATED", deprecator: Spree::Deprecation
31
+ deprecate :by_url, "Spree::Store.by_url is DEPRECATED", deprecator: Spree::Deprecation
32
32
  end
33
33
 
34
34
  def available_locales
@@ -4,7 +4,7 @@ module Spree
4
4
  # Configuration point for User model implementation.
5
5
  #
6
6
  # `Spree::UserClassHandle` allows you to configure your own implementation of a
7
- # User class or use an extnesion like `solidus_auth_devise`.
7
+ # User class or use an extension like `solidus_auth_devise`.
8
8
  #
9
9
  # @note Placeholder for name of Spree.user_class to ensure later evaluation at
10
10
  # runtime.
@@ -177,7 +177,6 @@ en:
177
177
  spree/product_property:
178
178
  value: Value
179
179
  spree/promotion:
180
- advertise: Advertise
181
180
  apply_automatically: Apply Automatically
182
181
  code: Code
183
182
  description: Description
@@ -185,7 +184,7 @@ en:
185
184
  expires_at: End
186
185
  name: Name
187
186
  path: Path
188
- per_code_usage_limit: Per Code Usage Limit
187
+ per_code_usage_limit: Per code usage limit
189
188
  promotion_uses: Promotion Uses
190
189
  starts_at: Start
191
190
  status: Status
@@ -859,7 +858,6 @@ en:
859
858
  activations_new:
860
859
  auto: Apply to all orders
861
860
  multiple_codes: Multiple promotion codes
862
- path: URL Path
863
861
  single_code: Single promotion code
864
862
  activations_edit:
865
863
  auto: All orders will attempt to use this promotion
@@ -1791,6 +1789,7 @@ en:
1791
1789
  authorized: Authorized
1792
1790
  canceled: Canceled
1793
1791
  return_authorizations: Return Merchandise Authorizations
1792
+ return_authorization_fire_error: Cannot perform this action on return merchandise authorization
1794
1793
  return_authorization_updated: Return merchandise authorization updated
1795
1794
  return_item_inventory_unit_ineligible: Return item's inventory unit must be shipped
1796
1795
  return_item_inventory_unit_reimbursed: Return item's inventory unit is already reimbursed
@@ -307,6 +307,32 @@ module Spree
307
307
  # @api experimental
308
308
  class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'
309
309
 
310
+ # Allows providing your own Mailer for order mailer.
311
+ #
312
+ # @!attribute [rw] order_mailer_class
313
+ # @return [ActionMailer::Base] an object that responds to "confirm_email",
314
+ # "cancel_email" and "inventory_cancellation_email"
315
+ # (e.g. an ActionMailer with a "confirm_email" method) with the same
316
+ # signature as Spree::OrderMailer.confirm_email.
317
+ class_name_attribute :order_mailer_class, default: 'Spree::OrderMailer'
318
+
319
+ # Allows providing your own Mailer for promotion code batch mailer.
320
+ #
321
+ # @!attribute [rw] promotion_code_batch_mailer_class
322
+ # @return [ActionMailer::Base] an object that responds to "promotion_code_batch_finished",
323
+ # and "promotion_code_batch_errored"
324
+ # (e.g. an ActionMailer with a "promotion_code_batch_finished" method) with the same
325
+ # signature as Spree::PromotionCodeBatchMailer.promotion_code_batch_finished.
326
+ class_name_attribute :promotion_code_batch_mailer_class, default: 'Spree::PromotionCodeBatchMailer'
327
+
328
+ # Allows providing your own Mailer for reimbursement mailer.
329
+ #
330
+ # @!attribute [rw] reimbursement_mailer_class
331
+ # @return [ActionMailer::Base] an object that responds to "reimbursement_email"
332
+ # (e.g. an ActionMailer with a "reimbursement_email" method) with the same
333
+ # signature as Spree::ReimbursementMailer.reimbursement_email.
334
+ class_name_attribute :reimbursement_mailer_class, default: 'Spree::ReimbursementMailer'
335
+
310
336
  # Allows providing your own Mailer for shipped cartons.
311
337
  #
312
338
  # @!attribute [rw] carton_shipped_email_class
@@ -20,8 +20,8 @@ module Spree
20
20
 
21
21
  shipments_attrs = params.delete(:shipments_attributes)
22
22
 
23
- create_shipments_from_params(shipments_attrs, order)
24
23
  create_line_items_from_params(params.delete(:line_items_attributes), order)
24
+ create_shipments_from_params(shipments_attrs, order)
25
25
  create_adjustments_from_params(params.delete(:adjustments_attributes), order)
26
26
  create_payments_from_params(params.delete(:payments_attributes), order)
27
27
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Spree
4
4
  def self.solidus_version
5
- "2.6.6"
5
+ "2.7.0"
6
6
  end
7
7
 
8
8
  def self.solidus_gem_version
@@ -6,19 +6,19 @@ module Spree
6
6
  def confirm
7
7
  order = Order.complete.last
8
8
  raise "Your database needs at least one completed order to render this preview" unless order
9
- OrderMailer.confirm_email(order)
9
+ Spree::Config.order_mailer_class.confirm_email(order)
10
10
  end
11
11
 
12
12
  def cancel
13
13
  order = Order.with_state(:canceled).last
14
14
  raise "Your database needs at least one cancelled order to render this preview" unless order
15
- OrderMailer.cancel_email(order)
15
+ Spree::Config.order_mailer_class.cancel_email(order)
16
16
  end
17
17
 
18
18
  def inventory_cancellation
19
19
  order = Spree::Order.joins(:inventory_units).merge(Spree::InventoryUnit.canceled).last
20
20
  raise "Your database needs at least one order with a canceled inventory unit to render this preview" unless order
21
- OrderMailer.inventory_cancellation_email(order, [order.inventory_units.first])
21
+ Spree::Config.order_mailer_class.inventory_cancellation_email(order, [order.inventory_units.first])
22
22
  end
23
23
  end
24
24
  end
@@ -6,7 +6,7 @@ module Spree
6
6
  def reimbursement
7
7
  reimbursement = Reimbursement.last
8
8
  raise "Your database needs at least one Reimbursement to render this preview" unless reimbursement
9
- ReimbursementMailer.reimbursement_email(reimbursement)
9
+ Spree::Config.reimbursement_mailer_class.reimbursement_email(reimbursement)
10
10
  end
11
11
  end
12
12
  end
@@ -11,6 +11,9 @@ module Spree
11
11
  can [:read, :update], Order do |order, token|
12
12
  order.user == user || (order.guest_token.present? && token == order.guest_token)
13
13
  end
14
+ cannot :update, Order do |order|
15
+ order.completed?
16
+ end
14
17
  can :create, ReturnAuthorization do |return_authorization|
15
18
  return_authorization.order.user == user
16
19
  end
@@ -360,6 +360,31 @@ module Spree
360
360
  expect(order.shipment_total.to_f).to eq 4.99
361
361
  end
362
362
  end
363
+
364
+ context "when line items and shipments are present" do
365
+ let(:params) do
366
+ {
367
+ completed_at: 2.days.ago,
368
+ line_items_attributes: line_items,
369
+ shipments_attributes: [
370
+ {
371
+ tracking: '123456789',
372
+ cost: '4.99',
373
+ shipped_at: 1.day.ago,
374
+ shipping_method: shipping_method.name,
375
+ stock_location: stock_location.name,
376
+ inventory_units: [{ sku: sku }]
377
+ }
378
+ ]
379
+ }
380
+ end
381
+
382
+ it 'builds quantities properly' do
383
+ order = Importer::Order.import(user, params)
384
+ line_item = order.line_items.first
385
+ expect(line_item.quantity).to eq(5)
386
+ end
387
+ end
363
388
  end
364
389
 
365
390
  it 'adds adjustments' do
@@ -235,7 +235,7 @@ RSpec.describe Spree::StoreCreditEvent do
235
235
  end
236
236
 
237
237
  describe "#display_event_date" do
238
- let(:date) { Time.parse("2014-06-01") }
238
+ let(:date) { Time.zone.parse("2014-06-01") }
239
239
 
240
240
  subject { create(:store_credit_auth_event, created_at: date) }
241
241
 
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: 2.6.6
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -1194,7 +1194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1194
1194
  - !ruby/object:Gem::Version
1195
1195
  version: 1.8.23
1196
1196
  requirements: []
1197
- rubygems_version: 3.0.6
1197
+ rubyforge_project:
1198
+ rubygems_version: 2.6.10
1198
1199
  signing_key:
1199
1200
  specification_version: 4
1200
1201
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.