square.rb 14.1.0.20210915 → 17.0.0.20211215

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +23 -20
  4. data/lib/square/api/apple_pay_api.rb +1 -1
  5. data/lib/square/api/base_api.rb +8 -4
  6. data/lib/square/api/bookings_api.rb +64 -4
  7. data/lib/square/api/cards_api.rb +1 -1
  8. data/lib/square/api/catalog_api.rb +109 -34
  9. data/lib/square/api/checkout_api.rb +1 -1
  10. data/lib/square/api/customer_groups_api.rb +3 -3
  11. data/lib/square/api/customer_segments_api.rb +1 -1
  12. data/lib/square/api/customers_api.rb +5 -5
  13. data/lib/square/api/devices_api.rb +1 -1
  14. data/lib/square/api/disputes_api.rb +1 -1
  15. data/lib/square/api/gift_card_activities_api.rb +26 -20
  16. data/lib/square/api/gift_cards_api.rb +29 -24
  17. data/lib/square/api/inventory_api.rb +6 -6
  18. data/lib/square/api/invoices_api.rb +5 -5
  19. data/lib/square/api/labor_api.rb +6 -6
  20. data/lib/square/api/locations_api.rb +20 -12
  21. data/lib/square/api/loyalty_api.rb +9 -9
  22. data/lib/square/api/mobile_authorization_api.rb +4 -4
  23. data/lib/square/api/o_auth_api.rb +10 -10
  24. data/lib/square/api/orders_api.rb +7 -7
  25. data/lib/square/api/payments_api.rb +12 -6
  26. data/lib/square/api/refunds_api.rb +1 -1
  27. data/lib/square/api/sites_api.rb +2 -1
  28. data/lib/square/api/snippets_api.rb +1 -1
  29. data/lib/square/api/subscriptions_api.rb +159 -16
  30. data/lib/square/api/team_api.rb +6 -6
  31. data/lib/square/api/terminal_api.rb +4 -4
  32. data/lib/square/api/transactions_api.rb +0 -188
  33. data/lib/square/api/v1_transactions_api.rb +2 -2
  34. data/lib/square/client.rb +12 -6
  35. data/lib/square/configuration.rb +23 -15
  36. data/lib/square/http/api_response.rb +1 -1
  37. data/lib/square/http/faraday_client.rb +20 -1
  38. data/test/api/test_locations_api.rb +2 -5
  39. data/test/test_helper.rb +1 -1
  40. metadata +2 -5
@@ -107,7 +107,7 @@ module Square
107
107
  # Prepare headers.
108
108
  _headers = {
109
109
  'accept' => 'application/json',
110
- 'content-type' => 'application/json; charset=utf-8'
110
+ 'Content-Type' => 'application/json'
111
111
  }
112
112
 
113
113
  # Prepare and execute HttpRequest.
@@ -155,7 +155,7 @@ module Square
155
155
  # Prepare headers.
156
156
  _headers = {
157
157
  'accept' => 'application/json',
158
- 'content-type' => 'application/json; charset=utf-8'
158
+ 'Content-Type' => 'application/json'
159
159
  }
160
160
 
161
161
  # Prepare and execute HttpRequest.
@@ -232,7 +232,7 @@ module Square
232
232
  # Prepare headers.
233
233
  _headers = {
234
234
  'accept' => 'application/json',
235
- 'content-type' => 'application/json; charset=utf-8'
235
+ 'Content-Type' => 'application/json'
236
236
  }
237
237
 
238
238
  # Prepare and execute HttpRequest.
@@ -296,8 +296,12 @@ module Square
296
296
  # `status`.
297
297
  # @param [String] payment_id Required parameter: The unique ID identifying
298
298
  # the payment to be completed.
299
+ # @param [CompletePaymentRequest] body Required parameter: An object
300
+ # containing the fields to POST for the request. See the corresponding
301
+ # object definition for field details.
299
302
  # @return [CompletePaymentResponse Hash] response from the API call
300
- def complete_payment(payment_id:)
303
+ def complete_payment(payment_id:,
304
+ body:)
301
305
  # Prepare query url.
302
306
  _query_builder = config.get_base_uri
303
307
  _query_builder << '/v2/payments/{payment_id}/complete'
@@ -309,13 +313,15 @@ module Square
309
313
 
