spree_emails 6.0.5 → 6.0.6
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 +4 -4
- data/app/serializers/spree/emails/parcel_item_serializer.rb +5 -5
- data/app/serializers/spree/emails/purchased_item_attributes.rb +5 -5
- data/app/serializers/spree/emails/return_serializer.rb +2 -2
- data/app/serializers/spree/emails/returned_item_serializer.rb +45 -0
- data/app/views/spree/shared/_purchase_totals.liquid +5 -0
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '03793027bd9682486e7870b3e1ae9c471a26f09d3849e7c9b66443686f9efdac'
|
|
4
|
+
data.tar.gz: 6fde2f62c536ecf8b5ed607375c013c42ec7b6a283a25a85a988a87efe8beefe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a70da88c13f2d9d9c2f2b0ae23b875650023f52224a341b5013d2e97950904d33bce0d4e30055578056add3f0cb5876c2310eb0cae4dfd919e341e35274d153a
|
|
7
|
+
data.tar.gz: ea442d88e5e50a55481c6762456a46db2c1f50d9fde78443d265d447f843f9661365f22afa07de6b58d73a888b1161ec9729cd514ec205a9198410d6cdee707e
|
|
@@ -11,25 +11,25 @@ module Spree
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
attribute :name do |item|
|
|
14
|
-
item.
|
|
14
|
+
purchased_variant(item).name
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
attributes :quantity
|
|
18
18
|
|
|
19
19
|
attribute :sku do |item|
|
|
20
|
-
item.
|
|
20
|
+
purchased_variant(item).sku
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
attribute :options_text do |item|
|
|
24
|
-
item.
|
|
24
|
+
purchased_variant(item).options_text
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
attribute :price do |item|
|
|
28
|
-
Spree::Money::Rounding.format(item.
|
|
28
|
+
Spree::Money::Rounding.format(item.price, item.line_item.currency, unit_price: true)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
attribute :amount do |item|
|
|
32
|
-
Spree::Money::Rounding.format(item.
|
|
32
|
+
Spree::Money::Rounding.format(item.price * item.quantity, item.line_item.currency)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -2,26 +2,26 @@ module Spree
|
|
|
2
2
|
module Emails
|
|
3
3
|
# What an email shows for a purchased line besides its Store API fields: a
|
|
4
4
|
# link to the product on the storefront and a thumbnail. Shared by the line
|
|
5
|
-
# item and
|
|
5
|
+
# item, parcel item and returned item serializers.
|
|
6
6
|
module PurchasedItemAttributes
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
8
|
include Spree::ImagesHelper
|
|
9
9
|
|
|
10
10
|
included do
|
|
11
11
|
attribute :url do |item|
|
|
12
|
-
product =
|
|
12
|
+
product = purchased_variant(item).product
|
|
13
13
|
"#{params[:storefront_url]}/products/#{product.slug}" if product
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
attribute :image_url do |item|
|
|
17
|
-
spree_image_url(
|
|
17
|
+
spree_image_url(purchased_variant(item).thumbnail, variant: :small)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
-
def
|
|
24
|
-
item.
|
|
23
|
+
def purchased_variant(item)
|
|
24
|
+
item.variant || item.line_item.variant
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -14,8 +14,8 @@ module Spree
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
many :returned_items,
|
|
17
|
-
source: proc { return_line_items.
|
|
18
|
-
resource: Spree::Emails::
|
|
17
|
+
source: proc { return_line_items.select { |item| item.line_item && item.credited_quantity.positive? } },
|
|
18
|
+
resource: Spree::Emails::ReturnedItemSerializer
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Emails
|
|
3
|
+
# One returned line as it was credited. A customer who bought three and
|
|
4
|
+
# sent one must see one, so the quantity and amount are this return's share
|
|
5
|
+
# of what they paid, rather than the whole line's catalog total.
|
|
6
|
+
class ReturnedItemSerializer < Spree::Emails::BaseSerializer
|
|
7
|
+
include Typelizer::DSL
|
|
8
|
+
include Spree::Emails::PurchasedItemAttributes
|
|
9
|
+
|
|
10
|
+
typelize id: :string, name: :string, quantity: :number, sku: [:string, nullable: true],
|
|
11
|
+
options_text: [:string, nullable: true], price: :string, amount: :string,
|
|
12
|
+
url: [:string, nullable: true], image_url: [:string, nullable: true]
|
|
13
|
+
|
|
14
|
+
attribute :id do |item|
|
|
15
|
+
item.line_item.prefixed_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attribute :name do |item|
|
|
19
|
+
item.line_item.name
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attribute :quantity, &:credited_quantity
|
|
23
|
+
|
|
24
|
+
attribute :sku do |item|
|
|
25
|
+
item.line_item.sku
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
attribute :options_text do |item|
|
|
29
|
+
item.line_item.options_text
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
attribute :price do |item|
|
|
33
|
+
Spree::Money::Rounding.format(
|
|
34
|
+
item.credited_worth / item.credited_quantity,
|
|
35
|
+
item.currency,
|
|
36
|
+
unit_price: true
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
attribute :amount do |item|
|
|
41
|
+
Spree::Money::Rounding.format(item.credited_worth, item.currency)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
{%- endcomment -%}
|
|
4
4
|
{%- assign tax_total = purchase.additional_tax_total | plus: 0 -%}
|
|
5
5
|
{%- assign gift_card_total = purchase.gift_card_total | plus: 0 -%}
|
|
6
|
+
{%- assign store_credit_total = purchase.store_credit_total | plus: 0 -%}
|
|
6
7
|
<mj-table css-class="summary" padding="16px 0 0">
|
|
7
8
|
{%- assign value = purchase.item_total | money -%}
|
|
8
9
|
{% render 'spree/shared/summary_row', label: 'order_mailer.subtotal', translate: true, value: value %}
|
|
@@ -22,6 +23,10 @@
|
|
|
22
23
|
{%- assign gift_card_value = purchase.gift_card_total | money | prepend: '-' -%}
|
|
23
24
|
{% render 'spree/shared/summary_row', label: 'gift_card', translate: true, value: gift_card_value %}
|
|
24
25
|
{%- endif -%}
|
|
26
|
+
{%- if store_credit_total > 0 -%}
|
|
27
|
+
{%- assign store_credit_value = purchase.store_credit_total | money | prepend: '-' -%}
|
|
28
|
+
{% render 'spree/shared/summary_row', label: 'store_credit_name', translate: true, value: store_credit_value %}
|
|
29
|
+
{%- endif -%}
|
|
25
30
|
{%- for line in purchase.manual_discounts -%}
|
|
26
31
|
{%- assign value = line.amount | money -%}
|
|
27
32
|
{% render 'spree/shared/summary_row', label: line.label, value: value %}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_emails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-11-
|
|
13
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: spree
|
|
@@ -18,14 +18,14 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - '='
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 6.0.
|
|
21
|
+
version: 6.0.6
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
26
|
- - '='
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: 6.0.
|
|
28
|
+
version: 6.0.6
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: email_spec
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,6 +86,7 @@ files:
|
|
|
86
86
|
- app/serializers/spree/emails/purchase_summary_attributes.rb
|
|
87
87
|
- app/serializers/spree/emails/purchased_item_attributes.rb
|
|
88
88
|
- app/serializers/spree/emails/return_serializer.rb
|
|
89
|
+
- app/serializers/spree/emails/returned_item_serializer.rb
|
|
89
90
|
- app/serializers/spree/emails/stock_location_serializer.rb
|
|
90
91
|
- app/services/spree/emails/samples/base.rb
|
|
91
92
|
- app/services/spree/emails/samples/company_invitation.rb
|
|
@@ -193,9 +194,9 @@ licenses:
|
|
|
193
194
|
- BSD-3-Clause
|
|
194
195
|
metadata:
|
|
195
196
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
196
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.
|
|
197
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.6
|
|
197
198
|
documentation_uri: https://spreecommerce.org/docs/
|
|
198
|
-
source_code_uri: https://github.com/spree/spree/tree/v6.0.
|
|
199
|
+
source_code_uri: https://github.com/spree/spree/tree/v6.0.6
|
|
199
200
|
post_install_message:
|
|
200
201
|
rdoc_options: []
|
|
201
202
|
require_paths:
|