square.rb 8.0.0.20201216 → 26.1.0.20230119

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +79 -221
  4. data/lib/square/api/apple_pay_api.rb +15 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +27 -9
  7. data/lib/square/api/booking_custom_attributes_api.rb +555 -0
  8. data/lib/square/api/bookings_api.rb +107 -15
  9. data/lib/square/api/cards_api.rb +171 -0
  10. data/lib/square/api/cash_drawers_api.rb +2 -2
  11. data/lib/square/api/catalog_api.rb +167 -73
  12. data/lib/square/api/checkout_api.rb +205 -3
  13. data/lib/square/api/customer_custom_attributes_api.rb +561 -0
  14. data/lib/square/api/customer_groups_api.rb +17 -8
  15. data/lib/square/api/customer_segments_api.rb +15 -6
  16. data/lib/square/api/customers_api.rb +67 -33
  17. data/lib/square/api/devices_api.rb +3 -2
  18. data/lib/square/api/disputes_api.rb +109 -105
  19. data/lib/square/api/gift_card_activities_api.rb +132 -0
  20. data/lib/square/api/gift_cards_api.rb +298 -0
  21. data/lib/square/api/inventory_api.rb +263 -24
  22. data/lib/square/api/invoices_api.rb +21 -21
  23. data/lib/square/api/labor_api.rb +70 -68
  24. data/lib/square/api/location_custom_attributes_api.rb +584 -0
  25. data/lib/square/api/locations_api.rb +21 -14
  26. data/lib/square/api/loyalty_api.rb +333 -50
  27. data/lib/square/api/merchants_api.rb +11 -9
  28. data/lib/square/api/mobile_authorization_api.rb +4 -4
  29. data/lib/square/api/o_auth_api.rb +78 -25
  30. data/lib/square/api/order_custom_attributes_api.rb +601 -0
  31. data/lib/square/api/orders_api.rb +84 -45
  32. data/lib/square/api/payments_api.rb +72 -24
  33. data/lib/square/api/payouts_api.rb +173 -0
  34. data/lib/square/api/refunds_api.rb +18 -7
  35. data/lib/square/api/sites_api.rb +43 -0
  36. data/lib/square/api/snippets_api.rb +146 -0
  37. data/lib/square/api/subscriptions_api.rb +190 -15
  38. data/lib/square/api/team_api.rb +46 -46
  39. data/lib/square/api/terminal_api.rb +172 -22
  40. data/lib/square/api/transactions_api.rb +15 -191
  41. data/lib/square/api/v1_transactions_api.rb +52 -124
  42. data/lib/square/api/vendors_api.rb +257 -0
  43. data/lib/square/api/webhook_subscriptions_api.rb +327 -0
  44. data/lib/square/api_helper.rb +217 -57
  45. data/lib/square/client.rb +90 -18
  46. data/lib/square/configuration.rb +64 -20
  47. data/lib/square/exceptions/validation_exception.rb +13 -0
  48. data/lib/square/http/api_response.rb +7 -9
  49. data/lib/square/http/faraday_client.rb +40 -9
  50. data/lib/square/http/http_client.rb +31 -12
  51. data/lib/square/http/http_request.rb +6 -2
  52. data/lib/square/utilities/date_time_helper.rb +151 -0
  53. data/lib/square/utilities/file_wrapper.rb +1 -2
  54. data/lib/square.rb +56 -44
  55. data/test/api/test_locations_api.rb +2 -5
  56. data/test/test_helper.rb +2 -2
  57. metadata +83 -15
  58. data/lib/square/api/v1_employees_api.rb +0 -751
  59. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -5,15 +5,55 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Returns the [InventoryAdjustment](#type-inventoryadjustment) object
8
+ # Deprecated version of
9
+ # [RetrieveInventoryAdjustment]($e/Inventory/RetrieveInventoryAdjustment)
10
+ # after the endpoint URL
11
+ # is updated to conform to the standard convention.
12
+ # @param [String] adjustment_id Required parameter: ID of the
13
+ # [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
14
+ # @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
15
+ def deprecated_retrieve_inventory_adjustment(adjustment_id:)
16
+ warn 'Endpoint deprecated_retrieve_inventory_adjustment in InventoryApi '\
17
+ 'is deprecated'
18
+ # Prepare query url.
19
+ _query_builder = config.get_base_uri
20
+ _query_builder << '/v2/inventory/adjustment/{adjustment_id}'
21
+ _query_builder = APIHelper.append_url_with_template_parameters(
22
+ _query_builder,
23
+ 'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
24
+ )
25
+ _query_url = APIHelper.clean_url _query_builder
26
+
27
+ # Prepare headers.
28
+ _headers = {
29
+ 'accept' => 'application/json'
30
+ }
31
+
32
+ # Prepare and execute HttpRequest.
33
+ _request = config.http_client.get(
34
+ _query_url,
35
+ headers: _headers
36
+ )
37
+ OAuth2.apply(config, _request)
38
+ _response = execute_request(_request)
39
+
40
+ # Return appropriate response type.
41
+ decoded = APIHelper.json_deserialize(_response.raw_body)
42
+ _errors = APIHelper.map_response(decoded, ['errors'])
43
+ ApiResponse.new(
44
+ _response, data: decoded, errors: _errors
45
+ )
46
+ end
47
+
48
+ # Returns the [InventoryAdjustment]($m/InventoryAdjustment) object
9
49
  # with the provided `adjustment_id`.
10
50
  # @param [String] adjustment_id Required parameter: ID of the
11
- # [InventoryAdjustment](#type-inventoryadjustment) to retrieve.
51
+ # [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
12
52
  # @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
13
53
  def retrieve_inventory_adjustment(adjustment_id:)
14
54
  # Prepare query url.
15
55
  _query_builder = config.get_base_uri
16
- _query_builder << '/v2/inventory/adjustment/{adjustment_id}'
56
+ _query_builder << '/v2/inventory/adjustments/{adjustment_id}'
17
57
  _query_builder = APIHelper.append_url_with_template_parameters(
18
58
  _query_builder,
19
59
  'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
@@ -41,6 +81,123 @@ module Square
41
81
  )
42
82
  end
43
83
 
84
+ # Deprecated version of
85
+ # [BatchChangeInventory]($e/Inventory/BatchChangeInventory) after the
86
+ # endpoint URL
87
+ # is updated to conform to the standard convention.
88
+ # @param [BatchChangeInventoryRequest] body Required parameter: An object
89
+ # containing the fields to POST for the request. See the corresponding
90
+ # object definition for field details.
91
+ # @return [BatchChangeInventoryResponse Hash] response from the API call
92
+ def deprecated_batch_change_inventory(body:)
93
+ warn 'Endpoint deprecated_batch_change_inventory in InventoryApi is depr'\
94
+ 'ecated'
95
+ # Prepare query url.
96
+ _query_builder = config.get_base_uri
97
+ _query_builder << '/v2/inventory/batch-change'
98
+ _query_url = APIHelper.clean_url _query_builder
99
+
100
+ # Prepare headers.
101
+ _headers = {
102
+ 'accept' => 'application/json',
103
+ 'Content-Type' => 'application/json'
104
+ }
105
+
106
+ # Prepare and execute HttpRequest.
107
+ _request = config.http_client.post(
108
+ _query_url,
109
+ headers: _headers,
110
+ parameters: body.to_json
111
+ )
112
+ OAuth2.apply(config, _request)
113
+ _response = execute_request(_request)
114
+
115
+ # Return appropriate response type.
116
+ decoded = APIHelper.json_deserialize(_response.raw_body)
117
+ _errors = APIHelper.map_response(decoded, ['errors'])
118
+ ApiResponse.new(
119
+ _response, data: decoded, errors: _errors
120
+ )
121
+ end
122
+
123
+ # Deprecated version of
124
+ # [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
125
+ # ) after the endpoint URL
126
+ # is updated to conform to the standard convention.
127
+ # @param [BatchRetrieveInventoryChangesRequest] body Required parameter: An
128
+ # object containing the fields to POST for the request. See the
129
+ # corresponding object definition for field details.
130
+ # @return [BatchRetrieveInventoryChangesResponse Hash] response from the API call
131
+ def deprecated_batch_retrieve_inventory_changes(body:)
132
+ warn 'Endpoint deprecated_batch_retrieve_inventory_changes in InventoryA'\
133
+ 'pi is deprecated'
134
+ # Prepare query url.
135
+ _query_builder = config.get_base_uri
136
+ _query_builder << '/v2/inventory/batch-retrieve-changes'
137
+ _query_url = APIHelper.clean_url _query_builder
138
+
139
+ # Prepare headers.
140
+ _headers = {
141
+ 'accept' => 'application/json',
142
+ 'Content-Type' => 'application/json'
143
+ }
144
+
145
+ # Prepare and execute HttpRequest.
146
+ _request = config.http_client.post(
147
+ _query_url,
148
+ headers: _headers,
149
+ parameters: body.to_json
150
+ )
151
+ OAuth2.apply(config, _request)
152
+ _response = execute_request(_request)
153
+
154
+ # Return appropriate response type.
155
+ decoded = APIHelper.json_deserialize(_response.raw_body)
156
+ _errors = APIHelper.map_response(decoded, ['errors'])
157
+ ApiResponse.new(
158
+ _response, data: decoded, errors: _errors
159
+ )
160
+ end
161
+
162
+ # Deprecated version of
163
+ # [BatchRetrieveInventoryCounts]($e/Inventory/BatchRetrieveInventoryCounts)
164
+ # after the endpoint URL
165
+ # is updated to conform to the standard convention.
166
+ # @param [BatchRetrieveInventoryCountsRequest] body Required parameter: An
167
+ # object containing the fields to POST for the request. See the
168
+ # corresponding object definition for field details.
169
+ # @return [BatchRetrieveInventoryCountsResponse Hash] response from the API call
170
+ def deprecated_batch_retrieve_inventory_counts(body:)
171
+ warn 'Endpoint deprecated_batch_retrieve_inventory_counts in InventoryAp'\
172
+ 'i is deprecated'
173
+ # Prepare query url.
174
+ _query_builder = config.get_base_uri
175
+ _query_builder << '/v2/inventory/batch-retrieve-counts'
176
+ _query_url = APIHelper.clean_url _query_builder
177
+
178
+ # Prepare headers.
179
+ _headers = {
180
+ 'accept' => 'application/json',
181
+ 'Content-Type' => 'application/json'
182
+ }
183
+
184
+ # Prepare and execute HttpRequest.
185
+ _request = config.http_client.post(
186
+ _query_url,
187
+ headers: _headers,
188
+ parameters: body.to_json
189
+ )
190
+ OAuth2.apply(config, _request)
191
+ _response = execute_request(_request)
192
+
193
+ # Return appropriate response type.
194
+ decoded = APIHelper.json_deserialize(_response.raw_body)
195
+ _errors = APIHelper.map_response(decoded, ['errors'])
196
+ ApiResponse.new(
197
+ _response, data: decoded, errors: _errors
198
+ )
199
+ end
200
+
44
201
  # Applies adjustments and counts to the provided item quantities.
45
202
  # On success: returns the current calculated counts for all objects
46
203
  # referenced in the request.
@@ -52,13 +209,13 @@ module Square
52
209
  def batch_change_inventory(body:)
53
210
  # Prepare query url.
54
211
  _query_builder = config.get_base_uri
55
- _query_builder << '/v2/inventory/batch-change'
212
+ _query_builder << '/v2/inventory/changes/batch-create'
56
213
  _query_url = APIHelper.clean_url _query_builder
57
214
 
58
215
  # Prepare headers.
59
216
  _headers = {
60
217
  'accept' => 'application/json',
61
- 'content-type' => 'application/json; charset=utf-8'
218
+ 'Content-Type' => 'application/json'
62
219
  }
63
220
 
64
221
  # Prepare and execute HttpRequest.
@@ -91,13 +248,13 @@ module Square
91
248
  def batch_retrieve_inventory_changes(body:)
92
249
  # Prepare query url.
93
250
  _query_builder = config.get_base_uri
94
- _query_builder << '/v2/inventory/batch-retrieve-changes'
251
+ _query_builder << '/v2/inventory/changes/batch-retrieve'
95
252
  _query_url = APIHelper.clean_url _query_builder
96
253
 
97
254
  # Prepare headers.
98
255
  _headers = {
99
256
  'accept' => 'application/json',
100
- 'content-type' => 'application/json; charset=utf-8'
257
+ 'Content-Type' => 'application/json'
101
258
  }
102
259
 
103
260
  # Prepare and execute HttpRequest.
@@ -118,8 +275,8 @@ module Square
118
275
  end
119
276
 
120
277
  # Returns current counts for the provided
121
- # [CatalogObject](#type-catalogobject)s at the requested
122
- # [Location](#type-location)s.
278
+ # [CatalogObject]($m/CatalogObject)s at the requested
279
+ # [Location]($m/Location)s.
123
280
  # Results are paginated and sorted in descending order according to their
124
281
  # `calculated_at` timestamp (newest first).
125
282
  # When `updated_after` is specified, only counts that have changed since
@@ -134,13 +291,13 @@ module Square
134
291
  def batch_retrieve_inventory_counts(body:)
135
292
  # Prepare query url.
136
293
  _query_builder = config.get_base_uri
137
- _query_builder << '/v2/inventory/batch-retrieve-counts'
294
+ _query_builder << '/v2/inventory/counts/batch-retrieve'
138
295
  _query_url = APIHelper.clean_url _query_builder
139
296
 
140
297
  # Prepare headers.
141
298
  _headers = {
142
299
  'accept' => 'application/json',
143
- 'content-type' => 'application/json; charset=utf-8'
300
+ 'Content-Type' => 'application/json'
144
301
  }
145
302
 
146
303
  # Prepare and execute HttpRequest.
@@ -160,15 +317,55 @@ module Square
160
317
  )