310
314
  # Prepare headers.
311
315
  _headers = {
312
- 'accept' => 'application/json'
316
+ 'accept' => 'application/json',
317
+ 'Content-Type' => 'application/json'
313
318
  }
314
319
 
315
320
  # Prepare and execute HttpRequest.
316
321
  _request = config.http_client.post(
317
322
  _query_url,
318
- headers: _headers
323
+ headers: _headers,
324
+ parameters: body.to_json
319
325
  )
320
326
  OAuth2.apply(config, _request)
321
327
  _response = execute_request(_request)
@@ -105,7 +105,7 @@ module Square
105
105
  # Prepare headers.
106
106
  _headers = {
107
107
  'accept' => 'application/json',
108
- 'content-type' => 'application/json; charset=utf-8'
108
+ 'Content-Type' => 'application/json'
109
109
  }
110
110
 
111
111
  # Prepare and execute HttpRequest.
@@ -5,7 +5,8 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Lists the Square Online sites that belong to a seller.
8
+ # Lists the Square Online sites that belong to a seller. Sites are listed in
9
+ # descending order by the `created_at` date.
9
10
  # __Note:__ Square Online APIs are publicly available as part of an early
10
11
  # access program. For more information, see [Early access program for Square
11
12
  # Online
@@ -123,7 +123,7 @@ module Square
123
123
  # Prepare headers.
124
124
  _headers = {
125
125
  'accept' => 'application/json',
126
- 'content-type' => 'application/json; charset=utf-8'
126
+ 'Content-Type' => 'application/json'
127
127
  }
128
128
 
129
129
  # Prepare and execute HttpRequest.
@@ -5,7 +5,7 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Creates a subscription for a customer to a subscription plan.
8
+ # Creates a subscription to a subscription plan by a customer.
9
9
  # If you provide a card on file in the request, Square charges the card for
10
10
  # the subscription. Otherwise, Square bills an invoice to the customer's
11
11
  # email
@@ -25,7 +25,7 @@ module Square
25
25
  # Prepare headers.
26
26
  _headers = {
27
27
  'accept' => 'application/json',
28
- 'content-type' => 'application/json; charset=utf-8'
28
+ 'Content-Type' => 'application/json'
29
29
  }
30
30
 
31
31
  # Prepare and execute HttpRequest.
@@ -75,7 +75,7 @@ module Square
75
75
  # Prepare headers.
76
76
  _headers = {
77
77
  'accept' => 'application/json',
78
- 'content-type' => 'application/json; charset=utf-8'
78
+ 'Content-Type' => 'application/json'
79
79
  }
80
80
 
81
81
  # Prepare and execute HttpRequest.
@@ -98,8 +98,13 @@ module Square
98
98
  # Retrieves a subscription.
99
99
  # @param [String] subscription_id Required parameter: The ID of the
100
100
  # subscription to retrieve.
101
+ # @param [String] include Optional parameter: A query parameter to specify
102
+ # related information to be included in the response. The supported query
103
+ # parameter values are: - `actions`: to include scheduled actions on the
104
+ # targeted subscription.
101
105
  # @return [RetrieveSubscriptionResponse Hash] response from the API call
102
- def retrieve_subscription(subscription_id:)
106
+ def retrieve_subscription(subscription_id:,
107
+ include: nil)
103
108
  # Prepare query url.
104
109
  _query_builder = config.get_base_uri
105
110
  _query_builder << '/v2/subscriptions/{subscription_id}'
@@ -107,6 +112,10 @@ module Square
107
112
  _query_builder,
108
113
  'subscription_id' => { 'value' => subscription_id, 'encode' => true }
109
114
  )
115
+ _query_builder = APIHelper.append_url_with_query_parameters(
116
+ _query_builder,
117
+ 'include' => include
118
+ )
110
119
  _query_url = APIHelper.clean_url _query_builder
111
120
 
112
121
  # Prepare headers.
@@ -132,7 +141,7 @@ module Square
132
141
 
133
142
  # Updates a subscription. You can set, modify, and clear the
134
143
  # `subscription` field values.
135
- # @param [String] subscription_id Required parameter: The ID for the
144
+ # @param [String] subscription_id Required parameter: The ID of the
136
145
  # subscription to update.
137
146
  # @param [UpdateSubscriptionRequest] body Required parameter: An object
