spree_api 4.1.10 → 4.1.14
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/spree/api/v2/base_controller.rb +6 -1
- data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +2 -2
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +1 -2
- data/app/controllers/spree/api/v2/storefront/order_status_controller.rb +1 -1
- data/app/models/spree/api_dependencies.rb +2 -1
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +3 -1
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/store_credit_category_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/store_credit_serializer.rb +1 -1
- data/config/initializers/doorkeeper.rb +2 -0
- data/docs/v2/storefront/index.yaml +18 -0
- data/lib/spree/api/testing_support/v2/base.rb +1 -1
- data/lib/spree/api/testing_support/v2/current_order.rb +6 -0
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc3f03ecf70abae2f7445b799111bdb41656e3b0c22822171afccae57015573
|
4
|
+
data.tar.gz: 1890a237d1a08d9aa3fde6fbfa1212f8fc312e25d99d644860699522b0a4fb25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 476e364c06be896d13c40e3a5ccae5f017d210ddfcc0391927f6a0baa45b657cfeab5731bddfd98eefc1de34e2dc1cbfa539fe7836ca16c5c64d59e5bbb84292
|
7
|
+
data.tar.gz: 20d266703325aca1df763cc8dd5540558e26a550a8b54eac1f4732c4a579ade867ae1275a1b7e8710750af6375676492ff95c75feb934f1923ffd81e98ff9b89
|
@@ -53,7 +53,12 @@ module Spree
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def spree_current_user
|
56
|
-
|
56
|
+
return nil unless doorkeeper_token
|
57
|
+
return @spree_current_user if @spree_current_user
|
58
|
+
|
59
|
+
doorkeeper_authorize!
|
60
|
+
|
61
|
+
@spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id)
|
57
62
|
end
|
58
63
|
|
59
64
|
def spree_authorize!(action, subject, *args)
|
@@ -35,11 +35,11 @@ module Spree
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def collection_serializer
|
38
|
-
Spree::Api::Dependencies.
|
38
|
+
Spree::Api::Dependencies.storefront_order_serializer.constantize
|
39
39
|
end
|
40
40
|
|
41
41
|
def resource_serializer
|
42
|
-
Spree::Api::Dependencies.
|
42
|
+
Spree::Api::Dependencies.storefront_order_serializer.constantize
|
43
43
|
end
|
44
44
|
|
45
45
|
def collection_finder
|
@@ -125,8 +125,7 @@ module Spree
|
|
125
125
|
def serialize_shipping_rates(shipments)
|
126
126
|
shipping_rates_serializer.new(
|
127
127
|
shipments,
|
128
|
-
include: [:shipping_rates, :stock_location]
|
129
|
-
params: { show_rates: true }
|
128
|
+
include: [:shipping_rates, :stock_location]
|
130
129
|
).serializable_hash
|
131
130
|
end
|
132
131
|
end
|
@@ -14,7 +14,7 @@ module Spree
|
|
14
14
|
:storefront_collection_paginator, :storefront_user_serializer, :storefront_products_sorter, :storefront_products_finder,
|
15
15
|
:storefront_product_serializer, :storefront_taxon_serializer, :storefront_taxon_finder, :storefront_find_by_variant_finder,
|
16
16
|
:storefront_cart_update_service, :storefront_cart_estimate_shipping_rates_service, :storefront_estimated_shipment_serializer,
|
17
|
-
:storefront_store_serializer, :storefront_address_serializer,
|
17
|
+
:storefront_store_serializer, :storefront_address_serializer, :storefront_order_serializer,
|
18
18
|
:storefront_account_create_address_service, :storefront_account_update_address_service, :storefront_address_finder
|
19
19
|
].freeze
|
20
20
|
|
@@ -66,6 +66,7 @@ module Spree
|
|
66
66
|
@storefront_product_serializer = 'Spree::V2::Storefront::ProductSerializer'
|
67
67
|
@storefront_estimated_shipment_serializer = 'Spree::V2::Storefront::EstimatedShippingRateSerializer'
|
68
68
|
@storefront_store_serializer = 'Spree::V2::Storefront::StoreSerializer'
|
69
|
+
@storefront_order_serializer = 'Spree::V2::Storefront::CartSerializer'
|
69
70
|
|
70
71
|
# sorters
|
71
72
|
@storefront_order_sorter = Spree::Dependencies.order_sorter
|
@@ -8,7 +8,9 @@ module Spree
|
|
8
8
|
:updated_at, :completed_at, :included_tax_total, :additional_tax_total, :display_additional_tax_total,
|
9
9
|
:display_included_tax_total, :tax_total, :currency, :state, :token, :email,
|
10
10
|
:display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,
|
11
|
-
:promo_total, :display_promo_total, :item_count, :special_instructions, :display_total
|
11
|
+
:promo_total, :display_promo_total, :item_count, :special_instructions, :display_total,
|
12
|
+
:pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total,
|
13
|
+
:shipment_state, :payment_state
|
12
14
|
|
13
15
|
has_many :line_items
|
14
16
|
has_many :variants
|
@@ -9,7 +9,8 @@ module Spree
|
|
9
9
|
:display_adjustment_total, :additional_tax_total,
|
10
10
|
:discounted_amount, :display_discounted_amount,
|
11
11
|
:display_additional_tax_total, :promo_total, :display_promo_total,
|
12
|
-
:included_tax_total, :display_included_tax_total
|
12
|
+
:included_tax_total, :display_included_tax_total,
|
13
|
+
:pre_tax_amount, :display_pre_tax_amount
|
13
14
|
|
14
15
|
belongs_to :variant
|
15
16
|
end
|
@@ -3,6 +3,8 @@ Doorkeeper.configure do
|
|
3
3
|
use_refresh_token
|
4
4
|
api_only
|
5
5
|
|
6
|
+
skip_client_authentication_for_password_grant { true } if defined?(skip_client_authentication_for_password_grant)
|
7
|
+
|
6
8
|
resource_owner_authenticator { current_spree_user }
|
7
9
|
|
8
10
|
resource_owner_from_credentials do
|
@@ -1299,6 +1299,18 @@ components:
|
|
1299
1299
|
display_tax_total:
|
1300
1300
|
type: string
|
1301
1301
|
example: '$10.00'
|
1302
|
+
pre_tax_item_amount:
|
1303
|
+
type: string
|
1304
|
+
example: '17.00'
|
1305
|
+
display_pre_tax_item_amount:
|
1306
|
+
type: string
|
1307
|
+
example: '$17.00'
|
1308
|
+
pre_tax_total:
|
1309
|
+
type: string
|
1310
|
+
example: '20.00'
|
1311
|
+
display_pre_tax_total:
|
1312
|
+
type: string
|
1313
|
+
example: '$20.00'
|
1302
1314
|
item_count:
|
1303
1315
|
type: number
|
1304
1316
|
example: 2
|
@@ -1511,6 +1523,12 @@ components:
|
|
1511
1523
|
display_discounted_amount:
|
1512
1524
|
type: string
|
1513
1525
|
example: '$125.00'
|
1526
|
+
pre_tax_amount:
|
1527
|
+
type: string
|
1528
|
+
example: '125.0'
|
1529
|
+
display_pre_tax_amount:
|
1530
|
+
type: string
|
1531
|
+
example: '$125.00'
|
1514
1532
|
promo_total:
|
1515
1533
|
type: string
|
1516
1534
|
example: '-5.0'
|
@@ -4,7 +4,7 @@ shared_context 'API v2 tokens' do
|
|
4
4
|
let(:headers_order_token) { { 'X-Spree-Order-Token' => order.token } }
|
5
5
|
end
|
6
6
|
|
7
|
-
[200, 201, 400, 404, 403, 422].each do |status_code|
|
7
|
+
[200, 201, 400, 401, 404, 403, 422].each do |status_code|
|
8
8
|
shared_examples "returns #{status_code} HTTP status" do
|
9
9
|
it "returns #{status_code}" do
|
10
10
|
expect(response.status).to eq(status_code)
|
@@ -27,6 +27,8 @@ shared_examples 'returns valid cart JSON' do
|
|
27
27
|
expect(json_response['data']).to have_type('cart')
|
28
28
|
expect(json_response['data']).to have_attribute(:number).with_value(order.number)
|
29
29
|
expect(json_response['data']).to have_attribute(:state).with_value(order.state)
|
30
|
+
expect(json_response['data']).to have_attribute(:payment_state).with_value(order.payment_state)
|
31
|
+
expect(json_response['data']).to have_attribute(:shipment_state).with_value(order.shipment_state)
|
30
32
|
expect(json_response['data']).to have_attribute(:token).with_value(order.token)
|
31
33
|
expect(json_response['data']).to have_attribute(:total).with_value(order.total.to_s)
|
32
34
|
expect(json_response['data']).to have_attribute(:item_total).with_value(order.item_total.to_s)
|
@@ -48,6 +50,10 @@ shared_examples 'returns valid cart JSON' do
|
|
48
50
|
expect(json_response['data']).to have_attribute(:promo_total).with_value(order.promo_total.to_s)
|
49
51
|
expect(json_response['data']).to have_attribute(:display_promo_total).with_value(order.display_promo_total.to_s)
|
50
52
|
expect(json_response['data']).to have_attribute(:display_total).with_value(order.display_total.to_s)
|
53
|
+
expect(json_response['data']).to have_attribute(:pre_tax_item_amount).with_value(order.pre_tax_item_amount.to_s)
|
54
|
+
expect(json_response['data']).to have_attribute(:display_pre_tax_item_amount).with_value(order.display_pre_tax_item_amount.to_s)
|
55
|
+
expect(json_response['data']).to have_attribute(:pre_tax_total).with_value(order.pre_tax_total.to_s)
|
56
|
+
expect(json_response['data']).to have_attribute(:display_pre_tax_total).with_value(order.display_pre_tax_total.to_s)
|
51
57
|
expect(json_response['data']).to have_relationships(:user, :line_items, :variants, :billing_address, :shipping_address, :payments, :shipments, :promotions)
|
52
58
|
end
|
53
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.1.
|
33
|
+
version: 4.1.14
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.1.
|
40
|
+
version: 4.1.14
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rabl
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- app/serializers/spree/v2/storefront/shipping_rate_serializer.rb
|
170
170
|
- app/serializers/spree/v2/storefront/state_serializer.rb
|
171
171
|
- app/serializers/spree/v2/storefront/stock_location_serializer.rb
|
172
|
+
- app/serializers/spree/v2/storefront/store_credit_category_serializer.rb
|
172
173
|
- app/serializers/spree/v2/storefront/store_credit_event_serializer.rb
|
173
174
|
- app/serializers/spree/v2/storefront/store_credit_serializer.rb
|
174
175
|
- app/serializers/spree/v2/storefront/store_credit_type_serializer.rb
|
@@ -306,10 +307,10 @@ licenses:
|
|
306
307
|
- BSD-3-Clause
|
307
308
|
metadata:
|
308
309
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
309
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.
|
310
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.14
|
310
311
|
documentation_uri: https://guides.spreecommerce.org/
|
311
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.1.
|
312
|
-
post_install_message:
|
312
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.1.14
|
313
|
+
post_install_message:
|
313
314
|
rdoc_options: []
|
314
315
|
require_paths:
|
315
316
|
- lib
|
@@ -324,8 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
325
|
- !ruby/object:Gem::Version
|
325
326
|
version: '0'
|
326
327
|
requirements: []
|
327
|
-
rubygems_version: 3.
|
328
|
-
signing_key:
|
328
|
+
rubygems_version: 3.2.3
|
329
|
+
signing_key:
|
329
330
|
specification_version: 4
|
330
331
|
summary: Spree's API
|
331
332
|
test_files: []
|