161
318
  end
162
319
 
163
- # Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount)
320
+ # Deprecated version of
321
+ # [RetrieveInventoryPhysicalCount]($e/Inventory/RetrieveInventoryPhysicalCou
322
+ # nt) after the endpoint URL
323
+ # is updated to conform to the standard convention.
324
+ # @param [String] physical_count_id Required parameter: ID of the
325
+ # [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
326
+ # @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
327
+ def deprecated_retrieve_inventory_physical_count(physical_count_id:)
328
+ warn 'Endpoint deprecated_retrieve_inventory_physical_count in Inventory'\
329
+ 'Api is deprecated'
330
+ # Prepare query url.
331
+ _query_builder = config.get_base_uri
332
+ _query_builder << '/v2/inventory/physical-count/{physical_count_id}'
333
+ _query_builder = APIHelper.append_url_with_template_parameters(
334
+ _query_builder,
335
+ 'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
336
+ )
337
+ _query_url = APIHelper.clean_url _query_builder
338
+
339
+ # Prepare headers.
340
+ _headers = {
341
+ 'accept' => 'application/json'
342
+ }
343
+
344
+ # Prepare and execute HttpRequest.
345
+ _request = config.http_client.get(
346
+ _query_url,
347
+ headers: _headers
348
+ )
349
+ OAuth2.apply(config, _request)
350
+ _response = execute_request(_request)
351
+
352
+ # Return appropriate response type.
353
+ decoded = APIHelper.json_deserialize(_response.raw_body)
354
+ _errors = APIHelper.map_response(decoded, ['errors'])
355
+ ApiResponse.new(
356
+ _response, data: decoded, errors: _errors
357
+ )
358
+ end
359
+
360
+ # Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount)
164
361
  # object with the provided `physical_count_id`.