138
147
  # containing the fields to POST for the request. See the corresponding
@@ -152,7 +161,7 @@ module Square
152
161
  # Prepare headers.
153
162
  _headers = {
154
163
  'accept' => 'application/json',
155
- 'content-type' => 'application/json; charset=utf-8'
164
+ 'Content-Type' => 'application/json'
156
165
  }
157
166
 
158
167
  # Prepare and execute HttpRequest.
@@ -172,8 +181,50 @@ module Square
172
181
  )
173
182
  end
174
183
 
175
- # Sets the `canceled_date` field to the end of the active billing period.
176
- # After this date, the status changes from ACTIVE to CANCELED.
184
+ # Deletes a scheduled action for a subscription.
185
+ # @param [String] subscription_id Required parameter: The ID of the
186
+ # subscription the targeted action is to act upon.
187
+ # @param [String] action_id Required parameter: The ID of the targeted
188
+ # action to be deleted.
189
+ # @return [DeleteSubscriptionActionResponse Hash] response from the API call
190
+ def delete_subscription_action(subscription_id:,
191
+ action_id:)
192
+ # Prepare query url.
193
+ _query_builder = config.get_base_uri
194
+ _query_builder << '/v2/subscriptions/{subscription_id}/actions/{action_id}'
195
+ _query_builder = APIHelper.append_url_with_template_parameters(
196
+ _query_builder,
197
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true },
198
+ 'action_id' => { 'value' => action_id, 'encode' => true }
199
+ )
200
+ _query_url = APIHelper.clean_url _query_builder
201
+
202
+ # Prepare headers.
203
+ _headers = {
204
+ 'accept' => 'application/json'
205
+ }
206
+
207
+ # Prepare and execute HttpRequest.
208
+ _request = config.http_client.delete(
209
+ _query_url,
210
+ headers: _headers
211
+ )
212
+ OAuth2.apply(config, _request)
213
+ _response = execute_request(_request)
214
+
215
+ # Return appropriate response type.
216
+ decoded = APIHelper.json_deserialize(_response.raw_body)
217
+ _errors = APIHelper.map_response(decoded, ['errors'])
218
+ ApiResponse.new(
219
+ _response, data: decoded, errors: _errors
220
+ )
221
+ end
222
+
223
+ # Schedules a `CANCEL` action to cancel an active subscription
224
+ # by setting the `canceled_date` field to the end of the active billing
225
+ # period
226
+ # and changing the subscription status from ACTIVE to CANCELED after this
227
+ # date.
177
228
  # @param [String] subscription_id Required parameter: The ID of the
178
229
  # subscription to cancel.
179
230
  # @return [CancelSubscriptionResponse Hash] response from the API call
@@ -214,13 +265,15 @@ module Square
214
265
  # returned.
215
266
  # @param [String] subscription_id Required parameter: The ID of the
216
267
  # subscription to retrieve the events for.
217
- # @param [String] cursor Optional parameter: A pagination cursor returned by
218
- # a previous call to this endpoint. Provide this to retrieve the next set of
219
- # results for the original query. For more information, see
268
+ # @param [String] cursor Optional parameter: When the total number of
269
+ # resulting subscription events exceeds the limit of a paged response,
270
+ # specify the cursor returned from a preceding response here to fetch the
271
+ # next set of results. If the cursor is unset, the response contains the
272
+ # last page of the results. For more information, see
220
273
  # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
221
274
  # ion).
222
275
  # @param [Integer] limit Optional parameter: The upper limit on the number
223
- # of subscription events to return in the response. Default: `200`
276
+ # of subscription events to return in a paged response.
224
277
  # @return [ListSubscriptionEventsResponse Hash] response from the API call
225
278
  def list_subscription_events(subscription_id:,
226
279
  cursor: nil,
@@ -260,11 +313,57 @@ module Square
260
313
  )
261
314
  end
262
315
 
