solidus_api 4.7.1 → 4.7.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a09ac9341a0721a7b5cd1ee955557b6659e0baa689adcd3abfc0b73b6e96cfc0
|
|
4
|
+
data.tar.gz: 473737cd41360507d3d6eacffcbf64d6dffb65d05c8d3d6b85b934ebcc2a1137
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed264bfc8321d2072db352b6820fbbcee2c72918f500279e940fe7f11ff329442baf4c657eb7ddf67870fd44eeb7966044cf55033f032d29ecb1516d14d5dd6d
|
|
7
|
+
data.tar.gz: 6f220657fb6b51d027586734957b61ae6e8b22f68acfc9637a7c983ce56f5b6e0684e4ad5e6b893b62472430c8f99dac15930b0826dd7869f1c4baf29a7929b0
|
|
@@ -105,10 +105,20 @@ module Spree
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def update_order_state
|
|
108
|
-
|
|
108
|
+
return unless params[:state]
|
|
109
|
+
|
|
110
|
+
unless Spree::Api::Config.allow_arbitrary_state_in_checkout || valid_checkout_step?(params[:state])
|
|
111
|
+
return respond_with(@order, default_template: "spree/api/orders/invalid_state", status: 422)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
@order.state = params[:state]
|
|
109
115
|
state_callback(:before)
|
|
110
116
|
end
|
|
111
117
|
|
|
118
|
+
def valid_checkout_step?(step)
|
|
119
|
+
@order.passed_checkout_step?(step) || @order.state == step
|
|
120
|
+
end
|
|
121
|
+
|
|
112
122
|
def state_callback(before_or_after = :before)
|
|
113
123
|
method_name = :"#{before_or_after}_#{@order.state}"
|
|
114
124
|
send(method_name) if respond_to?(method_name, true)
|
|
@@ -80,10 +80,16 @@ class Spree::Api::UsersController < Spree::Api::BaseController
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def permitted_user_attributes
|
|
83
|
+
attributes = super
|
|
84
|
+
|
|
83
85
|
if action_name == "create" || can?(:update_email, @user)
|
|
84
|
-
|
|
85
|
-
else
|
|
86
|
-
super
|
|
86
|
+
attributes |= [:email]
|
|
87
87
|
end
|
|
88
|
+
|
|
89
|
+
unless action_name == "create" || @user == current_api_user || can?(:update_password, @user)
|
|
90
|
+
attributes -= [:password, :password_confirmation]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
attributes
|
|
88
94
|
end
|
|
89
95
|
end
|
data/config/locales/en.yml
CHANGED
|
@@ -12,6 +12,7 @@ en:
|
|
|
12
12
|
order:
|
|
13
13
|
expected_total_mismatch: Expected total does not match actual total.
|
|
14
14
|
invalid_shipping_method: Invalid shipping method specified.
|
|
15
|
+
invalid_state: Invalid state specified.
|
|
15
16
|
quantity_is_not_available: Quantity is not available for items in your order
|
|
16
17
|
payment:
|
|
17
18
|
credit_over_limit: This payment can only be credited up to %{limit}. Please specify an amount less than or equal to this number.
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
class ApiConfiguration < Preferences::Configuration
|
|
5
|
+
# @!attribute [rw] allow_arbitrary_state_in_api
|
|
6
|
+
# @return [Boolean] When true, the API will allow arbitrary state transitions on orders (default: +false+)
|
|
7
|
+
preference :allow_arbitrary_state_in_checkout, :boolean, default: false
|
|
8
|
+
|
|
5
9
|
preference :requires_authentication, :boolean, default: true
|
|
6
10
|
|
|
7
11
|
preference :product_attributes, :array, default: [
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.7.
|
|
4
|
+
version: 4.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Solidus Team
|
|
@@ -57,14 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 4.7.
|
|
60
|
+
version: 4.7.2
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 4.7.
|
|
67
|
+
version: 4.7.2
|
|
68
68
|
description: REST API for the Solidus e-commerce framework.
|
|
69
69
|
email: contact@solidus.io
|
|
70
70
|
executables: []
|
|
@@ -152,6 +152,7 @@ files:
|
|
|
152
152
|
- app/views/spree/api/orders/expected_total_mismatch.json.jbuilder
|
|
153
153
|
- app/views/spree/api/orders/index.json.jbuilder
|
|
154
154
|
- app/views/spree/api/orders/invalid_shipping_method.json.jbuilder
|
|
155
|
+
- app/views/spree/api/orders/invalid_state.json.jbuilder
|
|
155
156
|
- app/views/spree/api/orders/mine.json.jbuilder
|
|
156
157
|
- app/views/spree/api/orders/show.json.jbuilder
|
|
157
158
|
- app/views/spree/api/payments/credit_over_limit.json.jbuilder
|