square.rb 6.3.0.20200826 → 17.1.0.20220120

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +86 -51
  4. data/lib/square/api/apple_pay_api.rb +12 -9
  5. data/lib/square/api/bank_accounts_api.rb +21 -24
  6. data/lib/square/api/base_api.rb +20 -9
  7. data/lib/square/api/bookings_api.rb +391 -0
  8. data/lib/square/api/cards_api.rb +170 -0
  9. data/lib/square/api/cash_drawers_api.rb +13 -6
  10. data/lib/square/api/catalog_api.rb +195 -85
  11. data/lib/square/api/checkout_api.rb +7 -5
  12. data/lib/square/api/customer_groups_api.rb +34 -16
  13. data/lib/square/api/customer_segments_api.rb +21 -9
  14. data/lib/square/api/customers_api.rb +102 -55
  15. data/lib/square/api/devices_api.rb +20 -8
  16. data/lib/square/api/disputes_api.rb +156 -144
  17. data/lib/square/api/employees_api.rb +7 -3
  18. data/lib/square/api/gift_card_activities_api.rb +133 -0
  19. data/lib/square/api/gift_cards_api.rb +297 -0
  20. data/lib/square/api/inventory_api.rb +290 -37
  21. data/lib/square/api/invoices_api.rb +61 -57
  22. data/lib/square/api/labor_api.rb +127 -93
  23. data/lib/square/api/locations_api.rb +36 -25
  24. data/lib/square/api/loyalty_api.rb +134 -87
  25. data/lib/square/api/merchants_api.rb +8 -4
  26. data/lib/square/api/mobile_authorization_api.rb +9 -7
  27. data/lib/square/api/o_auth_api.rb +41 -32
  28. data/lib/square/api/orders_api.rb +132 -54
  29. data/lib/square/api/payments_api.rb +133 -75
  30. data/lib/square/api/refunds_api.rb +51 -30
  31. data/lib/square/api/sites_api.rb +43 -0
  32. data/lib/square/api/snippets_api.rb +146 -0
  33. data/lib/square/api/subscriptions_api.rb +216 -26
  34. data/lib/square/api/team_api.rb +81 -65
  35. data/lib/square/api/terminal_api.rb +166 -16
  36. data/lib/square/api/transactions_api.rb +32 -194
  37. data/lib/square/api/v1_transactions_api.rb +53 -103
  38. data/lib/square/api_helper.rb +38 -43
  39. data/lib/square/client.rb +54 -24
  40. data/lib/square/configuration.rb +61 -21
  41. data/lib/square/http/api_response.rb +3 -1
  42. data/lib/square/http/faraday_client.rb +34 -5
  43. data/lib/square/utilities/date_time_helper.rb +151 -0
  44. data/lib/square/utilities/file_wrapper.rb +1 -2
  45. data/lib/square.rb +65 -61
  46. data/spec/user_journey_spec.rb +2 -5
  47. data/test/api/api_test_base.rb +1 -6
  48. data/test/api/test_catalog_api.rb +1 -4
  49. data/test/api/test_customers_api.rb +1 -4
  50. data/test/api/test_employees_api.rb +1 -4
  51. data/test/api/test_labor_api.rb +2 -6
  52. data/test/api/test_locations_api.rb +21 -35
  53. data/test/api/test_merchants_api.rb +1 -4
  54. data/test/api/test_payments_api.rb +3 -6
  55. data/test/api/test_refunds_api.rb +3 -6
  56. data/test/http_response_catcher.rb +0 -5
  57. data/test/test_helper.rb +1 -6
  58. metadata +40 -18
  59. data/lib/square/api/v1_employees_api.rb +0 -723
  60. data/lib/square/api/v1_items_api.rb +0 -1686
  61. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -5,95 +5,33 @@ 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 [page](#paginatingresults): 50
16
- # @param [String] location_id Required parameter: The ID of the location to
17
- # list refunds for.
18
- # @param [String] begin_time Optional parameter: The beginning of the
19
- # requested reporting period, in RFC 3339 format. See [Date
20
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
21
- # value: The current time minus one year.
22
- # @param [String] end_time Optional parameter: The end of the requested
23
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
24
- # details on date inclusivity/exclusivity. Default value: The current
25
- # time.
26
- # @param [SortOrder] sort_order Optional parameter: The order in which
27
- # results are listed in the response (`ASC` for oldest first, `DESC` for
28
- # newest first). Default value: `DESC`
29
- # @param [String] cursor Optional parameter: A pagination cursor returned by
30
- # a previous call to this endpoint. Provide this to retrieve the next set of
31
- # results for your original query. See [Paginating
32
- # results](#paginatingresults) for more information.
33
- # @return [ListRefundsResponse Hash] response from the API call
34
- def list_refunds(location_id:,
35
- begin_time: nil,
36
- end_time: nil,
37
- sort_order: nil,
38
- cursor: nil)
39
- warn 'Endpoint list_refunds in TransactionsApi is deprecated'
40
- # Prepare query url.
41
- _query_builder = config.get_base_uri
42
- _query_builder << '/v2/locations/{location_id}/refunds'
43
- _query_builder = APIHelper.append_url_with_template_parameters(
44
- _query_builder,
45
- 'location_id' => location_id
46
- )
47
- _query_builder = APIHelper.append_url_with_query_parameters(
48
- _query_builder,
49
- 'begin_time' => begin_time,
50
- 'end_time' => end_time,
51
- 'sort_order' => sort_order,
52
- 'cursor' => cursor
53
- )
54
- _query_url = APIHelper.clean_url _query_builder
55
-
56
- # Prepare headers.
57
- _headers = {
58
- 'accept' => 'application/json'
59
- }
60
-
61
- # Prepare and execute HttpRequest.
62
- _request = config.http_client.get(
63
- _query_url,
64
- headers: _headers
65
- )
66
- OAuth2.apply(config, _request)
67
- _response = execute_request(_request)
68
-
69
- # Return appropriate response type.
70
- decoded = APIHelper.json_deserialize(_response.raw_body)
71
- _errors = APIHelper.map_response(decoded, ['errors'])
72
- ApiResponse.new(_response, data: decoded, errors: _errors)
73
- end
74
-
75
8
  # Lists transactions for a particular location.
76
9
  # Transactions include payment information from sales and exchanges and
77
10
  # refund
78
11
  # information from returns and exchanges.
79
- # Max results per [page](#paginatingresults): 50
12
+ # Max results per
13
+ # [page](https://developer.squareup.com/docs/working-with-apis/pagination):
14
+ # 50
80
15
  # @param [String] location_id Required parameter: The ID of the location to
81
16
  # list transactions for.
82
17
  # @param [String] begin_time Optional parameter: The beginning of the
83
18
  # requested reporting period, in RFC 3339 format. See [Date
84
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
85
- # value: The current time minus one year.
19
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
20
+ # s) for details on date inclusivity/exclusivity. Default value: The
21
+ # current time minus one year.
86
22
  # @param [String] end_time Optional parameter: The end of the requested
87
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
88
- # details on date inclusivity/exclusivity. Default value: The current
89
- # time.
23
+ # reporting period, in RFC 3339 format. See [Date
24
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
25
+ # s) for details on date inclusivity/exclusivity. Default value: The
26
+ # current time.
90
27
  # @param [SortOrder] sort_order Optional parameter: The order in which
91
28
  # results are listed in the response (`ASC` for oldest first, `DESC` for
92
29
  # newest first). Default value: `DESC`
93
30
  # @param [String] cursor Optional parameter: A pagination cursor returned by
94
31
  # a previous call to this endpoint. Provide this to retrieve the next set of
95
32
  # results for your original query. See [Paginating
96
- # results](#paginatingresults) for more information.
33
+ # results](https://developer.squareup.com/docs/working-with-apis/pagination)
34
+ # for more information.
97
35
  # @return [ListTransactionsResponse Hash] response from the API call
98
36
  def list_transactions(location_id:,
99
37
  begin_time: nil,
@@ -106,7 +44,7 @@ module Square
106
44
  _query_builder << '/v2/locations/{location_id}/transactions'
107
45
  _query_builder = APIHelper.append_url_with_template_parameters(
108
46
  _query_builder,
109
- 'location_id' => location_id
47
+ 'location_id' => { 'value' => location_id, 'encode' => true }
110
48
  )
111
49
  _query_builder = APIHelper.append_url_with_query_parameters(
112
50
  _query_builder,
@@ -133,65 +71,9 @@ module Square
133
71
  # Return appropriate response type.
134
72
  decoded = APIHelper.json_deserialize(_response.raw_body)
135
73
  _errors = APIHelper.map_response(decoded, ['errors'])
136
- ApiResponse.new(_response, data: decoded, errors: _errors)
137
- end
138
-
139
- # Charges a card represented by a card nonce or a customer's card on file.
140
- # Your request to this endpoint must include _either_:
141
- # - A value for the `card_nonce` parameter (to charge a card nonce generated
142
- # with the `SqPaymentForm`)
143
- # - Values for the `customer_card_id` and `customer_id` parameters (to
144
- # charge
145
- # a customer's card on file)
146
- # In order for an eCommerce payment to potentially qualify for
147
- # [Square chargeback protection](https://squareup.com/help/article/5394),
148
- # you
149
- # _must_ provide values for the following parameters in your request:
150
- # - `buyer_email_address`
151
- # - At least one of `billing_address` or `shipping_address`
152
- # When this response is returned, the amount of Square's processing fee
153
- # might not yet be
154
- # calculated. To obtain the processing fee, wait about ten seconds and call
155
- # [RetrieveTransaction](#endpoint-retrievetransaction). See the
156
- # `processing_fee_money`
157
- # field of each [Tender included](#type-tender) in the transaction.
158
- # @param [String] location_id Required parameter: The ID of the location to
159
- # associate the created transaction with.
160
- # @param [ChargeRequest] body Required parameter: An object containing the
161
- # fields to POST for the request. See the corresponding object definition
162
- # for field details.
163
- # @return [ChargeResponse Hash] response from the API call
164
- def charge(location_id:,
165
- body:)
166
- warn 'Endpoint charge in TransactionsApi is deprecated'
167
- # Prepare query url.
168
- _query_builder = config.get_base_uri
169
- _query_builder << '/v2/locations/{location_id}/transactions'
170
- _query_builder = APIHelper.append_url_with_template_parameters(
171
- _query_builder,
172
- 'location_id' => location_id
74
+ ApiResponse.new(
75
+ _response, data: decoded, errors: _errors
173
76
  )
174
- _query_url = APIHelper.clean_url _query_builder
175
-
176
- # Prepare headers.
177
- _headers = {
178
- 'accept' => 'application/json',
179
- 'content-type' => 'application/json; charset=utf-8'
180
- }
181
-
182
- # Prepare and execute HttpRequest.
183
- _request = config.http_client.post(
184
- _query_url,
185
- headers: _headers,
186
- parameters: body.to_json
187
- )
188
- OAuth2.apply(config, _request)
189
- _response = execute_request(_request)
190
-
191
- # Return appropriate response type.
192
- decoded = APIHelper.json_deserialize(_response.raw_body)
193
- _errors = APIHelper.map_response(decoded, ['errors'])
194
- ApiResponse.new(_response, data: decoded, errors: _errors)
195
77
  end
196
78
 
197
79
  # Retrieves details for a single transaction.
@@ -208,8 +90,8 @@ module Square
208
90
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
209
91
  _query_builder = APIHelper.append_url_with_template_parameters(
210
92
  _query_builder,
211
- 'location_id' => location_id,
212
- 'transaction_id' => transaction_id
93
+ 'location_id' => { 'value' => location_id, 'encode' => true },
94
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
213
95
  )
214
96
  _query_url = APIHelper.clean_url _query_builder
215
97
 
@@ -229,11 +111,13 @@ module Square
229
111
  # Return appropriate response type.
230
112
  decoded = APIHelper.json_deserialize(_response.raw_body)
231
113
  _errors = APIHelper.map_response(decoded, ['errors'])
232
- ApiResponse.new(_response, data: decoded, errors: _errors)
114
+ ApiResponse.new(
115
+ _response, data: decoded, errors: _errors
116
+ )
233
117
  end
234
118
 
235
119
  # Captures a transaction that was created with the
236
- # [Charge](#endpoint-charge)
120
+ # [Charge]($e/Transactions/Charge)
237
121
  # endpoint with a `delay_capture` value of `true`.
238
122
  # See [Delayed capture
239
123
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov
@@ -250,8 +134,8 @@ module Square
250
134
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
251
135
  _query_builder = APIHelper.append_url_with_template_parameters(
252
136
  _query_builder,
253
- 'location_id' => location_id,
254
- 'transaction_id' => transaction_id
137
+ 'location_id' => { 'value' => location_id, 'encode' => true },
138
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
255
139
  )
256
140
  _query_url = APIHelper.clean_url _query_builder
257
141
 
@@ -271,61 +155,13 @@ module Square
271
155
  # Return appropriate response type.
272
156
  decoded = APIHelper.json_deserialize(_response.raw_body)
273
157
  _errors = APIHelper.map_response(decoded, ['errors'])
274
- ApiResponse.new(_response, data: decoded, errors: _errors)
275
- end
276
-
277
- # Initiates a refund for a previously charged tender.
278
- # You must issue a refund within 120 days of the associated payment. See
279
- # [this article](https://squareup.com/help/us/en/article/5060) for more
280
- # information
281
- # on refund behavior.
282
- # NOTE: Card-present transactions with Interac credit cards **cannot be
283
- # refunded using the Connect API**. Interac transactions must refunded
284
- # in-person (e.g., dipping the card using POS app).
285
- # @param [String] location_id Required parameter: The ID of the original
286
- # transaction's associated location.
287
- # @param [String] transaction_id Required parameter: The ID of the original
288
- # transaction that includes the tender to refund.
289
- # @param [CreateRefundRequest] body Required parameter: An object containing
290
- # the fields to POST for the request. See the corresponding object
291
- # definition for field details.
292
- # @return [CreateRefundResponse Hash] response from the API call
293
- def create_refund(location_id:,
294
- transaction_id:,
295
- body:)
296
- warn 'Endpoint create_refund in TransactionsApi is deprecated'
297
- # Prepare query url.
298
- _query_builder = config.get_base_uri
299
- _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
300
- _query_builder = APIHelper.append_url_with_template_parameters(
301
- _query_builder,
302
- 'location_id' => location_id,
303
- 'transaction_id' => transaction_id
158
+ ApiResponse.new(
159
+ _response, data: decoded, errors: _errors
304
160
  )
305
- _query_url = APIHelper.clean_url _query_builder
306
-
307
- # Prepare headers.
308
- _headers = {
309
- 'accept' => 'application/json',
310
- 'content-type' => 'application/json; charset=utf-8'
311
- }
312
-
313
- # Prepare and execute HttpRequest.
314
- _request = config.http_client.post(
315
- _query_url,
316
- headers: _headers,
317
- parameters: body.to_json
318
- )
319
- OAuth2.apply(config, _request)
320
- _response = execute_request(_request)
321
-
322
- # Return appropriate response type.
323
- decoded = APIHelper.json_deserialize(_response.raw_body)
324
- _errors = APIHelper.map_response(decoded, ['errors'])
325
- ApiResponse.new(_response, data: decoded, errors: _errors)
326
161
  end
327
162
 
328
- # Cancels a transaction that was created with the [Charge](#endpoint-charge)
163
+ # Cancels a transaction that was created with the
164
+ # [Charge]($e/Transactions/Charge)
329
165
  # endpoint with a `delay_capture` value of `true`.
330
166
  # See [Delayed capture
331
167
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov
@@ -342,8 +178,8 @@ module Square
342
178
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
343
179
  _query_builder = APIHelper.append_url_with_template_parameters(
344
180
  _query_builder,
345
- 'location_id' => location_id,
346
- 'transaction_id' => transaction_id
181
+ 'location_id' => { 'value' => location_id, 'encode' => true },
182
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
347
183
  )
348
184
  _query_url = APIHelper.clean_url _query_builder
349
185
 
@@ -363,7 +199,9 @@ module Square
363
199
  # Return appropriate response type.
364
200
  decoded = APIHelper.json_deserialize(_response.raw_body)
365
201
  _errors = APIHelper.map_response(decoded, ['errors'])
366
- ApiResponse.new(_response, data: decoded, errors: _errors)
202
+ ApiResponse.new(
203
+ _response, data: decoded, errors: _errors
204
+ )
367
205
  end
368
206
  end
369
207
  end
@@ -5,87 +5,10 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Provides non-confidential details for all of a location's associated bank
9
- # accounts. This endpoint does not provide full bank account numbers, and
10
- # there is no way to obtain a full bank account number with the Connect API.
11
- # @param [String] location_id Required parameter: The ID of the location to
12
- # list bank accounts for.
13
- # @return [List of V1BankAccount Hash] response from the API call
14
- def list_bank_accounts(location_id:)
15
- warn 'Endpoint list_bank_accounts in V1TransactionsApi is deprecated'
16
- # Prepare query url.
17
- _query_builder = config.get_base_uri
18
- _query_builder << '/v1/{location_id}/bank-accounts'
19
- _query_builder = APIHelper.append_url_with_template_parameters(
20
- _query_builder,
21
- 'location_id' => location_id
22
- )
23
- _query_url = APIHelper.clean_url _query_builder
24
-
25
- # Prepare headers.
26
- _headers = {
27
- 'accept' => 'application/json'
28
- }
29
-
30
- # Prepare and execute HttpRequest.
31
- _request = config.http_client.get(
32
- _query_url,
33
- headers: _headers
34
- )
35
- OAuth2.apply(config, _request)
36
- _response = execute_request(_request)
37
-
38
- # Return appropriate response type.
39
- decoded = APIHelper.json_deserialize(_response.raw_body)
40
- _errors = APIHelper.map_response(decoded, ['errors'])
41
- ApiResponse.new(_response, data: decoded, errors: _errors)
42
- end
43
-
44
- # Provides non-confidential details for a merchant's associated bank
45
- # account. This endpoint does not provide full bank account numbers, and
46
- # there is no way to obtain a full bank account number with the Connect API.
47
- # @param [String] location_id Required parameter: The ID of the bank
48
- # account's associated location.
49
- # @param [String] bank_account_id Required parameter: The bank account's
50
- # Square-issued ID. You obtain this value from Settlement objects
51
- # returned.
52
- # @return [V1BankAccount Hash] response from the API call
53
- def retrieve_bank_account(location_id:,
54
- bank_account_id:)
55
- warn 'Endpoint retrieve_bank_account in V1TransactionsApi is deprecated'
56
- # Prepare query url.
57
- _query_builder = config.get_base_uri
58
- _query_builder << '/v1/{location_id}/bank-accounts/{bank_account_id}'
59
- _query_builder = APIHelper.append_url_with_template_parameters(
60
- _query_builder,
61
- 'location_id' => location_id,
62
- 'bank_account_id' => bank_account_id
63
- )
64
- _query_url = APIHelper.clean_url _query_builder
65
-
66
- # Prepare headers.
67
- _headers = {
68
- 'accept' => 'application/json'
69
- }
70
-
71
- # Prepare and execute HttpRequest.
72
- _request = config.http_client.get(
73
- _query_url,
74
- headers: _headers
75
- )
76
- OAuth2.apply(config, _request)
77
- _response = execute_request(_request)
78
-
79
- # Return appropriate response type.
80
- decoded = APIHelper.json_deserialize(_response.raw_body)
81
- _errors = APIHelper.map_response(decoded, ['errors'])
82
- ApiResponse.new(_response, data: decoded, errors: _errors)
83
- end
84
-
85
8
  # Provides summary information for a merchant's online store orders.
86
9
  # @param [String] location_id Required parameter: The ID of the location to
87
10
  # list online store orders for.
88
- # @param [SortOrder] order Optional parameter: TThe order in which payments
11
+ # @param [SortOrder] order Optional parameter: The order in which payments
89
12
  # are listed in the response.
90
13
  # @param [Integer] limit Optional parameter: The maximum number of payments
91
14
  # to return in a single response. This value cannot exceed 200.
@@ -97,12 +20,13 @@ module Square
97
20
  order: nil,
98
21
  limit: nil,
99
22
  batch_token: nil)
23
+ warn 'Endpoint list_orders in V1TransactionsApi is deprecated'
100
24
  # Prepare query url.
101
25
  _query_builder = config.get_base_uri
102
26
  _query_builder << '/v1/{location_id}/orders'
103
27
  _query_builder = APIHelper.append_url_with_template_parameters(
104
28
  _query_builder,
105
- 'location_id' => location_id
29
+ 'location_id' => { 'value' => location_id, 'encode' => true }
106
30
  )
107
31
  _query_builder = APIHelper.append_url_with_query_parameters(
108
32
  _query_builder,
@@ -128,7 +52,9 @@ module Square
128
52
  # Return appropriate response type.
129
53
  decoded = APIHelper.json_deserialize(_response.raw_body)
130
54
  _errors = APIHelper.map_response(decoded, ['errors'])
131
- ApiResponse.new(_response, data: decoded, errors: _errors)
55
+ ApiResponse.new(
56
+ _response, data: decoded, errors: _errors
57
+ )
132
58
  end
133
59
 
134
60
  # Provides comprehensive information for a single online store order,
@@ -141,13 +67,14 @@ module Square
141
67
  # @return [V1Order Hash] response from the API call
142
68
  def retrieve_order(location_id:,
143
69
  order_id:)
70
+ warn 'Endpoint retrieve_order in V1TransactionsApi is deprecated'
144
71
  # Prepare query url.
145
72
  _query_builder = config.get_base_uri
146
73
  _query_builder << '/v1/{location_id}/orders/{order_id}'
147
74
  _query_builder = APIHelper.append_url_with_template_parameters(
148
75
  _query_builder,
149
- 'location_id' => location_id,
150
- 'order_id' => order_id
76
+ 'location_id' => { 'value' => location_id, 'encode' => true },
77
+ 'order_id' => { 'value' => order_id, 'encode' => true }
151
78
  )
152
79
  _query_url = APIHelper.clean_url _query_builder
153
80
 
@@ -167,7 +94,9 @@ module Square
167
94
  # Return appropriate response type.
168
95
  decoded = APIHelper.json_deserialize(_response.raw_body)
169
96
  _errors = APIHelper.map_response(decoded, ['errors'])
170
- ApiResponse.new(_response, data: decoded, errors: _errors)
97
+ ApiResponse.new(
98
+ _response, data: decoded, errors: _errors
99
+ )
171
100
  end
172
101
 
173
102
  # Updates the details of an online store order. Every update you perform on
@@ -184,20 +113,21 @@ module Square
184
113
  def update_order(location_id:,
185
114
  order_id:,
186
115
  body:)
116
+ warn 'Endpoint update_order in V1TransactionsApi is deprecated'
187
117
  # Prepare query url.
188
118
  _query_builder = config.get_base_uri
189
119
  _query_builder << '/v1/{location_id}/orders/{order_id}'
190
120
  _query_builder = APIHelper.append_url_with_template_parameters(
191
121
  _query_builder,
192
- 'location_id' => location_id,
193
- 'order_id' => order_id
122
+ 'location_id' => { 'value' => location_id, 'encode' => true },
123
+ 'order_id' => { 'value' => order_id, 'encode' => true }
194
124
  )
195
125
  _query_url = APIHelper.clean_url _query_builder
196
126
 
197
127
  # Prepare headers.
198
128
  _headers = {
199
129
  'accept' => 'application/json',
200
- 'content-type' => 'application/json; charset=utf-8'
130
+ 'Content-Type' => 'application/json'
201
131
  }
202
132
 
203
133
  # Prepare and execute HttpRequest.
@@ -212,7 +142,9 @@ module Square
212
142
  # Return appropriate response type.
213
143
  decoded = APIHelper.json_deserialize(_response.raw_body)
214
144
  _errors = APIHelper.map_response(decoded, ['errors'])
215
- ApiResponse.new(_response, data: decoded, errors: _errors)
145
+ ApiResponse.new(
146
+ _response, data: decoded, errors: _errors
147
+ )
216
148
  end
217
149
 
218
150
  # Provides summary information for all payments taken for a given
@@ -255,12 +187,13 @@ module Square
255
187
  limit: nil,
256
188
  batch_token: nil,
257
189
  include_partial: false)
190
+ warn 'Endpoint list_payments in V1TransactionsApi is deprecated'
258
191
  # Prepare query url.
259
192
  _query_builder = config.get_base_uri
260
193
  _query_builder << '/v1/{location_id}/payments'
261
194
  _query_builder = APIHelper.append_url_with_template_parameters(
262
195
  _query_builder,
263
- 'location_id' => location_id
196
+ 'location_id' => { 'value' => location_id, 'encode' => true }
264
197
  )
265
198
  _query_builder = APIHelper.append_url_with_query_parameters(
266
199
  _query_builder,
@@ -289,7 +222,9 @@ module Square
289
222
  # Return appropriate response type.
290
223
  decoded = APIHelper.json_deserialize(_response.raw_body)
291
224
  _errors = APIHelper.map_response(decoded, ['errors'])
292
- ApiResponse.new(_response, data: decoded, errors: _errors)
225
+ ApiResponse.new(
226
+ _response, data: decoded, errors: _errors
227
+ )
293
228
  end
294
229
 
295
230
  # Provides comprehensive information for a single payment.
@@ -302,13 +237,14 @@ module Square
302
237
  # @return [V1Payment Hash] response from the API call
303
238
  def retrieve_payment(location_id:,
304
239
  payment_id:)
240
+ warn 'Endpoint retrieve_payment in V1TransactionsApi is deprecated'
305
241
  # Prepare query url.
306
242
  _query_builder = config.get_base_uri
307
243
  _query_builder << '/v1/{location_id}/payments/{payment_id}'
308
244
  _query_builder = APIHelper.append_url_with_template_parameters(
309
245
  _query_builder,
310
- 'location_id' => location_id,
311
- 'payment_id' => payment_id
246
+ 'location_id' => { 'value' => location_id, 'encode' => true },
247
+ 'payment_id' => { 'value' => payment_id, 'encode' => true }
312
248
  )
313
249
  _query_url = APIHelper.clean_url _query_builder
314
250
 
@@ -328,7 +264,9 @@ module Square
328
264
  # Return appropriate response type.
329
265
  decoded = APIHelper.json_deserialize(_response.raw_body)
330
266
  _errors = APIHelper.map_response(decoded, ['errors'])
331
- ApiResponse.new(_response, data: decoded, errors: _errors)
267
+ ApiResponse.new(
268
+ _response, data: decoded, errors: _errors
269
+ )
332
270
  end
333
271
 
334
272
  # Provides the details for all refunds initiated by a merchant or any of the
@@ -336,7 +274,7 @@ module Square
336
274
  # year in length.
337
275
  # @param [String] location_id Required parameter: The ID of the location to
338
276
  # list refunds for.
339
- # @param [SortOrder] order Optional parameter: TThe order in which payments
277
+ # @param [SortOrder] order Optional parameter: The order in which payments
340
278
  # are listed in the response.
341
279
  # @param [String] begin_time Optional parameter: The beginning of the
342
280
  # requested reporting period, in ISO 8601 format. If this value is before
@@ -361,12 +299,13 @@ module Square
361
299
  end_time: nil,
362
300
  limit: nil,
363
301
  batch_token: nil)
302
+ warn 'Endpoint list_refunds in V1TransactionsApi is deprecated'
364
303
  # Prepare query url.
365
304
  _query_builder = config.get_base_uri
366
305
  _query_builder << '/v1/{location_id}/refunds'
367
306
  _query_builder = APIHelper.append_url_with_template_parameters(
368
307
  _query_builder,
369
- 'location_id' => location_id
308
+ 'location_id' => { 'value' => location_id, 'encode' => true }
370
309
  )
371
310
  _query_builder = APIHelper.append_url_with_query_parameters(
372
311
  _query_builder,
@@ -394,7 +333,9 @@ module Square
394
333
  # Return appropriate response type.
395
334
  decoded = APIHelper.json_deserialize(_response.raw_body)
396
335
  _errors = APIHelper.map_response(decoded, ['errors'])
397
- ApiResponse.new(_response, data: decoded, errors: _errors)
336
+ ApiResponse.new(
337
+ _response, data: decoded, errors: _errors
338
+ )
398
339
  end
399
340
 
400
341
  # Issues a refund for a previously processed payment. You must issue
@@ -415,19 +356,20 @@ module Square
415
356
  # @return [V1Refund Hash] response from the API call
416
357
  def create_refund(location_id:,
417
358
  body:)
359
+ warn 'Endpoint create_refund in V1TransactionsApi is deprecated'
418
360
  # Prepare query url.
419
361
  _query_builder = config.get_base_uri
420
362
  _query_builder << '/v1/{location_id}/refunds'
421
363
  _query_builder = APIHelper.append_url_with_template_parameters(
422
364
  _query_builder,
423
- 'location_id' => location_id
365
+ 'location_id' => { 'value' => location_id, 'encode' => true }
424
366
  )
425
367
  _query_url = APIHelper.clean_url _query_builder
426
368
 
427
369
  # Prepare headers.
428
370
  _headers = {
429
371
  'accept' => 'application/json',
430
- 'content-type' => 'application/json; charset=utf-8'
372
+ 'Content-Type' => 'application/json'
431
373
  }
432
374
 
433
375
  # Prepare and execute HttpRequest.
@@ -442,7 +384,9 @@ module Square
442
384
  # Return appropriate response type.
443
385
  decoded = APIHelper.json_deserialize(_response.raw_body)
444
386
  _errors = APIHelper.map_response(decoded, ['errors'])
445
- ApiResponse.new(_response, data: decoded, errors: _errors)
387
+ ApiResponse.new(
388
+ _response, data: decoded, errors: _errors
389
+ )
446
390
  end
447
391
 
448
392
  # Provides summary information for all deposits and withdrawals
@@ -480,12 +424,13 @@ module Square
480
424
  limit: nil,
481
425
  status: nil,
482
426
  batch_token: nil)
427
+ warn 'Endpoint list_settlements in V1TransactionsApi is deprecated'
483
428
  # Prepare query url.
484
429
  _query_builder = config.get_base_uri
485
430
  _query_builder << '/v1/{location_id}/settlements'
486
431
  _query_builder = APIHelper.append_url_with_template_parameters(
487
432
  _query_builder,
488
- 'location_id' => location_id
433
+ 'location_id' => { 'value' => location_id, 'encode' => true }
489
434
  )
490
435
  _query_builder = APIHelper.append_url_with_query_parameters(
491
436
  _query_builder,
@@ -514,7 +459,9 @@ module Square
514
459
  # Return appropriate response type.
515
460
  decoded = APIHelper.json_deserialize(_response.raw_body)
516
461
  _errors = APIHelper.map_response(decoded, ['errors'])
517
- ApiResponse.new(_response, data: decoded, errors: _errors)
462
+ ApiResponse.new(
463
+ _response, data: decoded, errors: _errors
464
+ )
518
465
  end
519
466
 
520
467
  # Provides comprehensive information for a single settlement.
@@ -540,13 +487,14 @@ module Square
540
487
  # @return [V1Settlement Hash] response from the API call
541
488
  def retrieve_settlement(location_id:,
542
489
  settlement_id:)
490
+ warn 'Endpoint retrieve_settlement in V1TransactionsApi is deprecated'
543
491
  # Prepare query url.
544
492
  _query_builder = config.get_base_uri
545
493
  _query_builder << '/v1/{location_id}/settlements/{settlement_id}'
546
494
  _query_builder = APIHelper.append_url_with_template_parameters(
547
495
  _query_builder,
548
- 'location_id' => location_id,
549
- 'settlement_id' => settlement_id
496
+ 'location_id' => { 'value' => location_id, 'encode' => true },
497
+ 'settlement_id' => { 'value' => settlement_id, 'encode' => true }
550
498
  )
551
499
  _query_url = APIHelper.clean_url _query_builder
552
500
 
@@ -566,7 +514,9 @@ module Square
566
514
  # Return appropriate response type.
567
515
  decoded = APIHelper.json_deserialize(_response.raw_body)
568
516
  _errors = APIHelper.map_response(decoded, ['errors'])
569
- ApiResponse.new(_response, data: decoded, errors: _errors)
517
+ ApiResponse.new(
518
+ _response, data: decoded, errors: _errors
519
+ )
570
520
  end
571
521
  end
572
522
  end