263
- # Resumes a deactivated subscription.
316
+ # Schedules a `PAUSE` action to pause an active subscription.
317
+ # @param [String] subscription_id Required parameter: The ID of the
318
+ # subscription to pause.
319
+ # @param [PauseSubscriptionRequest] body Required parameter: An object
320
+ # containing the fields to POST for the request. See the corresponding
321
+ # object definition for field details.
322
+ # @return [PauseSubscriptionResponse Hash] response from the API call
323
+ def pause_subscription(subscription_id:,
324
+ body:)
325
+ # Prepare query url.
326
+ _query_builder = config.get_base_uri
327
+ _query_builder << '/v2/subscriptions/{subscription_id}/pause'
328
+ _query_builder = APIHelper.append_url_with_template_parameters(
329
+ _query_builder,
330
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
331
+ )
332
+ _query_url = APIHelper.clean_url _query_builder
333
+
334
+ # Prepare headers.
335
+ _headers = {
336
+ 'accept' => 'application/json',
337
+ 'Content-Type' => 'application/json'
338
+ }
339
+
340
+ # Prepare and execute HttpRequest.
341
+ _request = config.http_client.post(
342
+ _query_url,
343
+ headers: _headers,
344
+ parameters: body.to_json
345
+ )
346
+ OAuth2.apply(config, _request)
347
+ _response = execute_request(_request)
348
+
349
+ # Return appropriate response type.
350
+ decoded = APIHelper.json_deserialize(_response.raw_body)
351
+ _errors = APIHelper.map_response(decoded, ['errors'])
352
+ ApiResponse.new(
353
+ _response, data: decoded, errors: _errors
354
+ )
355
+ end
356
+
357
+ # Schedules a `RESUME` action to resume a paused or a deactivated
358
+ # subscription.
264
359
  # @param [String] subscription_id Required parameter: The ID of the
265
360
  # subscription to resume.
361
+ # @param [ResumeSubscriptionRequest] body Required parameter: An object
362
+ # containing the fields to POST for the request. See the corresponding
363
+ # object definition for field details.
266
364
  # @return [ResumeSubscriptionResponse Hash] response from the API call
267
- def resume_subscription(subscription_id:)
365
+ def resume_subscription(subscription_id:,
366
+ body:)
268
367
  # Prepare query url.
269
368
  _query_builder = config.get_base_uri
270
369
  _query_builder << '/v2/subscriptions/{subscription_id}/resume'
@@ -276,13 +375,57 @@ module Square
276
375
 
277
376
  # Prepare headers.
278
377
  _headers = {
279
- 'accept' => 'application/json'
378
+ 'accept' => 'application/json',
379
+ 'Content-Type' => 'application/json'
280
380
  }
281
381
 
282
382
  # Prepare and execute HttpRequest.
283
383
  _request = config.http_client.post(
284
384
  _query_url,
285
- headers: _headers
385
+ headers: _headers,
386
+ parameters: body.to_json
387
+ )
388
+ OAuth2.apply(config, _request)
389
+ _response = execute_request(_request)
390
+
391
+ # Return appropriate response type.
392
+ decoded = APIHelper.json_deserialize(_response.raw_body)
393
+ _errors = APIHelper.map_response(decoded, ['errors'])
394
+ ApiResponse.new(
395
+ _response, data: decoded, errors: _errors
396
+ )
397
+ end
398
+
399
+ # Schedules a `SWAP_PLAN` action to swap a subscription plan in an existing
400
+ # subscription.
401
+ # @param [String] subscription_id Required parameter: The ID of the
402
+ # subscription to swap the subscription plan for.
403
+ # @param [SwapPlanRequest] body Required parameter: An object containing the
404
+ # fields to POST for the request. See the corresponding object definition
405
+ # for field details.
406
+ # @return [SwapPlanResponse Hash] response from the API call
407
+ def swap_plan(subscription_id:,
408
+ body:)
409
+ # Prepare query url.
410
+ _query_builder = config.get_base_uri
411
+ _query_builder << '/v2/subscriptions/{subscription_id}/swap-plan'
412
+ _query_builder = APIHelper.append_url_with_template_parameters(
413
+ _query_builder,
414
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
415
+ )
416
+ _query_url = APIHelper.clean_url _query_builder
417
+
418
+ # Prepare headers.
419
+ _headers = {
420
+ 'accept' => 'application/json',
421
+ 'Content-Type' => 'application/json'
422
+ }
423
+
424
+ # Prepare and execute HttpRequest.
425
+ _request = config.http_client.post(
426
+ _query_url,
427
+ headers: _headers,
428
+ parameters: body.to_json
286
429
  )
287
430
  OAuth2.apply(config, _request)
