solidus_api 4.6.1 → 4.6.3
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: 8c41ea3214c59ad97011578151885acc73d3c9479c5498803ad1365091e7f954
|
|
4
|
+
data.tar.gz: 47c82eeefc719a30c191e5871a118f1d244a09c7ab6d8450a9e839d2bedd604b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05cdcecd7178d7123f472fc396528ac6ef05f2b04d2474b0a6fd5aef0c977489f474678be8721db9714dcc99cca1f23adb93056eaca63a423311c46f192da7c6
|
|
7
|
+
data.tar.gz: cbec85d5107e8654a9aee47a41df1b55c3ca5a9b0c4019eafe991c137c87579e39e1d663b428a82804e663a1614e14e6445c4d71172a9d3a7ea4815bedc6bf5a
|
|
@@ -11,6 +11,12 @@ module Spree
|
|
|
11
11
|
|
|
12
12
|
class_attribute :admin_payment_attributes
|
|
13
13
|
self.admin_payment_attributes = [:payment_method, :amount, :state, source: {}]
|
|
14
|
+
msg = "`Spree::Api::OrdersController.admin_payment_attributes` is deprecated."
|
|
15
|
+
deprecate(
|
|
16
|
+
admin_payment_attributes: msg,
|
|
17
|
+
"admin_payment_attributes=": msg,
|
|
18
|
+
deprecator: Spree.deprecator
|
|
19
|
+
)
|
|
14
20
|
|
|
15
21
|
before_action :find_order, except: [:create, :mine, :current, :index]
|
|
16
22
|
around_action :lock_order, except: [:create, :mine, :current, :index, :show]
|
|
@@ -149,7 +155,25 @@ module Spree
|
|
|
149
155
|
end
|
|
150
156
|
|
|
151
157
|
def permitted_order_attributes
|
|
152
|
-
can?(:admin, Spree::Order)
|
|
158
|
+
if can?(:admin, Spree::Order)
|
|
159
|
+
super + admin_order_attributes
|
|
160
|
+
else
|
|
161
|
+
# We need to remove the `:amount` attribute from payments_attributes
|
|
162
|
+
# for non-admin users. Unfortunately, order_attributes uses the
|
|
163
|
+
# checkout_payment_attributes instead of the payment_attributes, which
|
|
164
|
+
# needs to be able to set the amount.
|
|
165
|
+
#
|
|
166
|
+
# We're doing a deep_dup here to avoid modifying the original
|
|
167
|
+
# permitted attributes, which could have unintended side effects.
|
|
168
|
+
order_attributes = super.deep_dup
|
|
169
|
+
|
|
170
|
+
payments_attributes = order_attributes.find do |attribute|
|
|
171
|
+
attribute.is_a?(Hash) && attribute.has_key?(:payments_attributes)
|
|
172
|
+
end
|
|
173
|
+
payments_attributes[:payments_attributes] -= [:amount]
|
|
174
|
+
|
|
175
|
+
order_attributes
|
|
176
|
+
end
|
|
153
177
|
end
|
|
154
178
|
|
|
155
179
|
def permitted_shipment_attributes
|
|
@@ -161,6 +185,12 @@ module Spree
|
|
|
161
185
|
end
|
|
162
186
|
|
|
163
187
|
def permitted_payment_attributes
|
|
188
|
+
Spree.deprecator.warn(
|
|
189
|
+
"`Spree::Api::OrdersController#permitted_payment_attributes` is deprecated. " \
|
|
190
|
+
"This method was never actually used in this controller because " \
|
|
191
|
+
"permitted_order_attributes uses the permitted_checkout_payment_attributes " \
|
|
192
|
+
"method to determine the permitted attributes for payments."
|
|
193
|
+
)
|
|
164
194
|
if can?(:admin, Spree::Payment)
|
|
165
195
|
super + admin_payment_attributes
|
|
166
196
|
else
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module Spree
|
|
4
4
|
module Api
|
|
5
5
|
class PaymentsController < Spree::Api::BaseController
|
|
6
|
+
class_attribute :admin_payment_attributes
|
|
7
|
+
self.admin_payment_attributes = [:amount]
|
|
8
|
+
|
|
6
9
|
before_action :find_order
|
|
7
10
|
around_action :lock_order, only: [:create, :update, :authorize, :capture, :purchase, :void]
|
|
8
11
|
before_action :find_payment, only: [:update, :show, :authorize, :purchase, :capture, :void]
|
|
@@ -78,6 +81,14 @@ module Spree
|
|
|
78
81
|
def payment_params
|
|
79
82
|
params.require(:payment).permit(permitted_payment_attributes)
|
|
80
83
|
end
|
|
84
|
+
|
|
85
|
+
def permitted_payment_attributes
|
|
86
|
+
if can?(:admin, Spree::Payment)
|
|
87
|
+
super + admin_payment_attributes
|
|
88
|
+
else
|
|
89
|
+
super
|
|
90
|
+
end
|
|
91
|
+
end
|
|
81
92
|
end
|
|
82
93
|
end
|
|
83
94
|
end
|
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.6.
|
|
4
|
+
version: 4.6.3
|
|
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.6.
|
|
60
|
+
version: 4.6.3
|
|
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.6.
|
|
67
|
+
version: 4.6.3
|
|
68
68
|
description: REST API for the Solidus e-commerce framework.
|
|
69
69
|
email: contact@solidus.io
|
|
70
70
|
executables: []
|
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
270
270
|
- !ruby/object:Gem::Version
|
|
271
271
|
version: 1.8.23
|
|
272
272
|
requirements: []
|
|
273
|
-
rubygems_version:
|
|
273
|
+
rubygems_version: 4.0.10
|
|
274
274
|
specification_version: 4
|
|
275
275
|
summary: REST API for the Solidus e-commerce framework.
|
|
276
276
|
test_files: []
|