165
362
  # @param [String] physical_count_id Required parameter: ID of the
166
- # [InventoryPhysicalCount](#type-inventoryphysicalcount) to retrieve.
363
+ # [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
167
364
  # @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
168
365
  def retrieve_inventory_physical_count(physical_count_id:)
169
366
  # Prepare query url.
170
367
  _query_builder = config.get_base_uri
171
- _query_builder << '/v2/inventory/physical-count/{physical_count_id}'
368
+ _query_builder << '/v2/inventory/physical-counts/{physical_count_id}'
172
369
  _query_builder = APIHelper.append_url_with_template_parameters(
173
370
  _query_builder,
174
371
  'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
@@ -196,15 +393,51 @@ module Square
196
393
  )
197
394
  end
198
395
 
396
+ # Returns the [InventoryTransfer]($m/InventoryTransfer) object
397
+ # with the provided `transfer_id`.
398
+ # @param [String] transfer_id Required parameter: ID of the
399
+ # [InventoryTransfer]($m/InventoryTransfer) to retrieve.
400
+ # @return [RetrieveInventoryTransferResponse Hash] response from the API call
401
+ def retrieve_inventory_transfer(transfer_id:)
402
+ # Prepare query url.
403
+ _query_builder = config.get_base_uri
404
+ _query_builder << '/v2/inventory/transfers/{transfer_id}'
405
+ _query_builder = APIHelper.append_url_with_template_parameters(
406
+ _query_builder,
407
+ 'transfer_id' => { 'value' => transfer_id, 'encode' => true }
408
+ )
409
+ _query_url = APIHelper.clean_url _query_builder
410
+
411
+ # Prepare headers.
412
+ _headers = {
413
+ 'accept' => 'application/json'
414
+ }
415
+
416
+ # Prepare and execute HttpRequest.
417
+ _request = config.http_client.get(
418
+ _query_url,
419
+ headers: _headers
420
+ )
421
+ OAuth2.apply(config, _request)
422
+ _response = execute_request(_request)
423
+
424
+ # Return appropriate response type.
425
+ decoded = APIHelper.json_deserialize(_response.raw_body)
426
+ _errors = APIHelper.map_response(decoded, ['errors'])
427
+ ApiResponse.new(
428
+ _response, data: decoded, errors: _errors
429
+ )
430
+ end
431
+
199
432
  # Retrieves the current calculated stock count for a given