288
431
  _response = execute_request(_request)
@@ -26,7 +26,7 @@ module Square
26
26
  # Prepare headers.
27
27
  _headers = {
28
28
  'accept' => 'application/json',
29
- 'content-type' => 'application/json; charset=utf-8'
29
+ 'Content-Type' => 'application/json'
30
30
  }
31
31
 
32
32
  # Prepare and execute HttpRequest.
@@ -69,7 +69,7 @@ module Square
69
69
  # Prepare headers.
70
70
  _headers = {
71
71
  'accept' => 'application/json',
72
- 'content-type' => 'application/json; charset=utf-8'
72
+ 'Content-Type' => 'application/json'
73
73
  }
74
74
 
75
75
  # Prepare and execute HttpRequest.
@@ -112,7 +112,7 @@ module Square
112
112
  # Prepare headers.
113
113
  _headers = {
114
114
  'accept' => 'application/json',
115
- 'content-type' => 'application/json; charset=utf-8'
115
+ 'Content-Type' => 'application/json'
116
116
  }
117
117
 
118
118
  # Prepare and execute HttpRequest.
@@ -149,7 +149,7 @@ module Square
149
149
  # Prepare headers.
150
150
  _headers = {
151
151
  'accept' => 'application/json',
152
- 'content-type' => 'application/json; charset=utf-8'
152
+ 'Content-Type' => 'application/json'
153
153
  }
154
154
 
155
155
  # Prepare and execute HttpRequest.
@@ -232,7 +232,7 @@ module Square
232
232
  # Prepare headers.
233
233
  _headers = {
234
234
  'accept' => 'application/json',
235
- 'content-type' => 'application/json; charset=utf-8'
235
+ 'Content-Type' => 'application/json'
236
236
  }
237
237
 
238
238
  # Prepare and execute HttpRequest.
@@ -319,7 +319,7 @@ module Square
319
319
  # Prepare headers.
320
320
  _headers = {
321
321
  'accept' => 'application/json',
322
- 'content-type' => 'application/json; charset=utf-8'
322
+ 'Content-Type' => 'application/json'
323
323
  }
324
324
 
325
325
  # Prepare and execute HttpRequest.
@@ -21,7 +21,7 @@ module Square
21
21
  # Prepare headers.
22
22
  _headers = {
23
23
  'accept' => 'application/json',
24
- 'content-type' => 'application/json; charset=utf-8'
24
+ 'Content-Type' => 'application/json'
25
25
  }
26
26
 
27
27
  # Prepare and execute HttpRequest.
@@ -56,7 +56,7 @@ module Square
56
56
  # Prepare headers.
57
57
  _headers = {
58
58
  'accept' => 'application/json',
59
- 'content-type' => 'application/json; charset=utf-8'
59
+ 'Content-Type' => 'application/json'
60
60
  }
61
61
 
62
62
  # Prepare and execute HttpRequest.
@@ -162,7 +162,7 @@ module Square
162
162
  # Prepare headers.
163
163
  _headers = {
164
164
  'accept' => 'application/json',
165
- 'content-type' => 'application/json; charset=utf-8'
165
+ 'Content-Type' => 'application/json'
166
166
  }
167
167
 
168
168
  # Prepare and execute HttpRequest.
@@ -197,7 +197,7 @@ module Square
197
197
  # Prepare headers.
198
198
  _headers = {
199
199
  'accept' => 'application/json',
200
- 'content-type' => 'application/json; charset=utf-8'
200
+ 'Content-Type' => 'application/json'
201
201
  }
202
202
 
203
203
  # Prepare and execute HttpRequest.
