square.rb 6.4.0.20200923 → 9.0.0.20210226
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/LICENSE +1 -1
- data/README.md +43 -31
- data/lib/square.rb +60 -61
- data/lib/square/api/apple_pay_api.rb +5 -3
- data/lib/square/api/bank_accounts_api.rb +16 -19
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +308 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +71 -35
- 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 +9 -5
- 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 +70 -54
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +27 -13
- data/lib/square/api/invoices_api.rb +44 -25
- 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 +60 -66
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +5 -3
- data/lib/square/api/o_auth_api.rb +11 -8
- 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 +32 -26
- data/lib/square/api/subscriptions_api.rb +26 -14
- data/lib/square/api/team_api.rb +46 -30
- 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 +27 -389
- data/lib/square/api/v1_transactions_api.rb +42 -101
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +10 -14
- data/lib/square/configuration.rb +21 -6
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +9 -2
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/test_locations_api.rb +1 -1
- metadata +5 -6
- data/lib/square/api/v1_items_api.rb +0 -1686
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -10,7 +10,7 @@ module Square
|
|
10
10
|
# profiles become available
|
11
11
|
# for the listing operation in well under 30 seconds. Occasionally,
|
12
12
|
# propagation of the new or updated
|
13
|
-
# profiles can take closer to one minute or longer,
|
13
|
+
# profiles can take closer to one minute or longer, especially during
|
14
14
|
# network incidents and outages.
|
15
15
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
16
16
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
@@ -53,7 +53,9 @@ module Square
|
|
53
53
|
# Return appropriate response type.
|
54
54
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
55
55
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
56
|
-
ApiResponse.new(
|
56
|
+
ApiResponse.new(
|
57
|
+
_response, data: decoded, errors: _errors
|
58
|
+
)
|
57
59
|
end
|
58
60
|
|
59
61
|
# Creates a new customer for a business, which can have associated cards on
|
@@ -94,11 +96,13 @@ module Square
|
|
94
96
|
# Return appropriate response type.
|
95
97
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
96
98
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
97
|
-
ApiResponse.new(
|
99
|
+
ApiResponse.new(
|
100
|
+
_response, data: decoded, errors: _errors
|
101
|
+
)
|
98
102
|
end
|
99
103
|
|
100
|
-
# Searches the customer profiles associated with a Square account using
|
101
|
-
#
|
104
|
+
# Searches the customer profiles associated with a Square account using a
|
105
|
+
# supported query filter.
|
102
106
|
# Calling `SearchCustomers` without any explicit query filter returns all
|
103
107
|
# customer profiles ordered alphabetically based on `given_name` and
|
104
108
|
# `family_name`.
|
@@ -106,7 +110,7 @@ module Square
|
|
106
110
|
# profiles become available
|
107
111
|
# for the search operation in well under 30 seconds. Occasionally,
|
108
112
|
# propagation of the new or updated
|
109
|
-
# profiles can take closer to one minute or longer,
|
113
|
+
# profiles can take closer to one minute or longer, especially during
|
110
114
|
# network incidents and outages.
|
111
115
|
# @param [SearchCustomersRequest] body Required parameter: An object
|
112
116
|
# containing the fields to POST for the request. See the corresponding
|
@@ -136,7 +140,9 @@ module Square
|
|
136
140
|
# Return appropriate response type.
|
137
141
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
138
142
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
139
|
-
ApiResponse.new(
|
143
|
+
ApiResponse.new(
|
144
|
+
_response, data: decoded, errors: _errors
|
145
|
+
)
|
140
146
|
end
|
141
147
|
|
142
148
|
# Deletes a customer from a business, along with any linked cards on file.
|
@@ -153,7 +159,7 @@ module Square
|
|
153
159
|
_query_builder << '/v2/customers/{customer_id}'
|
154
160
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
155
161
|
_query_builder,
|
156
|
-
'customer_id' => customer_id
|
162
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
157
163
|
)
|
158
164
|
_query_url = APIHelper.clean_url _query_builder
|
159
165
|
|
@@ -173,7 +179,9 @@ module Square
|
|
173
179
|
# Return appropriate response type.
|
174
180
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
175
181
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
176
|
-
ApiResponse.new(
|
182
|
+
ApiResponse.new(
|
183
|
+
_response, data: decoded, errors: _errors
|
184
|
+
)
|
177
185
|
end
|
178
186
|
|
179
187
|
# Returns details for a single customer.
|
@@ -186,7 +194,7 @@ module Square
|
|
186
194
|
_query_builder << '/v2/customers/{customer_id}'
|
187
195
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
188
196
|
_query_builder,
|
189
|
-
'customer_id' => customer_id
|
197
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
190
198
|
)
|
191
199
|
_query_url = APIHelper.clean_url _query_builder
|
192
200
|
|
@@ -206,7 +214,9 @@ module Square
|
|
206
214
|
# Return appropriate response type.
|
207
215
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
208
216
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
209
|
-
ApiResponse.new(
|
217
|
+
ApiResponse.new(
|
218
|
+
_response, data: decoded, errors: _errors
|
219
|
+
)
|
210
220
|
end
|
211
221
|
|
212
222
|
# Updates the details of an existing customer. When two profiles are merged
|
@@ -216,9 +226,9 @@ module Square
|
|
216
226
|
# You cannot edit a customer's cards on file with this endpoint. To make
|
217
227
|
# changes
|
218
228
|
# to a card on file, you must delete the existing card on file with the
|
219
|
-
# [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint,
|
220
|
-
# new one with the
|
221
|
-
# [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
229
|
+
# [DeleteCustomerCard](#endpoint-Customers-deletecustomercard) endpoint,
|
230
|
+
# then create a new one with the
|
231
|
+
# [CreateCustomerCard](#endpoint-Customers-createcustomercard) endpoint.
|
222
232
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
223
233
|
# update.
|
224
234
|
# @param [UpdateCustomerRequest] body Required parameter: An object
|
@@ -232,7 +242,7 @@ module Square
|
|
232
242
|
_query_builder << '/v2/customers/{customer_id}'
|
233
243
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
234
244
|
_query_builder,
|
235
|
-
'customer_id' => customer_id
|
245
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
236
246
|
)
|
237
247
|
_query_url = APIHelper.clean_url _query_builder
|
238
248
|
|
@@ -254,7 +264,9 @@ module Square
|
|
254
264
|
# Return appropriate response type.
|
255
265
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
256
266
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
257
|
-
ApiResponse.new(
|
267
|
+
ApiResponse.new(
|
268
|
+
_response, data: decoded, errors: _errors
|
269
|
+
)
|
258
270
|
end
|
259
271
|
|
260
272
|
# Adds a card on file to an existing customer.
|
@@ -275,7 +287,7 @@ module Square
|
|
275
287
|
_query_builder << '/v2/customers/{customer_id}/cards'
|
276
288
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
277
289
|
_query_builder,
|
278
|
-
'customer_id' => customer_id
|
290
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
279
291
|
)
|
280
292
|
_query_url = APIHelper.clean_url _query_builder
|
281
293
|
|
@@ -297,7 +309,9 @@ module Square
|
|
297
309
|
# Return appropriate response type.
|
298
310
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
299
311
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
300
|
-
ApiResponse.new(
|
312
|
+
ApiResponse.new(
|
313
|
+
_response, data: decoded, errors: _errors
|
314
|
+
)
|
301
315
|
end
|
302
316
|
|
303
317
|
# Removes a card on file from a customer.
|
@@ -313,8 +327,8 @@ module Square
|
|
313
327
|
_query_builder << '/v2/customers/{customer_id}/cards/{card_id}'
|
314
328
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
315
329
|
_query_builder,
|
316
|
-
'customer_id' => customer_id,
|
317
|
-
'card_id' => card_id
|
330
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
331
|
+
'card_id' => { 'value' => card_id, 'encode' => true }
|
318
332
|
)
|
319
333
|
_query_url = APIHelper.clean_url _query_builder
|
320
334
|
|
@@ -334,7 +348,9 @@ module Square
|
|
334
348
|
# Return appropriate response type.
|
335
349
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
336
350
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
337
|
-
ApiResponse.new(
|
351
|
+
ApiResponse.new(
|
352
|
+
_response, data: decoded, errors: _errors
|
353
|
+
)
|
338
354
|
end
|
339
355
|
|
340
356
|
# Removes a group membership from a customer.
|
@@ -352,8 +368,8 @@ module Square
|
|
352
368
|
_query_builder << '/v2/customers/{customer_id}/groups/{group_id}'
|
353
369
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
354
370
|
_query_builder,
|
355
|
-
'customer_id' => customer_id,
|
356
|
-
'group_id' => group_id
|
371
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
372
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
357
373
|
)
|
358
374
|
_query_url = APIHelper.clean_url _query_builder
|
359
375
|
|
@@ -373,7 +389,9 @@ module Square
|
|
373
389
|
# Return appropriate response type.
|
374
390
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
375
391
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
376
|
-
ApiResponse.new(
|
392
|
+
ApiResponse.new(
|
393
|
+
_response, data: decoded, errors: _errors
|
394
|
+
)
|
377
395
|
end
|
378
396
|
|
379
397
|
# Adds a group membership to a customer.
|
@@ -391,8 +409,8 @@ module Square
|
|
391
409
|
_query_builder << '/v2/customers/{customer_id}/groups/{group_id}'
|
392
410
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
393
411
|
_query_builder,
|
394
|
-
'customer_id' => customer_id,
|
395
|
-
'group_id' => group_id
|
412
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
413
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
396
414
|
)
|
397
415
|
_query_url = APIHelper.clean_url _query_builder
|
398
416
|
|
@@ -412,7 +430,9 @@ module Square
|
|
412
430
|
# Return appropriate response type.
|
413
431
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
414
432
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
415
|
-
ApiResponse.new(
|
433
|
+
ApiResponse.new(
|
434
|
+
_response, data: decoded, errors: _errors
|
435
|
+
)
|
416
436
|
end
|
417
437
|
end
|
418
438
|
end
|
@@ -16,10 +16,14 @@ module Square
|
|
16
16
|
# @param [ProductType] product_type Optional parameter: If specified, only
|
17
17
|
# returns DeviceCodes targeting the specified product type. Returns
|
18
18
|
# DeviceCodes of all product types if empty.
|
19
|
+
# @param [DeviceCodeStatus] status Optional parameter: If specified, returns
|
20
|
+
# DeviceCodes with the specified statuses. Returns DeviceCodes of status
|
21
|
+
# `PAIRED` and `UNPAIRED` if empty.
|
19
22
|
# @return [ListDeviceCodesResponse Hash] response from the API call
|
20
23
|
def list_device_codes(cursor: nil,
|
21
24
|
location_id: nil,
|
22
|
-
product_type: nil
|
25
|
+
product_type: nil,
|
26
|
+
status: nil)
|
23
27
|
# Prepare query url.
|
24
28
|
_query_builder = config.get_base_uri
|
25
29
|
_query_builder << '/v2/devices/codes'
|
@@ -27,7 +31,8 @@ module Square
|
|
27
31
|
_query_builder,
|
28
32
|
'cursor' => cursor,
|
29
33
|
'location_id' => location_id,
|
30
|
-
'product_type' => product_type
|
34
|
+
'product_type' => product_type,
|
35
|
+
'status' => status
|
31
36
|
)
|
32
37
|
_query_url = APIHelper.clean_url _query_builder
|
33
38
|
|
@@ -47,7 +52,9 @@ module Square
|
|
47
52
|
# Return appropriate response type.
|
48
53
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
49
54
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
50
|
-
ApiResponse.new(
|
55
|
+
ApiResponse.new(
|
56
|
+
_response, data: decoded, errors: _errors
|
57
|
+
)
|
51
58
|
end
|
52
59
|
|
53
60
|
# Creates a DeviceCode that can be used to login to a Square Terminal device
|
@@ -81,7 +88,9 @@ module Square
|
|
81
88
|
# Return appropriate response type.
|
82
89
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
83
90
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
84
|
-
ApiResponse.new(
|
91
|
+
ApiResponse.new(
|
92
|
+
_response, data: decoded, errors: _errors
|
93
|
+
)
|
85
94
|
end
|
86
95
|
|
87
96
|
# Retrieves DeviceCode with the associated ID.
|
@@ -94,7 +103,7 @@ module Square
|
|
94
103
|
_query_builder << '/v2/devices/codes/{id}'
|
95
104
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
96
105
|
_query_builder,
|
97
|
-
'id' => id
|
106
|
+
'id' => { 'value' => id, 'encode' => true }
|
98
107
|
)
|
99
108
|
_query_url = APIHelper.clean_url _query_builder
|
100
109
|
|
@@ -114,7 +123,9 @@ module Square
|
|
114
123
|
# Return appropriate response type.
|
115
124
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
116
125
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
117
|
-
ApiResponse.new(
|
126
|
+
ApiResponse.new(
|
127
|
+
_response, data: decoded, errors: _errors
|
128
|
+
)
|
118
129
|
end
|
119
130
|
end
|
120
131
|
end
|
@@ -5,20 +5,19 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Returns a list of disputes associated
|
9
|
-
# with a particular account.
|
8
|
+
# Returns a list of disputes associated with a particular account.
|
10
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
11
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
12
|
-
# results for the original query. For more information, see
|
13
|
-
# [
|
10
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
11
|
+
# set of results for the original query. For more information, see
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
14
13
|
# .
|
15
14
|
# @param [DisputeState] states Optional parameter: The dispute states to
|
16
15
|
# filter the result. If not specified, the endpoint returns all open
|
17
|
-
# disputes (dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
16
|
+
# disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
18
17
|
# @param [String] location_id Optional parameter: The ID of the location for
|
19
|
-
# which to return
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# which to return a list of disputes. If not specified, the endpoint returns
|
19
|
+
# all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or
|
20
|
+
# `LOST`) associated with all locations.
|
22
21
|
# @return [ListDisputesResponse Hash] response from the API call
|
23
22
|
def list_disputes(cursor: nil,
|
24
23
|
states: nil,
|
@@ -50,10 +49,12 @@ module Square
|
|
50
49
|
# Return appropriate response type.
|
51
50
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
52
51
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
53
|
-
ApiResponse.new(
|
52
|
+
ApiResponse.new(
|
53
|
+
_response, data: decoded, errors: _errors
|
54
|
+
)
|
54
55
|
end
|
55
56
|
|
56
|
-
# Returns details
|
57
|
+
# Returns details about a specific dispute.
|
57
58
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
58
59
|
# want more details about.
|
59
60
|
# @return [RetrieveDisputeResponse Hash] response from the API call
|
@@ -63,7 +64,7 @@ module Square
|
|
63
64
|
_query_builder << '/v2/disputes/{dispute_id}'
|
64
65
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
65
66
|
_query_builder,
|
66
|
-
'dispute_id' => dispute_id
|
67
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
67
68
|
)
|
68
69
|
_query_url = APIHelper.clean_url _query_builder
|
69
70
|
|
@@ -83,17 +84,19 @@ module Square
|
|
83
84
|
# Return appropriate response type.
|
84
85
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
86
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
87
|
+
ApiResponse.new(
|
88
|
+
_response, data: decoded, errors: _errors
|
89
|
+
)
|
87
90
|
end
|
88
91
|
|
89
|
-
# Accepts loss on a dispute. Square returns
|
90
|
-
#
|
91
|
-
# dispute state to ACCEPTED.
|
92
|
-
# Square debits the disputed amount from the seller’s Square
|
93
|
-
#
|
94
|
-
# sufficient funds, Square debits the associated bank account.
|
95
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you
|
96
|
-
# to accept.
|
92
|
+
# Accepts the loss on a dispute. Square returns the disputed amount to the
|
93
|
+
# cardholder and
|
94
|
+
# updates the dispute state to ACCEPTED.
|
95
|
+
# Square debits the disputed amount from the seller’s Square account. If the
|
96
|
+
# Square account
|
97
|
+
# does not have sufficient funds, Square debits the associated bank account.
|
98
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
99
|
+
# want to accept.
|
97
100
|
# @return [AcceptDisputeResponse Hash] response from the API call
|
98
101
|
def accept_dispute(dispute_id:)
|
99
102
|
# Prepare query url.
|
@@ -101,7 +104,7 @@ module Square
|
|
101
104
|
_query_builder << '/v2/disputes/{dispute_id}/accept'
|
102
105
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
103
106
|
_query_builder,
|
104
|
-
'dispute_id' => dispute_id
|
107
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
105
108
|
)
|
106
109
|
_query_url = APIHelper.clean_url _query_builder
|
107
110
|
|
@@ -121,7 +124,9 @@ module Square
|
|
121
124
|
# Return appropriate response type.
|
122
125
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
123
126
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
124
|
-
ApiResponse.new(
|
127
|
+
ApiResponse.new(
|
128
|
+
_response, data: decoded, errors: _errors
|
129
|
+
)
|
125
130
|
end
|
126
131
|
|
127
132
|
# Returns a list of evidence associated with a dispute.
|
@@ -133,7 +138,7 @@ module Square
|
|
133
138
|
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
134
139
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
135
140
|
_query_builder,
|
136
|
-
'dispute_id' => dispute_id
|
141
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
137
142
|
)
|
138
143
|
_query_url = APIHelper.clean_url _query_builder
|
139
144
|
|
@@ -153,12 +158,14 @@ module Square
|
|
153
158
|
# Return appropriate response type.
|
154
159
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
155
160
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
156
|
-
ApiResponse.new(
|
161
|
+
ApiResponse.new(
|
162
|
+
_response, data: decoded, errors: _errors
|
163
|
+
)
|
157
164
|
end
|
158
165
|
|
159
166
|
# Removes specified evidence from a dispute.
|
160
|
-
# Square does not send the bank any evidence that
|
161
|
-
#
|
167
|
+
# Square does not send the bank any evidence that is removed. Also, you
|
168
|
+
# cannot remove evidence after
|
162
169
|
# submitting it to the bank using
|
163
170
|
# [SubmitEvidence](https://developer.squareup.com/docs/reference/square/disp
|
164
171
|
# utes-api/submit-evidence).
|
@@ -174,8 +181,8 @@ module Square
|
|
174
181
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
175
182
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
176
183
|
_query_builder,
|
177
|
-
'dispute_id' => dispute_id,
|
178
|
-
'evidence_id' => evidence_id
|
184
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
185
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
179
186
|
)
|
180
187
|
_query_url = APIHelper.clean_url _query_builder
|
181
188
|
|
@@ -195,13 +202,15 @@ module Square
|
|
195
202
|
# Return appropriate response type.
|
196
203
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
197
204
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
198
|
-
ApiResponse.new(
|
205
|
+
ApiResponse.new(
|
206
|
+
_response, data: decoded, errors: _errors
|
207
|
+
)
|
199
208
|
end
|
200
209
|
|
201
210
|
# Returns the specific evidence metadata associated with a specific dispute.
|
202
211
|
# You must maintain a copy of the evidence you upload if you want to
|
203
|
-
# reference it later. You cannot
|
204
|
-
# after you upload it.
|
212
|
+
# reference it later. You cannot
|
213
|
+
# download the evidence after you upload it.
|
205
214
|
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
206
215
|
# you want to retrieve evidence from.
|
207
216
|
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
@@ -214,8 +223,8 @@ module Square
|
|
214
223
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
215
224
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
216
225
|
_query_builder,
|
217
|
-
'dispute_id' => dispute_id,
|
218
|
-
'evidence_id' => evidence_id
|
226
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
227
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
219
228
|
)
|
220
229
|
_query_url = APIHelper.clean_url _query_builder
|
221
230
|
|
@@ -235,17 +244,19 @@ module Square
|
|
235
244
|
# Return appropriate response type.
|
236
245
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
237
246
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
238
|
-
ApiResponse.new(
|
247
|
+
ApiResponse.new(
|
248
|
+
_response, data: decoded, errors: _errors
|
249
|
+
)
|
239
250
|
end
|
240
251
|
|
241
252
|
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
242
|
-
# accepts
|
243
|
-
#
|
244
|
-
#
|
245
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you
|
246
|
-
# to upload evidence for.
|
253
|
+
# accepts HTTP
|
254
|
+
# multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF
|
255
|
+
# formats.
|
256
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
257
|
+
# want to upload evidence for.
|
247
258
|
# @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
|
248
|
-
# Defines parameters for a CreateDisputeEvidenceFile request.
|
259
|
+
# Defines the parameters for a `CreateDisputeEvidenceFile` request.
|
249
260
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
250
261
|
# @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
|
251
262
|
def create_dispute_evidence_file(dispute_id:,
|
@@ -256,7 +267,7 @@ module Square
|
|
256
267
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_file'
|
257
268
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
258
269
|
_query_builder,
|
259
|
-
'dispute_id' => dispute_id
|
270
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
260
271
|
)
|
261
272
|
_query_url = APIHelper.clean_url _query_builder
|
262
273
|
|
@@ -298,7 +309,9 @@ module Square
|
|
298
309
|
# Return appropriate response type.
|
299
310
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
300
311
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
301
|
-
ApiResponse.new(
|
312
|
+
ApiResponse.new(
|
313
|
+
_response, data: decoded, errors: _errors
|
314
|
+
)
|
302
315
|
end
|
303
316
|
|
304
317
|
# Uploads text to use as evidence for a dispute challenge.
|
@@ -315,7 +328,7 @@ module Square
|
|
315
328
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_text'
|
316
329
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
317
330
|
_query_builder,
|
318
|
-
'dispute_id' => dispute_id
|
331
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
319
332
|
)
|
320
333
|
_query_url = APIHelper.clean_url _query_builder
|
321
334
|
|
@@ -337,21 +350,22 @@ module Square
|
|
337
350
|
# Return appropriate response type.
|
338
351
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
339
352
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
340
|
-
ApiResponse.new(
|
353
|
+
ApiResponse.new(
|
354
|
+
_response, data: decoded, errors: _errors
|
355
|
+
)
|
341
356
|
end
|
342
357
|
|
343
358
|
# Submits evidence to the cardholder's bank.
|
344
359
|
# Before submitting evidence, Square compiles all available evidence. This
|
345
|
-
# includes
|
346
|
-
#
|
360
|
+
# includes evidence uploaded
|
361
|
+
# using the
|
347
362
|
# [CreateDisputeEvidenceFile](https://developer.squareup.com/docs/reference/
|
348
363
|
# square/disputes-api/create-dispute-evidence-file) and
|
349
364
|
# [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
|
350
|
-
# square/disputes-api/create-dispute-evidence-text) endpoints
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
# want to submit evidence for.
|
365
|
+
# square/disputes-api/create-dispute-evidence-text) endpoints and
|
366
|
+
# evidence automatically provided by Square, when available.
|
367
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
368
|
+
# you want to submit evidence for.
|
355
369
|
# @return [SubmitEvidenceResponse Hash] response from the API call
|
356
370
|
def submit_evidence(dispute_id:)
|
357
371
|
# Prepare query url.
|
@@ -359,7 +373,7 @@ module Square
|
|
359
373
|
_query_builder << '/v2/disputes/{dispute_id}/submit-evidence'
|
360
374
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
361
375
|
_query_builder,
|
362
|
-
'dispute_id' => dispute_id
|
376
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
363
377
|
)
|
364
378
|
_query_url = APIHelper.clean_url _query_builder
|
365
379
|
|
@@ -379,7 +393,9 @@ module Square
|
|
379
393
|
# Return appropriate response type.
|
380
394
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
381
395
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
382
|
-
ApiResponse.new(
|
396
|
+
ApiResponse.new(
|
397
|
+
_response, data: decoded, errors: _errors
|
398
|
+
)
|
383
399
|
end
|
384
400
|
end
|
385
401
|
end
|