200
- # [CatalogObject](#type-catalogobject) at a given set of
201
- # [Location](#type-location)s. Responses are paginated and unsorted.
433
+ # [CatalogObject]($m/CatalogObject) at a given set of
434
+ # [Location]($m/Location)s. Responses are paginated and unsorted.
202
435
  # For more sophisticated queries, use a batch endpoint.
203
436
  # @param [String] catalog_object_id Required parameter: ID of the
204
- # [CatalogObject](#type-catalogobject) to retrieve.
437
+ # [CatalogObject]($m/CatalogObject) to retrieve.
205
438
  # @param [String] location_ids Optional parameter: The
206
- # [Location](#type-location) IDs to look up as a comma-separated list. An
207
- # empty list queries all locations.
439
+ # [Location]($m/Location) IDs to look up as a comma-separated list. An empty
440
+ # list queries all locations.
208
441
  # @param [String] cursor Optional parameter: A pagination cursor returned by
209
442
  # a previous call to this endpoint. Provide this to retrieve the next set of
210
443
  # results for the original query. See the
@@ -250,8 +483,13 @@ module Square
250
483
  end
251
484
 
252
485
  # Returns a set of physical counts and inventory adjustments for the
253
- # provided [CatalogObject](#type-catalogobject) at the requested
254
- # [Location](#type-location)s.
486
+ # provided [CatalogObject]($m/CatalogObject) at the requested
487
+ # [Location]($m/Location)s.
488
+ # You can achieve the same result by calling
489
+ # [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
490
+ # )
491
+ # and having the `catalog_object_ids` list contain a single element of the
492
+ # `CatalogObject` ID.
255
493
  # Results are paginated and sorted in descending order according to their
