square.rb 6.4.0.20200923 → 6.5.0.20201028
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/README.md +31 -30
- data/lib/square.rb +61 -61
- data/lib/square/api/apple_pay_api.rb +3 -1
- data/lib/square/api/bank_accounts_api.rb +12 -15
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/cash_drawers_api.rb +11 -5
- data/lib/square/api/catalog_api.rb +47 -25
- data/lib/square/api/checkout_api.rb +4 -2
- data/lib/square/api/customer_groups_api.rb +18 -8
- data/lib/square/api/customer_segments_api.rb +7 -3
- data/lib/square/api/customers_api.rb +47 -27
- data/lib/square/api/devices_api.rb +17 -6
- data/lib/square/api/disputes_api.rb +37 -19
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +25 -11
- data/lib/square/api/invoices_api.rb +29 -13
- data/lib/square/api/labor_api.rb +57 -25
- data/lib/square/api/locations_api.rb +16 -13
- data/lib/square/api/loyalty_api.rb +59 -65
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +3 -1
- data/lib/square/api/o_auth_api.rb +10 -4
- data/lib/square/api/orders_api.rb +55 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +12 -6
- data/lib/square/api/subscriptions_api.rb +22 -10
- data/lib/square/api/team_api.rb +32 -16
- data/lib/square/api/terminal_api.rb +156 -7
- data/lib/square/api/transactions_api.rb +32 -18
- data/lib/square/api/v1_employees_api.rb +59 -27
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_locations_api.rb +6 -2
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +2 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +1 -0
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/test_locations_api.rb +1 -1
- metadata +3 -3
data/lib/square/api/team_api.rb
CHANGED
@@ -8,8 +8,8 @@ module Square
|
|
8
8
|
# Creates a single `TeamMember` object. The `TeamMember` will be returned on
|
9
9
|
# successful creates.
|
10
10
|
# You must provide the following values in your request to this endpoint:
|
11
|
-
# - `
|
12
|
-
# - `
|
11
|
+
# - `given_name`
|
12
|
+
# - `family_name`
|
13
13
|
# Learn about [Troubleshooting the Teams
|
14
14
|
# API](https://developer.squareup.com/docs/docs/team/troubleshooting#createt
|
15
15
|
# eammember).
|
@@ -41,7 +41,9 @@ module Square
|
|
41
41
|
# Return appropriate response type.
|
42
42
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
43
43
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
44
|
-
ApiResponse.new(
|
44
|
+
ApiResponse.new(
|
45
|
+
_response, data: decoded, errors: _errors
|
46
|
+
)
|
45
47
|
end
|
46
48
|
|
47
49
|
# Creates multiple `TeamMember` objects. The created `TeamMember` objects
|
@@ -82,7 +84,9 @@ module Square
|
|
82
84
|
# Return appropriate response type.
|
83
85
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
84
86
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
85
|
-
ApiResponse.new(
|
87
|
+
ApiResponse.new(
|
88
|
+
_response, data: decoded, errors: _errors
|
89
|
+
)
|
86
90
|
end
|
87
91
|
|
88
92
|
# Updates multiple `TeamMember` objects. The updated `TeamMember` objects
|
@@ -123,13 +127,15 @@ module Square
|
|
123
127
|
# Return appropriate response type.
|
124
128
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
125
129
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
126
|
-
ApiResponse.new(
|
130
|
+
ApiResponse.new(
|
131
|
+
_response, data: decoded, errors: _errors
|
132
|
+
)
|
127
133
|
end
|
128
134
|
|
129
135
|
# Returns a paginated list of `TeamMember` objects for a business.
|
130
136
|
# The list to be returned can be filtered by:
|
131
137
|
# - location IDs **and**
|
132
|
-
# - `
|
138
|
+
# - `status`
|
133
139
|
# @param [SearchTeamMembersRequest] body Required parameter: An object
|
134
140
|
# containing the fields to POST for the request. See the corresponding
|
135
141
|
# object definition for field details.
|
@@ -158,10 +164,12 @@ module Square
|
|
158
164
|
# Return appropriate response type.
|
159
165
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
160
166
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
161
|
-
ApiResponse.new(
|
167
|
+
ApiResponse.new(
|
168
|
+
_response, data: decoded, errors: _errors
|
169
|
+
)
|
162
170
|
end
|
163
171
|
|
164
|
-
# Retrieve a `TeamMember` object for the given `TeamMember.id
|
172
|
+
# Retrieve a `TeamMember` object for the given `TeamMember.id`.
|
165
173
|
# Learn about [Troubleshooting the Teams
|
166
174
|
# API](https://developer.squareup.com/docs/docs/team/troubleshooting#retriev
|
167
175
|
# eteammember).
|
@@ -174,7 +182,7 @@ module Square
|
|
174
182
|
_query_builder << '/v2/team-members/{team_member_id}'
|
175
183
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
176
184
|
_query_builder,
|
177
|
-
'team_member_id' => team_member_id
|
185
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
178
186
|
)
|
179
187
|
_query_url = APIHelper.clean_url _query_builder
|
180
188
|
|
@@ -194,7 +202,9 @@ module Square
|
|
194
202
|
# Return appropriate response type.
|
195
203
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
196
204
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
197
|
-
ApiResponse.new(
|
205
|
+
ApiResponse.new(
|
206
|
+
_response, data: decoded, errors: _errors
|
207
|
+
)
|
198
208
|
end
|
199
209
|
|
200
210
|
# Updates a single `TeamMember` object. The `TeamMember` will be returned on
|
@@ -215,7 +225,7 @@ module Square
|
|
215
225
|
_query_builder << '/v2/team-members/{team_member_id}'
|
216
226
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
217
227
|
_query_builder,
|
218
|
-
'team_member_id' => team_member_id
|
228
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
219
229
|
)
|
220
230
|
_query_url = APIHelper.clean_url _query_builder
|
221
231
|
|
@@ -237,7 +247,9 @@ module Square
|
|
237
247
|
# Return appropriate response type.
|
238
248
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
239
249
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
240
|
-
ApiResponse.new(
|
250
|
+
ApiResponse.new(
|
251
|
+
_response, data: decoded, errors: _errors
|
252
|
+
)
|
241
253
|
end
|
242
254
|
|
243
255
|
# Retrieve a `WageSetting` object for a team member specified
|
@@ -254,7 +266,7 @@ module Square
|
|
254
266
|
_query_builder << '/v2/team-members/{team_member_id}/wage-setting'
|
255
267
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
256
268
|
_query_builder,
|
257
|
-
'team_member_id' => team_member_id
|
269
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
258
270
|
)
|
259
271
|
_query_url = APIHelper.clean_url _query_builder
|
260
272
|
|
@@ -274,7 +286,9 @@ module Square
|
|
274
286
|
# Return appropriate response type.
|
275
287
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
288
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
-
ApiResponse.new(
|
289
|
+
ApiResponse.new(
|
290
|
+
_response, data: decoded, errors: _errors
|
291
|
+
)
|
278
292
|
end
|
279
293
|
|
280
294
|
# Creates or updates a `WageSetting` object. The object is created if a
|
@@ -298,7 +312,7 @@ module Square
|
|
298
312
|
_query_builder << '/v2/team-members/{team_member_id}/wage-setting'
|
299
313
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
300
314
|
_query_builder,
|
301
|
-
'team_member_id' => team_member_id
|
315
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
302
316
|
)
|
303
317
|
_query_url = APIHelper.clean_url _query_builder
|
304
318
|
|
@@ -320,7 +334,9 @@ module Square
|
|
320
334
|
# Return appropriate response type.
|
321
335
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
322
336
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
323
|
-
ApiResponse.new(
|
337
|
+
ApiResponse.new(
|
338
|
+
_response, data: decoded, errors: _errors
|
339
|
+
)
|
324
340
|
end
|
325
341
|
end
|
326
342
|
end
|
@@ -35,7 +35,9 @@ module Square
|
|
35
35
|
# Return appropriate response type.
|
36
36
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
37
37
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
38
|
-
ApiResponse.new(
|
38
|
+
ApiResponse.new(
|
39
|
+
_response, data: decoded, errors: _errors
|
40
|
+
)
|
39
41
|
end
|
40
42
|
|
41
43
|
# Retrieves a filtered list of Terminal checkout requests created by the
|
@@ -68,7 +70,9 @@ module Square
|
|
68
70
|
# Return appropriate response type.
|
69
71
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
70
72
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
71
|
-
ApiResponse.new(
|
73
|
+
ApiResponse.new(
|
74
|
+
_response, data: decoded, errors: _errors
|
75
|
+
)
|
72
76
|
end
|
73
77
|
|
74
78
|
# Retrieves a Terminal checkout request by checkout_id.
|
@@ -81,7 +85,7 @@ module Square
|
|
81
85
|
_query_builder << '/v2/terminals/checkouts/{checkout_id}'
|
82
86
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
83
87
|
_query_builder,
|
84
|
-
'checkout_id' => checkout_id
|
88
|
+
'checkout_id' => { 'value' => checkout_id, 'encode' => true }
|
85
89
|
)
|
86
90
|
_query_url = APIHelper.clean_url _query_builder
|
87
91
|
|
@@ -101,10 +105,12 @@ module Square
|
|
101
105
|
# Return appropriate response type.
|
102
106
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
103
107
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
104
|
-
ApiResponse.new(
|
108
|
+
ApiResponse.new(
|
109
|
+
_response, data: decoded, errors: _errors
|
110
|
+
)
|
105
111
|
end
|
106
112
|
|
107
|
-
# Cancels a Terminal checkout request
|
113
|
+
# Cancels a Terminal checkout request if the status of the request permits
|
108
114
|
# it.
|
109
115
|
# @param [String] checkout_id Required parameter: Unique ID for the desired
|
110
116
|
# `TerminalCheckout`
|
@@ -115,7 +121,148 @@ module Square
|
|
115
121
|
_query_builder << '/v2/terminals/checkouts/{checkout_id}/cancel'
|
116
122
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
117
123
|
_query_builder,
|
118
|
-
'checkout_id' => checkout_id
|
124
|
+
'checkout_id' => { 'value' => checkout_id, 'encode' => true }
|
125
|
+
)
|
126
|
+
_query_url = APIHelper.clean_url _query_builder
|
127
|
+
|
128
|
+
# Prepare headers.
|
129
|
+
_headers = {
|
130
|
+
'accept' => 'application/json'
|
131
|
+
}
|
132
|
+
|
133
|
+
# Prepare and execute HttpRequest.
|
134
|
+
_request = config.http_client.post(
|
135
|
+
_query_url,
|
136
|
+
headers: _headers
|
137
|
+
)
|
138
|
+
OAuth2.apply(config, _request)
|
139
|
+
_response = execute_request(_request)
|
140
|
+
|
141
|
+
# Return appropriate response type.
|
142
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
143
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
144
|
+
ApiResponse.new(
|
145
|
+
_response, data: decoded, errors: _errors
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Creates a request to refund an Interac payment completed on a Square
|
150
|
+
# Terminal.
|
151
|
+
# @param [CreateTerminalRefundRequest] body Required parameter: An object
|
152
|
+
# containing the fields to POST for the request. See the corresponding
|
153
|
+
# object definition for field details.
|
154
|
+
# @return [CreateTerminalRefundResponse Hash] response from the API call
|
155
|
+
def create_terminal_refund(body:)
|
156
|
+
# Prepare query url.
|
157
|
+
_query_builder = config.get_base_uri
|
158
|
+
_query_builder << '/v2/terminals/refunds'
|
159
|
+
_query_url = APIHelper.clean_url _query_builder
|
160
|
+
|
161
|
+
# Prepare headers.
|
162
|
+
_headers = {
|
163
|
+
'accept' => 'application/json',
|
164
|
+
'content-type' => 'application/json; charset=utf-8'
|
165
|
+
}
|
166
|
+
|
167
|
+
# Prepare and execute HttpRequest.
|
168
|
+
_request = config.http_client.post(
|
169
|
+
_query_url,
|
170
|
+
headers: _headers,
|
171
|
+
parameters: body.to_json
|
172
|
+
)
|
173
|
+
OAuth2.apply(config, _request)
|
174
|
+
_response = execute_request(_request)
|
175
|
+
|
176
|
+
# Return appropriate response type.
|
177
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
178
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
179
|
+
ApiResponse.new(
|
180
|
+
_response, data: decoded, errors: _errors
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Retrieves a filtered list of Terminal Interac refund requests created by
|
185
|
+
# the seller making the request.
|
186
|
+
# @param [SearchTerminalRefundsRequest] body Required parameter: An object
|
187
|
+
# containing the fields to POST for the request. See the corresponding
|
188
|
+
# object definition for field details.
|
189
|
+
# @return [SearchTerminalRefundsResponse Hash] response from the API call
|
190
|
+
def search_terminal_refunds(body:)
|
191
|
+
# Prepare query url.
|
192
|
+
_query_builder = config.get_base_uri
|
193
|
+
_query_builder << '/v2/terminals/refunds/search'
|
194
|
+
_query_url = APIHelper.clean_url _query_builder
|
195
|
+
|
196
|
+
# Prepare headers.
|
197
|
+
_headers = {
|
198
|
+
'accept' => 'application/json',
|
199
|
+
'content-type' => 'application/json; charset=utf-8'
|
200
|
+
}
|
201
|
+
|
202
|
+
# Prepare and execute HttpRequest.
|
203
|
+
_request = config.http_client.post(
|
204
|
+
_query_url,
|
205
|
+
headers: _headers,
|
206
|
+
parameters: body.to_json
|
207
|
+
)
|
208
|
+
OAuth2.apply(config, _request)
|
209
|
+
_response = execute_request(_request)
|
210
|
+
|
211
|
+
# Return appropriate response type.
|
212
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
213
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
214
|
+
ApiResponse.new(
|
215
|
+
_response, data: decoded, errors: _errors
|
216
|
+
)
|
217
|
+
end
|
218
|
+
|
219
|
+
# Retrieves an Interac terminal refund object by ID.
|
220
|
+
# @param [String] terminal_refund_id Required parameter: Unique ID for the
|
221
|
+
# desired `TerminalRefund`
|
222
|
+
# @return [GetTerminalRefundResponse Hash] response from the API call
|
223
|
+
def get_terminal_refund(terminal_refund_id:)
|
224
|
+
# Prepare query url.
|
225
|
+
_query_builder = config.get_base_uri
|
226
|
+
_query_builder << '/v2/terminals/refunds/{terminal_refund_id}'
|
227
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
228
|
+
_query_builder,
|
229
|
+
'terminal_refund_id' => { 'value' => terminal_refund_id, 'encode' => true }
|
230
|
+
)
|
231
|
+
_query_url = APIHelper.clean_url _query_builder
|
232
|
+
|
233
|
+
# Prepare headers.
|
234
|
+
_headers = {
|
235
|
+
'accept' => 'application/json'
|
236
|
+
}
|
237
|
+
|
238
|
+
# Prepare and execute HttpRequest.
|
239
|
+
_request = config.http_client.get(
|
240
|
+
_query_url,
|
241
|
+
headers: _headers
|
242
|
+
)
|
243
|
+
OAuth2.apply(config, _request)
|
244
|
+
_response = execute_request(_request)
|
245
|
+
|
246
|
+
# Return appropriate response type.
|
247
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
248
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
249
|
+
ApiResponse.new(
|
250
|
+
_response, data: decoded, errors: _errors
|
251
|
+
)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Cancels an Interac terminal refund request by refund request ID if the
|
255
|
+
# status of the request permits it.
|
256
|
+
# @param [String] terminal_refund_id Required parameter: Unique ID for the
|
257
|
+
# desired `TerminalRefund`
|
258
|
+
# @return [CancelTerminalRefundResponse Hash] response from the API call
|
259
|
+
def cancel_terminal_refund(terminal_refund_id:)
|
260
|
+
# Prepare query url.
|
261
|
+
_query_builder = config.get_base_uri
|
262
|
+
_query_builder << '/v2/terminals/refunds/{terminal_refund_id}/cancel'
|
263
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
264
|
+
_query_builder,
|
265
|
+
'terminal_refund_id' => { 'value' => terminal_refund_id, 'encode' => true }
|
119
266
|
)
|
120
267
|
_query_url = APIHelper.clean_url _query_builder
|
121
268
|
|
@@ -135,7 +282,9 @@ module Square
|
|
135
282
|
# Return appropriate response type.
|
136
283
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
137
284
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
138
|
-
ApiResponse.new(
|
285
|
+
ApiResponse.new(
|
286
|
+
_response, data: decoded, errors: _errors
|
287
|
+
)
|
139
288
|
end
|
140
289
|
end
|
141
290
|
end
|
@@ -42,7 +42,7 @@ module Square
|
|
42
42
|
_query_builder << '/v2/locations/{location_id}/refunds'
|
43
43
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
44
44
|
_query_builder,
|
45
|
-
'location_id' => location_id
|
45
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
46
46
|
)
|
47
47
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
48
48
|
_query_builder,
|
@@ -69,7 +69,9 @@ module Square
|
|
69
69
|
# Return appropriate response type.
|
70
70
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
71
71
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
72
|
-
ApiResponse.new(
|
72
|
+
ApiResponse.new(
|
73
|
+
_response, data: decoded, errors: _errors
|
74
|
+
)
|
73
75
|
end
|
74
76
|
|
75
77
|
# Lists transactions for a particular location.
|
@@ -106,7 +108,7 @@ module Square
|
|
106
108
|
_query_builder << '/v2/locations/{location_id}/transactions'
|
107
109
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
108
110
|
_query_builder,
|
109
|
-
'location_id' => location_id
|
111
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
110
112
|
)
|
111
113
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
112
114
|
_query_builder,
|
@@ -133,7 +135,9 @@ module Square
|
|
133
135
|
# Return appropriate response type.
|
134
136
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
135
137
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
136
|
-
ApiResponse.new(
|
138
|
+
ApiResponse.new(
|
139
|
+
_response, data: decoded, errors: _errors
|
140
|
+
)
|
137
141
|
end
|
138
142
|
|
139
143
|
# Charges a card represented by a card nonce or a customer's card on file.
|
@@ -169,7 +173,7 @@ module Square
|
|
169
173
|
_query_builder << '/v2/locations/{location_id}/transactions'
|
170
174
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
171
175
|
_query_builder,
|
172
|
-
'location_id' => location_id
|
176
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
173
177
|
)
|
174
178
|
_query_url = APIHelper.clean_url _query_builder
|
175
179
|
|
@@ -191,7 +195,9 @@ module Square
|
|
191
195
|
# Return appropriate response type.
|
192
196
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
193
197
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
194
|
-
ApiResponse.new(
|
198
|
+
ApiResponse.new(
|
199
|
+
_response, data: decoded, errors: _errors
|
200
|
+
)
|
195
201
|
end
|
196
202
|
|
197
203
|
# Retrieves details for a single transaction.
|
@@ -208,8 +214,8 @@ module Square
|
|
208
214
|
_query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
|
209
215
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
210
216
|
_query_builder,
|
211
|
-
'location_id' => location_id,
|
212
|
-
'transaction_id' => transaction_id
|
217
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
218
|
+
'transaction_id' => { 'value' => transaction_id, 'encode' => true }
|
213
219
|
)
|
214
220
|
_query_url = APIHelper.clean_url _query_builder
|
215
221
|
|
@@ -229,7 +235,9 @@ module Square
|
|
229
235
|
# Return appropriate response type.
|
230
236
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
231
237
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
232
|
-
ApiResponse.new(
|
238
|
+
ApiResponse.new(
|
239
|
+
_response, data: decoded, errors: _errors
|
240
|
+
)
|
233
241
|
end
|
234
242
|
|
235
243
|
# Captures a transaction that was created with the
|
@@ -250,8 +258,8 @@ module Square
|
|
250
258
|
_query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
|
251
259
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
252
260
|
_query_builder,
|
253
|
-
'location_id' => location_id,
|
254
|
-
'transaction_id' => transaction_id
|
261
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
262
|
+
'transaction_id' => { 'value' => transaction_id, 'encode' => true }
|
255
263
|
)
|
256
264
|
_query_url = APIHelper.clean_url _query_builder
|
257
265
|
|
@@ -271,7 +279,9 @@ module Square
|
|
271
279
|
# Return appropriate response type.
|
272
280
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
273
281
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
274
|
-
ApiResponse.new(
|
282
|
+
ApiResponse.new(
|
283
|
+
_response, data: decoded, errors: _errors
|
284
|
+
)
|
275
285
|
end
|
276
286
|
|
277
287
|
# Initiates a refund for a previously charged tender.
|
@@ -299,8 +309,8 @@ module Square
|
|
299
309
|
_query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
|
300
310
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
301
311
|
_query_builder,
|
302
|
-
'location_id' => location_id,
|
303
|
-
'transaction_id' => transaction_id
|
312
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
313
|
+
'transaction_id' => { 'value' => transaction_id, 'encode' => true }
|
304
314
|
)
|
305
315
|
_query_url = APIHelper.clean_url _query_builder
|
306
316
|
|
@@ -322,7 +332,9 @@ module Square
|
|
322
332
|
# Return appropriate response type.
|
323
333
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
324
334
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
325
|
-
ApiResponse.new(
|
335
|
+
ApiResponse.new(
|
336
|
+
_response, data: decoded, errors: _errors
|
337
|
+
)
|
326
338
|
end
|
327
339
|
|
328
340
|
# Cancels a transaction that was created with the [Charge](#endpoint-charge)
|
@@ -342,8 +354,8 @@ module Square
|
|
342
354
|
_query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
|
343
355
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
344
356
|
_query_builder,
|
345
|
-
'location_id' => location_id,
|
346
|
-
'transaction_id' => transaction_id
|
357
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
358
|
+
'transaction_id' => { 'value' => transaction_id, 'encode' => true }
|
347
359
|
)
|
348
360
|
_query_url = APIHelper.clean_url _query_builder
|
349
361
|
|
@@ -363,7 +375,9 @@ module Square
|
|
363
375
|
# Return appropriate response type.
|
364
376
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
365
377
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
366
|
-
ApiResponse.new(
|
378
|
+
ApiResponse.new(
|
379
|
+
_response, data: decoded, errors: _errors
|
380
|
+
)
|
367
381
|
end
|
368
382
|
end
|
369
383
|
end
|