@@ -5,80 +5,6 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Lists refunds for one of a business's locations.
9
- # In addition to full or partial tender refunds processed through Square
10
- # APIs,
11
- # refunds may result from itemized returns or exchanges through Square's
12
- # Point of Sale applications.
13
- # Refunds with a `status` of `PENDING` are not currently included in this
14
- # endpoint's response.
15
- # Max results per
16
- # [page](https://developer.squareup.com/docs/working-with-apis/pagination):
17
- # 50
18
- # @param [String] location_id Required parameter: The ID of the location to
19
- # list refunds for.
20
- # @param [String] begin_time Optional parameter: The beginning of the
21
- # requested reporting period, in RFC 3339 format. See [Date
22
- # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
23
- # s) for details on date inclusivity/exclusivity. Default value: The
24
- # current time minus one year.
25
- # @param [String] end_time Optional parameter: The end of the requested
26
- # reporting period, in RFC 3339 format. See [Date
27
- # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
28
- # s) for details on date inclusivity/exclusivity. Default value: The
29
- # current time.
30
- # @param [SortOrder] sort_order Optional parameter: The order in which
31
- # results are listed in the response (`ASC` for oldest first, `DESC` for
32
- # newest first). Default value: `DESC`
33
- # @param [String] cursor Optional parameter: A pagination cursor returned by
34
- # a previous call to this endpoint. Provide this to retrieve the next set of
35
- # results for your original query. See [Paginating
36
- # results](https://developer.squareup.com/docs/working-with-apis/pagination)
37
- # for more information.
38
- # @return [ListRefundsResponse Hash] response from the API call
39
- def list_refunds(location_id:,
40
- begin_time: nil,
41
- end_time: nil,
42
- sort_order: nil,
43
- cursor: nil)
44
- warn 'Endpoint list_refunds in TransactionsApi is deprecated'
45
- # Prepare query url.
46
- _query_builder = config.get_base_uri
47
- _query_builder << '/v2/locations/{location_id}/refunds'
48
- _query_builder = APIHelper.append_url_with_template_parameters(
49
- _query_builder,
50
- 'location_id' => { 'value' => location_id, 'encode' => true }
51
- )
52
- _query_builder = APIHelper.append_url_with_query_parameters(
53
- _query_builder,
54
- 'begin_time' => begin_time,
55
- 'end_time' => end_time,
56
- 'sort_order' => sort_order,
57
- 'cursor' => cursor
58
- )
59
- _query_url = APIHelper.clean_url _query_builder
60
-
61
- # Prepare headers.
62
- _headers = {
63
- 'accept' => 'application/json'
64
- }
65
-
66
- # Prepare and execute HttpRequest.
67
- _request = config.http_client.get(
68
- _query_url,
69
- headers: _headers
70
- )
71
- OAuth2.apply(config, _request)
72
- _response = execute_request(_request)
73
-
74
- # Return appropriate response type.
75
- decoded = APIHelper.json_deserialize(_response.raw_body)
76
- _errors = APIHelper.map_response(decoded, ['errors'])
77
- ApiResponse.new(
78
- _response, data: decoded, errors: _errors
79
- )
80
- end
81
-
82
8
  # Lists transactions for a particular location.
83
9
  # Transactions include payment information from sales and exchanges and
84
10
  # refund
@@ -150,67 +76,6 @@ module Square
150
76
  )
151
77
  end
152
78
 
153
- # Charges a card represented by a card nonce or a customer's card on file.
154
- # Your request to this endpoint must include _either_:
155
- # - A value for the `card_nonce` parameter (to charge a card payment token
156
- # generated
157
- # with the Web Payments SDK)
158
- # - Values for the `customer_card_id` and `customer_id` parameters (to
159
- # charge
160
- # a customer's card on file)
161
- # In order for an eCommerce payment to potentially qualify for
162
- # [Square chargeback protection](https://squareup.com/help/article/5394),
163
- # you
164
- # _must_ provide values for the following parameters in your request:
165
- # - `buyer_email_address`
166
- # - At least one of `billing_address` or `shipping_address`
167
- # When this response is returned, the amount of Square's processing fee
168
- # might not yet be
169
- # calculated. To obtain the processing fee, wait about ten seconds and call
170
- # [RetrieveTransaction]($e/Transactions/RetrieveTransaction). See the
171
- # `processing_fee_money`
172
- # field of each [Tender included]($m/Tender) in the transaction.
173
- # @param [String] location_id Required parameter: The ID of the location to
174
- # associate the created transaction with.
175
- # @param [ChargeRequest] body Required parameter: An object containing the
176
- # fields to POST for the request. See the corresponding object definition
177
- # for field details.
178
- # @return [ChargeResponse Hash] response from the API call
179
- def charge(location_id:,
180
- body:)
181
- warn 'Endpoint charge in TransactionsApi is deprecated'
182
- # Prepare query url.
183
- _query_builder = config.get_base_uri
184
- _query_builder << '/v2/locations/{location_id}/transactions'
185
- _query_builder = APIHelper.append_url_with_template_parameters(
186
- _query_builder,
187
- 'location_id' => { 'value' => location_id, 'encode' => true }
188
- )
189
- _query_url = APIHelper.clean_url _query_builder
190
-
191
- # Prepare headers.
192
- _headers = {
193
- 'accept' => 'application/json',
194
- 'content-type' => 'application/json; charset=utf-8'
195
- }
196
-
197
- # Prepare and execute HttpRequest.
198
- _request = config.http_client.post(
199
- _query_url,
200
- headers: _headers,
201
- parameters: body.to_json
202
- )
203
- OAuth2.apply(config, _request)
204
- _response = execute_request(_request)
205
-
206
- # Return appropriate response type.
207
- decoded = APIHelper.json_deserialize(_response.raw_body)
208
- _errors = APIHelper.map_response(decoded, ['errors'])
209
- ApiResponse.new(
210
- _response, data: decoded, errors: _errors
211
- )
212
- end
213
-
214
79
  # Retrieves details for a single transaction.