256
494
  # `occurred_at` timestamp (newest first).
257
495
  # There are no limits on how far back the caller can page. This endpoint can
@@ -259,10 +497,10 @@ module Square
259
497
  # used to display recent changes for a specific item. For more
260
498
  # sophisticated queries, use a batch endpoint.
261
499
  # @param [String] catalog_object_id Required parameter: ID of the
262
- # [CatalogObject](#type-catalogobject) to retrieve.
500
+ # [CatalogObject]($m/CatalogObject) to retrieve.
263
501
  # @param [String] location_ids Optional parameter: The
264
- # [Location](#type-location) IDs to look up as a comma-separated list. An
265
- # empty list queries all locations.
502
+ # [Location]($m/Location) IDs to look up as a comma-separated list. An empty
503
+ # list queries all locations.
266
504
  # @param [String] cursor Optional parameter: A pagination cursor returned by
267
505
  # a previous call to this endpoint. Provide this to retrieve the next set of
268
506
  # results for the original query. See the
@@ -272,6 +510,7 @@ module Square
272
510
  def retrieve_inventory_changes(catalog_object_id:,
273
511
  location_ids: nil,
274
512
  cursor: nil)
513
+ warn 'Endpoint retrieve_inventory_changes in InventoryApi is deprecated'
275
514
  # Prepare query url.
