spree_api 6.0.0.rc2 → 6.0.0.rc3
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/controllers/concerns/spree/api/v3/store/search_provider_support.rb +8 -3
- data/app/controllers/spree/api/v3/store/carts/store_credits_controller.rb +13 -1
- data/app/controllers/spree/api/v3/store/carts_controller.rb +0 -2
- data/app/request_schemas/spree/api/v3/store/address_request_schema.rb +2 -0
- data/app/serializers/spree/api/v3/admin/price_history_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/admin/price_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/cart_serializer.rb +5 -1
- data/app/serializers/spree/api/v3/price_history_serializer.rb +6 -1
- data/app/serializers/spree/api/v3/price_serializer.rb +11 -1
- data/app/serializers/spree/api/v3/seller/price_history_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/seller/price_serializer.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2bf002c9d8182f8a69971d92c1ba84a2fe26571baefa007570c1a6e30761bd48
|
|
4
|
+
data.tar.gz: 78504b7007e37077c04a3b75b33644ad3e127670d7ec221888743bac8f25c9aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab37287b927bcbcc8c0e79ecfad9795608390098243660a2bd0b79a0c8b104b72a0f7485b1b67790b5f7b0978ea3af18349b7870b50c85edfdeb1702e1eca87a
|
|
7
|
+
data.tar.gz: 2317c9ac3b2cd0aecdcf432d9c83dab6ec44b077b078c960ddda56b9a066a41080841779c2a1bd6838bfb2fe07c71b03d3e6b34b8ad37681df20f61bdd637c98
|
|
@@ -18,12 +18,11 @@ module Spree
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
20
|
def search_query
|
|
21
|
-
|
|
21
|
+
search_params['search']
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def search_filters
|
|
25
|
-
q =
|
|
26
|
-
q = q.to_h if q.respond_to?(:to_h) && !q.is_a?(Hash)
|
|
25
|
+
q = search_params
|
|
27
26
|
# Decode Stripe-style prefixed IDs in `*_id_in`/`id_eq`/etc. so
|
|
28
27
|
# SPA + storefront filters can pass `prod_…` keys; the search
|
|
29
28
|
# provider hands the filter hash straight to Ransack on the
|
|
@@ -31,6 +30,12 @@ module Spree
|
|
|
31
30
|
decode_prefixed_id_predicates(q.except('search')).presence
|
|
32
31
|
end
|
|
33
32
|
|
|
33
|
+
# A `q` sent as anything but a hash (`q=foo`) filters nothing.
|
|
34
|
+
def search_params
|
|
35
|
+
q = params[:q]
|
|
36
|
+
q.respond_to?(:to_unsafe_h) ? q.to_unsafe_h : {}
|
|
37
|
+
end
|
|
38
|
+
|
|
34
39
|
def search_provider
|
|
35
40
|
@search_provider ||= Spree.search_provider.constantize.new(current_store)
|
|
36
41
|
end
|
|
@@ -9,11 +9,12 @@ module Spree
|
|
|
9
9
|
|
|
10
10
|
before_action :require_authentication!
|
|
11
11
|
before_action :find_cart!
|
|
12
|
+
before_action :stringify_numeric_amount, only: :create
|
|
12
13
|
|
|
13
14
|
request_params 'ApplyStoreCreditParams', action: :create do |body|
|
|
14
15
|
body.attribute :amount, :decimal,
|
|
15
16
|
example: '10.00',
|
|
16
|
-
description: 'Defaults to as much as the cart can use.'
|
|
17
|
+
description: 'Defaults to as much as the cart can use. A JSON number is still read until 6.1, with a deprecation warning.'
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
# POST /api/v3/store/carts/:cart_id/store_credits
|
|
@@ -46,6 +47,17 @@ module Spree
|
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
# 5.6 storefronts sent a JSON number; read it through its text so no
|
|
54
|
+
# float reaches the money math.
|
|
55
|
+
def stringify_numeric_amount
|
|
56
|
+
return unless params[:amount].is_a?(Numeric)
|
|
57
|
+
|
|
58
|
+
Spree::Deprecation.warn('Sending the store credit amount as a JSON number is deprecated and will be refused in Spree 6.1. Send a decimal string such as "25.00".')
|
|
59
|
+
params[:amount] = params[:amount].to_s
|
|
60
|
+
end
|
|
49
61
|
end
|
|
50
62
|
end
|
|
51
63
|
end
|
|
@@ -15,8 +15,6 @@ module Spree
|
|
|
15
15
|
schema.attribute :id, :id,
|
|
16
16
|
description: 'An existing address of the customer to use. The other fields are then ignored.'
|
|
17
17
|
schema.include_attributes Spree::Api::V3::Store::AddressRequestSchema
|
|
18
|
-
schema.attribute :quick_checkout, :boolean,
|
|
19
|
-
description: 'Relaxes validation (name, phone, postal code, street), for express checkouts that share a partial address.'
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
# Creating and updating a cart accept the same fields.
|
|
@@ -20,6 +20,8 @@ module Spree
|
|
|
20
20
|
example: 'NY',
|
|
21
21
|
description: 'ISO 3166-2 subdivision code without the country prefix, such as `CA` or `NY`.'
|
|
22
22
|
attribute :state_name, :string, description: 'The state name, for countries without predefined states.'
|
|
23
|
+
attribute :quick_checkout, :boolean,
|
|
24
|
+
description: 'Relaxes validation (name, phone, postal code, street), for express checkouts that share a partial address.'
|
|
23
25
|
attribute :country_iso, :string, deprecated: 'Use `country_code`. Removed in 6.1.'
|
|
24
26
|
attribute :state_abbr, :string, deprecated: 'Use `state_code`. Removed in 6.1.'
|
|
25
27
|
end
|
|
@@ -6,6 +6,8 @@ module Spree
|
|
|
6
6
|
# Extends Store Price Serializer with admin-only fields
|
|
7
7
|
class PriceSerializer < V3::PriceSerializer
|
|
8
8
|
without_formatted_money
|
|
9
|
+
_attributes.delete(:amount_in_cents)
|
|
10
|
+
_attributes.delete(:compare_at_amount_in_cents)
|
|
9
11
|
|
|
10
12
|
typelize variant_id: [:string, nullable: true],
|
|
11
13
|
min_quantity: :number,
|
|
@@ -74,7 +74,11 @@ module Spree
|
|
|
74
74
|
# it is dropped rather than redacted for a gated guest: a requirement
|
|
75
75
|
# with its numbers stripped tells them nothing they can act on.
|
|
76
76
|
attribute :requirements do |order|
|
|
77
|
-
|
|
77
|
+
# 5.6 storefronts matched the delivery requirement by its field, so
|
|
78
|
+
# it keeps the old name until 6.1; `code` already carries the new one.
|
|
79
|
+
requirements = Spree::Checkout::Requirements.new(order).call.map do |requirement|
|
|
80
|
+
requirement[:field] == 'delivery_method' ? requirement.merge(field: 'shipping_method') : requirement
|
|
81
|
+
end
|
|
78
82
|
next requirements unless params[:hide_prices]
|
|
79
83
|
|
|
80
84
|
requirements.reject { |requirement| requirement[:code] == 'order_minimum_not_met' }
|
|
@@ -6,12 +6,17 @@ module Spree
|
|
|
6
6
|
class PriceHistorySerializer < BaseSerializer
|
|
7
7
|
typelize display_amount: display_money_type(:display_amount, nullable: false),
|
|
8
8
|
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
9
|
-
recorded_at: :string
|
|
9
|
+
recorded_at: :string,
|
|
10
|
+
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.1.']
|
|
10
11
|
|
|
11
12
|
attributes :currency
|
|
12
13
|
|
|
13
14
|
money_attributes :amount, unit_price: true
|
|
14
15
|
|
|
16
|
+
attribute :amount_in_cents do |price_history|
|
|
17
|
+
price_history.amount_in_cents unless params[:hide_prices]
|
|
18
|
+
end
|
|
19
|
+
|
|
15
20
|
attributes :display_amount
|
|
16
21
|
|
|
17
22
|
attribute :recorded_at do |price_history|
|
|
@@ -8,12 +8,22 @@ module Spree
|
|
|
8
8
|
typelize display_amount: display_money_type(:display_amount),
|
|
9
9
|
display_compare_at_amount: display_money_type(:display_compare_at_amount),
|
|
10
10
|
currency: [:string, nullable: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
11
|
-
price_list_id: [:string, nullable: true]
|
|
11
|
+
price_list_id: [:string, nullable: true],
|
|
12
|
+
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.1.'],
|
|
13
|
+
compare_at_amount_in_cents: [:number, nullable: true, deprecated: 'Use `compare_at_amount`. Removed in 6.1.']
|
|
12
14
|
|
|
13
15
|
attributes :currency
|
|
14
16
|
|
|
15
17
|
money_attributes :amount, :compare_at_amount, unit_price: true
|
|
16
18
|
|
|
19
|
+
attribute :amount_in_cents do |price|
|
|
20
|
+
price.amount_in_cents unless params[:hide_prices]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
attribute :compare_at_amount_in_cents do |price|
|
|
24
|
+
price.compare_at_amount_in_cents unless params[:hide_prices]
|
|
25
|
+
end
|
|
26
|
+
|
|
17
27
|
attribute :display_amount do |price|
|
|
18
28
|
price.display_amount&.to_s
|
|
19
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.rc3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vendo Connect Inc.
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - '='
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 6.0.0.
|
|
47
|
+
version: 6.0.0.rc3
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - '='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 6.0.0.
|
|
54
|
+
version: 6.0.0.rc3
|
|
55
55
|
description: Spree Commerce Store / Admin API and HTTP webhooks
|
|
56
56
|
email:
|
|
57
57
|
- hello@spreecommerce.org
|
|
@@ -792,9 +792,9 @@ licenses:
|
|
|
792
792
|
- BSD-3-Clause
|
|
793
793
|
metadata:
|
|
794
794
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
795
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.
|
|
795
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.rc3
|
|
796
796
|
documentation_uri: https://docs.spreecommerce.org/
|
|
797
|
-
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.
|
|
797
|
+
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.rc3
|
|
798
798
|
post_install_message:
|
|
799
799
|
rdoc_options: []
|
|
800
800
|
require_paths:
|