215
80
  # @param [String] location_id Required parameter: The ID of the
216
81
  # transaction's associated location.
@@ -295,59 +160,6 @@ module Square
295
160
  )
296
161
  end
297
162
 
298
- # Initiates a refund for a previously charged tender.
299
- # You must issue a refund within 120 days of the associated payment. See
300
- # [this article](https://squareup.com/help/us/en/article/5060) for more
301
- # information
302
- # on refund behavior.
303
- # NOTE: Card-present transactions with Interac credit cards **cannot be
304
- # refunded using the Connect API**. Interac transactions must refunded
305
- # in-person (e.g., dipping the card using POS app).
306
- # @param [String] location_id Required parameter: The ID of the original
307
- # transaction's associated location.
308
- # @param [String] transaction_id Required parameter: The ID of the original
309
- # transaction that includes the tender to refund.
310
- # @param [CreateRefundRequest] body Required parameter: An object containing
311
- # the fields to POST for the request. See the corresponding object
312
- # definition for field details.
313
- # @return [CreateRefundResponse Hash] response from the API call
314
- def create_refund(location_id:,
315
- transaction_id:,
316
- body:)
317
- warn 'Endpoint create_refund in TransactionsApi is deprecated'
318
- # Prepare query url.
319
- _query_builder = config.get_base_uri
320
- _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
321
- _query_builder = APIHelper.append_url_with_template_parameters(
322
- _query_builder,
323
- 'location_id' => { 'value' => location_id, 'encode' => true },
324
- 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
325
- )
326
- _query_url = APIHelper.clean_url _query_builder
327
-
328
- # Prepare headers.
329
- _headers = {
330
- 'accept' => 'application/json',
331
- 'content-type' => 'application/json; charset=utf-8'
332
- }
333
-
334
- # Prepare and execute HttpRequest.
335
- _request = config.http_client.post(
336
- _query_url,
337
- headers: _headers,
338
- parameters: body.to_json
339
- )
340
- OAuth2.apply(config, _request)
341
- _response = execute_request(_request)
342
-
343
- # Return appropriate response type.
344
- decoded = APIHelper.json_deserialize(_response.raw_body)
345
- _errors = APIHelper.map_response(decoded, ['errors'])
346
- ApiResponse.new(
347
- _response, data: decoded, errors: _errors
348
- )
349
- end
350
-
351
163
  # Cancels a transaction that was created with the
352
164
  # [Charge]($e/Transactions/Charge)
353
165
  # endpoint with a `delay_capture` value of `true`.
@@ -127,7 +127,7 @@ module Square
127
127
  # Prepare headers.
128
128
  _headers = {
129
129
  'accept' => 'application/json',
130
- 'content-type' => 'application/json; charset=utf-8'
130
+ 'Content-Type' => 'application/json'
131
131
  }
132
132
 
133
133
  # Prepare and execute HttpRequest.
@@ -369,7 +369,7 @@ module Square
369
369
  # Prepare headers.
370
370
  _headers = {
371
371
  'accept' => 'application/json',
372
- 'content-type' => 'application/json; charset=utf-8'
372
+ 'Content-Type' => 'application/json'
373
373
  }
374
374
 
375
375
  # Prepare and execute HttpRequest.