276
515
  _query_builder = config.get_base_uri
277
516
  _query_builder << '/v2/inventory/{catalog_object_id}/changes'
@@ -7,7 +7,7 @@ module Square
7
7
 
8
8
  # Returns a list of invoices for a given location. The response
9
9
  # is paginated. If truncated, the response includes a `cursor` that you
10
- # use in a subsequent request to fetch the next set of invoices.
10
+ # use in a subsequent request to retrieve the next set of invoices.
11
11
  # @param [String] location_id Required parameter: The ID of the location for
12
12
  # which to list invoices.
13
13
  # @param [String] cursor Optional parameter: A pagination cursor returned by
@@ -16,7 +16,7 @@ module Square
16
16
  # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
17
17
  # ion).
18
18
  # @param [Integer] limit Optional parameter: The maximum number of invoices
19
- # to return (200 is the maximum `limit`). If not provided, the server uses
19
+ # to return (200 is the maximum `limit`). If not provided, the server uses
20
20
  # a default limit of 100 invoices.
21
21
  # @return [ListInvoicesResponse Hash] response from the API call
22
22
  def list_invoices(location_id:,
@@ -54,7 +54,7 @@ module Square
54
54
  )
55
55
  end
56
56
 
57
- # Creates a draft [invoice](#type-invoice)
57
+ # Creates a draft [invoice]($m/Invoice)
58
58
  # for an order created using the Orders API.
59
59
  # A draft invoice remains in your account and no action is taken.
60
60
  # You must publish the invoice before Square can process it (send it to the
@@ -72,7 +72,7 @@ module Square
72
72
  # Prepare headers.
73
73
  _headers = {
74
74
  'accept' => 'application/json',
75
- 'content-type' => 'application/json; charset=utf-8'
75
+ 'Content-Type' => 'application/json'
76
76
  }
77
77
 
78
78
  # Prepare and execute HttpRequest.
@@ -98,7 +98,7 @@ module Square
98
98
  # location and
99
99
  # optionally one customer.
100
100
  # The response is paginated. If truncated, the response includes a `cursor`
101
- # that you use in a subsequent request to fetch the next set of invoices.
101
+ # that you use in a subsequent request to retrieve the next set of invoices.
102
102
  # @param [SearchInvoicesRequest] body Required parameter: An object
103
103
  # containing the fields to POST for the request. See the corresponding
104
104
  # object definition for field details.
@@ -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.
@@ -133,15 +133,15 @@ module Square
133
133
  end
134
134
 
135
135
  # Deletes the specified invoice. When an invoice is deleted, the
136
- # associated Order status changes to CANCELED. You can only delete a draft
136
+ # associated order status changes to CANCELED. You can only delete a draft
137
137
  # invoice (you cannot delete a published invoice, including one that is
138
138
  # scheduled for processing).
139
139
  # @param [String] invoice_id Required parameter: The ID of the invoice to
140
140
  # delete.
141
141
  # @param [Integer] version Optional parameter: The version of the
142
- # [invoice](#type-invoice) to delete. If you do not know the version, you
143
- # can call [GetInvoice](#endpoint-Invoices-GetInvoice) or
144
- # [ListInvoices](#endpoint-Invoices-ListInvoices).
142
+ # [invoice]($m/Invoice) to delete. If you do not know the version, you can
143
+ # call [GetInvoice]($e/Invoices/GetInvoice) or
144
+ # [ListInvoices]($e/Invoices/ListInvoices).
145
145
  # @return [DeleteInvoiceResponse Hash] response from the API call
146
146
  def delete_invoice(invoice_id:,
147
147
  version: nil)
@@ -180,7 +180,7 @@ module Square
180
180
  end
181
181
 
182
182
  # Retrieves an invoice by invoice ID.
183
- # @param [String] invoice_id Required parameter: The id of the invoice to
183
+ # @param [String] invoice_id Required parameter: The ID of the invoice to
184
184
  # retrieve.
185
185
  # @return [GetInvoiceResponse Hash] response from the API call
186
186
  def get_invoice(invoice_id:)
@@ -216,10 +216,10 @@ module Square
216
216
 
217
217
  # Updates an invoice by modifying fields, clearing fields, or both. For most
218
218
  # updates, you can use a sparse
219
- # `Invoice` object to add fields or change values, and use the
219
+ # `Invoice` object to add fields or change values and use the
220
220
  # `fields_to_clear` field to specify fields to clear.
221
221
  # However, some restrictions apply. For example, you cannot change the
222
- # `order_id` or `location_id` field, and you
222
+ # `order_id` or `location_id` field and you
223
223
  # must provide the complete `custom_fields` list to update a custom field.
224
224
  # Published invoices have additional restrictions.
225
225
  # @param [String] invoice_id Required parameter: The ID of the invoice to
@@ -242,7 +242,7 @@ module Square
242
242
  # Prepare headers.
243
243
  _headers = {
244
244
  'accept' => 'application/json',
245
- 'content-type' => 'application/json; charset=utf-8'
245
+ 'Content-Type' => 'application/json'
246
246
  }
247
247
 
248
248
  # Prepare and execute HttpRequest.
@@ -264,10 +264,10 @@ module Square
264
264
 
265
265
  # Cancels an invoice. The seller cannot collect payments for
266
266
  # the canceled invoice.
267
- # You cannot cancel an invoice in a terminal state: `PAID`, `REFUNDED`,
268
- # `CANCELED`, or `FAILED`.
267
+ # You cannot cancel an invoice in the `DRAFT` state or in a terminal state:
268
+ # `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
269
269
  # @param [String] invoice_id Required parameter: The ID of the
270
- # [invoice](#type-invoice) to cancel.
270
+ # [invoice]($m/Invoice) to cancel.
271
271
  # @param [CancelInvoiceRequest] body Required parameter: An object
272
272
  # containing the fields to POST for the request. See the corresponding
273
273
  # object definition for field details.
@@ -286,7 +286,7 @@ module Square
286
286
  # Prepare headers.
287
287
  _headers = {
288
288
  'accept' => 'application/json',
289
- 'content-type' => 'application/json; charset=utf-8'
289
+ 'Content-Type' => 'application/json'
290
290
  }
291
291
 
292
292
  # Prepare and execute HttpRequest.
@@ -318,8 +318,8 @@ module Square
318
318
  # `UNPAID` if
319
319
  # Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on
320
320
  # file for a portion of the
321
- # invoice amount).
322
- # @param [String] invoice_id Required parameter: The id of the invoice to
321
+ # invoice amount.
322
+ # @param [String] invoice_id Required parameter: The ID of the invoice to
323
323
  # publish.
324
324
  # @param [PublishInvoiceRequest] body Required parameter: An object
325
325
  # containing the fields to POST for the request. See the corresponding
@@ -339,7 +339,7 @@ module Square
339
339
  # Prepare headers.
340
340
  _headers = {
341
341
  'accept' => 'application/json',
342
- 'content-type' => 'application/json; charset=utf-8'
342
+ 'Content-Type' => 'application/json'
343
343
  }
344
344
 
345
345
  # Prepare and execute HttpRequest.