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,8 +5,150 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Creates a new Terminal checkout request and sends it to the specified
9
- # device to take a payment for the requested amount.
8
+ # Creates a Terminal action request and sends it to the specified device.
9
+ # @param [CreateTerminalActionRequest] body Required parameter: An object
10
+ # containing the fields to POST for the request. See the corresponding
11
+ # object definition for field details.
12
+ # @return [CreateTerminalActionResponse Hash] response from the API call
13
+ def create_terminal_action(body:)
14
+ # Prepare query url.
15
+ _query_builder = config.get_base_uri
16
+ _query_builder << '/v2/terminals/actions'
17
+ _query_url = APIHelper.clean_url _query_builder
18
+
19
+ # Prepare headers.
20
+ _headers = {
21
+ 'accept' => 'application/json',
22
+ 'Content-Type' => 'application/json'
23
+ }
24
+
25
+ # Prepare and execute HttpRequest.
26
+ _request = config.http_client.post(
27
+ _query_url,
28
+ headers: _headers,
29
+ parameters: body.to_json
30
+ )
31
+ OAuth2.apply(config, _request)
32
+ _response = execute_request(_request)
33
+
34
+ # Return appropriate response type.
35
+ decoded = APIHelper.json_deserialize(_response.raw_body)
36
+ _errors = APIHelper.map_response(decoded, ['errors'])
37
+ ApiResponse.new(
38
+ _response, data: decoded, errors: _errors
39
+ )
40
+ end
41
+
42
+ # Retrieves a filtered list of Terminal action requests created by the
43
+ # account making the request. Terminal action requests are available for 30
44
+ # days.
45
+ # @param [SearchTerminalActionsRequest] body Required parameter: An object
46
+ # containing the fields to POST for the request. See the corresponding
47
+ # object definition for field details.
48
+ # @return [SearchTerminalActionsResponse Hash] response from the API call
49
+ def search_terminal_actions(body:)
50
+ # Prepare query url.
51
+ _query_builder = config.get_base_uri
52
+ _query_builder << '/v2/terminals/actions/search'
53
+ _query_url = APIHelper.clean_url _query_builder
54
+
55
+ # Prepare headers.
56
+ _headers = {
57
+ 'accept' => 'application/json',
58
+ 'Content-Type' => 'application/json'
59
+ }
60
+
61
+ # Prepare and execute HttpRequest.
62
+ _request = config.http_client.post(
63
+ _query_url,
64
+ headers: _headers,
65
+ parameters: body.to_json
66
+ )
67
+ OAuth2.apply(config, _request)
68
+ _response = execute_request(_request)
69
+
70
+ # Return appropriate response type.
71
+ decoded = APIHelper.json_deserialize(_response.raw_body)
72
+ _errors = APIHelper.map_response(decoded, ['errors'])
73
+ ApiResponse.new(
74
+ _response, data: decoded, errors: _errors
75
+ )
76
+ end
77
+
78
+ # Retrieves a Terminal action request by `action_id`. Terminal action
79
+ # requests are available for 30 days.
80
+ # @param [String] action_id Required parameter: Unique ID for the desired
81
+ # `TerminalAction`
82
+ # @return [GetTerminalActionResponse Hash] response from the API call
83
+ def get_terminal_action(action_id:)
84
+ # Prepare query url.
85
+ _query_builder = config.get_base_uri
86
+ _query_builder << '/v2/terminals/actions/{action_id}'
87
+ _query_builder = APIHelper.append_url_with_template_parameters(
88
+ _query_builder,
89
+ 'action_id' => { 'value' => action_id, 'encode' => true }
90
+ )
91
+ _query_url = APIHelper.clean_url _query_builder
92
+
93
+ # Prepare headers.
94
+ _headers = {
95
+ 'accept' => 'application/json'
96
+ }
97
+
98
+ # Prepare and execute HttpRequest.
99
+ _request = config.http_client.get(
100
+ _query_url,
101
+ headers: _headers
102
+ )
103
+ OAuth2.apply(config, _request)
104
+ _response = execute_request(_request)
105
+
106
+ # Return appropriate response type.
107
+ decoded = APIHelper.json_deserialize(_response.raw_body)
108
+ _errors = APIHelper.map_response(decoded, ['errors'])
109
+ ApiResponse.new(
110
+ _response, data: decoded, errors: _errors
111
+ )
112
+ end
113
+
114
+ # Cancels a Terminal action request if the status of the request permits it.
115
+ # @param [String] action_id Required parameter: Unique ID for the desired
116
+ # `TerminalAction`
117
+ # @return [CancelTerminalActionResponse Hash] response from the API call
118
+ def cancel_terminal_action(action_id:)
119
+ # Prepare query url.
120
+ _query_builder = config.get_base_uri
121
+ _query_builder << '/v2/terminals/actions/{action_id}/cancel'
122
+ _query_builder = APIHelper.append_url_with_template_parameters(
123
+ _query_builder,
124
+ 'action_id' => { 'value' => action_id, 'encode' => true }
125
+ )
126
+ _query_url = APIHelper.clean_url _query_builder
127
+
128
+ # Prepare headers.
129
+ _headers = {
130
+ 'accept' => 'application/json'
131
+ }
132
+
133
+ # Prepare and execute HttpRequest.
134
+ _request = config.http_client.post(
135
+ _query_url,
136
+ headers: _headers
137
+ )
138
+ OAuth2.apply(config, _request)
139
+ _response = execute_request(_request)
140
+
141
+ # Return appropriate response type.
142
+ decoded = APIHelper.json_deserialize(_response.raw_body)
143
+ _errors = APIHelper.map_response(decoded, ['errors'])
144
+ ApiResponse.new(
145
+ _response, data: decoded, errors: _errors
146
+ )
147
+ end
148
+
149
+ # Creates a Terminal checkout request and sends it to the specified device
150
+ # to take a payment
151
+ # for the requested amount.
10
152
  # @param [CreateTerminalCheckoutRequest] body Required parameter: An object
11
153
  # containing the fields to POST for the request. See the corresponding
12
154
  # object definition for field details.
@@ -20,7 +162,7 @@ module Square
20
162
  # Prepare headers.
21
163
  _headers = {
22
164
  'accept' => 'application/json',
23
- 'content-type' => 'application/json; charset=utf-8'
165
+ 'Content-Type' => 'application/json'
24
166
  }
25
167
 
26
168
  # Prepare and execute HttpRequest.
@@ -40,8 +182,10 @@ module Square
40
182
  )
41
183
  end
42
184
 
43
- # Retrieves a filtered list of Terminal checkout requests created by the
44
- # account making the request.
185
+ # Returns a filtered list of Terminal checkout requests created by the
186
+ # application making the request. Only Terminal checkout requests created
187
+ # for the merchant scoped to the OAuth token are returned. Terminal checkout
188
+ # requests are available for 30 days.
45
189
  # @param [SearchTerminalCheckoutsRequest] body Required parameter: An object
46
190
  # containing the fields to POST for the request. See the corresponding
47
191
  # object definition for field details.
@@ -55,7 +199,7 @@ module Square
55
199
  # Prepare headers.
56
200
  _headers = {
57
201
  'accept' => 'application/json',
58
- 'content-type' => 'application/json; charset=utf-8'
202
+ 'Content-Type' => 'application/json'
59
203
  }
60
204
 
61
205
  # Prepare and execute HttpRequest.
@@ -75,9 +219,10 @@ module Square
75
219
  )
76
220
  end
77
221
 
78
- # Retrieves a Terminal checkout request by checkout_id.
79
- # @param [String] checkout_id Required parameter: Unique ID for the desired
80
- # `TerminalCheckout`
222
+ # Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout
223
+ # requests are available for 30 days.
224
+ # @param [String] checkout_id Required parameter: The unique ID for the
225
+ # desired `TerminalCheckout`.
81
226
  # @return [GetTerminalCheckoutResponse Hash] response from the API call
82
227
  def get_terminal_checkout(checkout_id:)
83
228
  # Prepare query url.
@@ -112,8 +257,8 @@ module Square
112
257
 
113
258
  # Cancels a Terminal checkout request if the status of the request permits
114
259
  # it.
115
- # @param [String] checkout_id Required parameter: Unique ID for the desired
116
- # `TerminalCheckout`
260
+ # @param [String] checkout_id Required parameter: The unique ID for the
261
+ # desired `TerminalCheckout`.
117
262
  # @return [CancelTerminalCheckoutResponse Hash] response from the API call
118
263
  def cancel_terminal_checkout(checkout_id:)
119
264
  # Prepare query url.
@@ -147,7 +292,10 @@ module Square
147
292
  end
148
293
 
149
294
  # Creates a request to refund an Interac payment completed on a Square
150
- # Terminal.
295
+ # Terminal. Refunds for Interac payments on a Square Terminal are supported
296
+ # only for Interac debit cards in Canada. Other refunds for Terminal
297
+ # payments should use the Refunds API. For more information, see [Refunds
298
+ # API]($e/Refunds).
151
299
  # @param [CreateTerminalRefundRequest] body Required parameter: An object
152
300
  # containing the fields to POST for the request. See the corresponding
153
301
  # object definition for field details.
@@ -161,7 +309,7 @@ module Square
161
309
  # Prepare headers.
162
310
  _headers = {
163
311
  'accept' => 'application/json',
164
- 'content-type' => 'application/json; charset=utf-8'
312
+ 'Content-Type' => 'application/json'
165
313
  }
166
314
 
167
315
  # Prepare and execute HttpRequest.
@@ -181,8 +329,9 @@ module Square
181
329
  )
182
330
  end
183
331
 
184
- # Retrieves a filtered list of Terminal Interac refund requests created by
185
- # the seller making the request.
332
+ # Retrieves a filtered list of Interac Terminal refund requests created by
333
+ # the seller making the request. Terminal refund requests are available for
334
+ # 30 days.
186
335
  # @param [SearchTerminalRefundsRequest] body Required parameter: An object
187
336
  # containing the fields to POST for the request. See the corresponding
188
337
  # object definition for field details.
@@ -196,7 +345,7 @@ module Square
196
345
  # Prepare headers.
197
346
  _headers = {
198
347
  'accept' => 'application/json',
199
- 'content-type' => 'application/json; charset=utf-8'
348
+ 'Content-Type' => 'application/json'
200
349
  }
201
350
 
202
351
  # Prepare and execute HttpRequest.
@@ -216,9 +365,10 @@ module Square
216
365
  )
217
366
  end
218
367
 
219
- # Retrieves an Interac terminal refund object by ID.
220
- # @param [String] terminal_refund_id Required parameter: Unique ID for the
221
- # desired `TerminalRefund`
368
+ # Retrieves an Interac Terminal refund object by ID. Terminal refund objects
369
+ # are available for 30 days.
370
+ # @param [String] terminal_refund_id Required parameter: The unique ID for
371
+ # the desired `TerminalRefund`.
222
372
  # @return [GetTerminalRefundResponse Hash] response from the API call
223
373
  def get_terminal_refund(terminal_refund_id:)
224
374
  # Prepare query url.
@@ -251,10 +401,10 @@ module Square
251
401
  )
252
402
  end
253
403
 
254
- # Cancels an Interac terminal refund request by refund request ID if the
404
+ # Cancels an Interac Terminal refund request by refund request ID if the
255
405
  # status of the request permits it.
256
- # @param [String] terminal_refund_id Required parameter: Unique ID for the
257
- # desired `TerminalRefund`
406
+ # @param [String] terminal_refund_id Required parameter: The unique ID for
407
+ # the desired `TerminalRefund`.
258
408
  # @return [CancelTerminalRefundResponse Hash] response from the API call
259
409
  def cancel_terminal_refund(terminal_refund_id:)
260
410
  # Prepare query url.
@@ -5,97 +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' => { 'value' => location_id, 'encode' => true }
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(
73
- _response, data: decoded, errors: _errors
74
- )
75
- end
76
-
77
8
  # Lists transactions for a particular location.
78
9
  # Transactions include payment information from sales and exchanges and
79
10
  # refund
80
11
  # information from returns and exchanges.
81
- # Max results per [page](#paginatingresults): 50
12
+ # Max results per
13
+ # [page](https://developer.squareup.com/docs/working-with-apis/pagination):
14
+ # 50
82
15
  # @param [String] location_id Required parameter: The ID of the location to
83
16
  # list transactions for.
84
17
  # @param [String] begin_time Optional parameter: The beginning of the
85
18
  # requested reporting period, in RFC 3339 format. See [Date
86
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
87
- # 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.
88
22
  # @param [String] end_time Optional parameter: The end of the requested
89
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
90
- # details on date inclusivity/exclusivity. Default value: The current
91
- # 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.
92
27
  # @param [SortOrder] sort_order Optional parameter: The order in which
93
28
  # results are listed in the response (`ASC` for oldest first, `DESC` for
94
29
  # newest first). Default value: `DESC`
95
30
  # @param [String] cursor Optional parameter: A pagination cursor returned by
96
31
  # a previous call to this endpoint. Provide this to retrieve the next set of
97
32
  # results for your original query. See [Paginating
98
- # results](#paginatingresults) for more information.
33
+ # results](https://developer.squareup.com/docs/working-with-apis/pagination)
34
+ # for more information.
99
35
  # @return [ListTransactionsResponse Hash] response from the API call
100
36
  def list_transactions(location_id:,
101
37
  begin_time: nil,
@@ -140,66 +76,6 @@ module Square
140
76
  )
141
77
  end
142
78
 
143
- # Charges a card represented by a card nonce or a customer's card on file.
144
- # Your request to this endpoint must include _either_:
145
- # - A value for the `card_nonce` parameter (to charge a card nonce generated
146
- # with the `SqPaymentForm`)
147
- # - Values for the `customer_card_id` and `customer_id` parameters (to
148
- # charge
149
- # a customer's card on file)
150
- # In order for an eCommerce payment to potentially qualify for
151
- # [Square chargeback protection](https://squareup.com/help/article/5394),
152
- # you
153
- # _must_ provide values for the following parameters in your request:
154
- # - `buyer_email_address`
155
- # - At least one of `billing_address` or `shipping_address`
156
- # When this response is returned, the amount of Square's processing fee
157
- # might not yet be
158
- # calculated. To obtain the processing fee, wait about ten seconds and call
159
- # [RetrieveTransaction](#endpoint-retrievetransaction). See the
160
- # `processing_fee_money`
161
- # field of each [Tender included](#type-tender) in the transaction.
162
- # @param [String] location_id Required parameter: The ID of the location to
163
- # associate the created transaction with.
164
- # @param [ChargeRequest] body Required parameter: An object containing the
165
- # fields to POST for the request. See the corresponding object definition
166
- # for field details.
167
- # @return [ChargeResponse Hash] response from the API call
168
- def charge(location_id:,
169
- body:)
170
- warn 'Endpoint charge in TransactionsApi is deprecated'
171
- # Prepare query url.
172
- _query_builder = config.get_base_uri
173
- _query_builder << '/v2/locations/{location_id}/transactions'
174
- _query_builder = APIHelper.append_url_with_template_parameters(
175
- _query_builder,
176
- 'location_id' => { 'value' => location_id, 'encode' => true }
177
- )
178
- _query_url = APIHelper.clean_url _query_builder
179
-
180
- # Prepare headers.
181
- _headers = {
182
- 'accept' => 'application/json',
183
- 'content-type' => 'application/json; charset=utf-8'
184
- }
185
-
186
- # Prepare and execute HttpRequest.
187
- _request = config.http_client.post(
188
- _query_url,
189
- headers: _headers,
190
- parameters: body.to_json
191
- )
192
- OAuth2.apply(config, _request)
193
- _response = execute_request(_request)
194
-
195
- # Return appropriate response type.
196
- decoded = APIHelper.json_deserialize(_response.raw_body)
197
- _errors = APIHelper.map_response(decoded, ['errors'])
198
- ApiResponse.new(
199
- _response, data: decoded, errors: _errors
200
- )
201
- end
202
-
203
79
  # Retrieves details for a single transaction.
204
80
  # @param [String] location_id Required parameter: The ID of the
205
81
  # transaction's associated location.
@@ -241,7 +117,7 @@ module Square
241
117
  end
242
118
 
243
119
  # Captures a transaction that was created with the
244
- # [Charge](#endpoint-charge)
120
+ # [Charge]($e/Transactions/Charge)
245
121
  # endpoint with a `delay_capture` value of `true`.
246
122
  # See [Delayed capture
247
123
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov
@@ -284,60 +160,8 @@ module Square
284
160
  )
285
161
  end
286
162
 
287
- # Initiates a refund for a previously charged tender.
288
- # You must issue a refund within 120 days of the associated payment. See
289
- # [this article](https://squareup.com/help/us/en/article/5060) for more
290
- # information
291
- # on refund behavior.
292
- # NOTE: Card-present transactions with Interac credit cards **cannot be
293
- # refunded using the Connect API**. Interac transactions must refunded
294
- # in-person (e.g., dipping the card using POS app).
295
- # @param [String] location_id Required parameter: The ID of the original
296
- # transaction's associated location.
297
- # @param [String] transaction_id Required parameter: The ID of the original
298
- # transaction that includes the tender to refund.
299
- # @param [CreateRefundRequest] body Required parameter: An object containing
300
- # the fields to POST for the request. See the corresponding object
301
- # definition for field details.
302
- # @return [CreateRefundResponse Hash] response from the API call
303
- def create_refund(location_id:,
304
- transaction_id:,
305
- body:)
306
- warn 'Endpoint create_refund in TransactionsApi is deprecated'
307
- # Prepare query url.
308
- _query_builder = config.get_base_uri
309
- _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
310
- _query_builder = APIHelper.append_url_with_template_parameters(
311
- _query_builder,
312
- 'location_id' => { 'value' => location_id, 'encode' => true },
313
- 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
314
- )
315
- _query_url = APIHelper.clean_url _query_builder
316
-
317
- # Prepare headers.
318
- _headers = {
319
- 'accept' => 'application/json',
320
- 'content-type' => 'application/json; charset=utf-8'
321
- }
322
-
323
- # Prepare and execute HttpRequest.
324
- _request = config.http_client.post(
325
- _query_url,
326
- headers: _headers,
327
- parameters: body.to_json
328
- )
329
- OAuth2.apply(config, _request)
330
- _response = execute_request(_request)
331
-
332
- # Return appropriate response type.
333
- decoded = APIHelper.json_deserialize(_response.raw_body)
334
- _errors = APIHelper.map_response(decoded, ['errors'])
335
- ApiResponse.new(
336
- _response, data: decoded, errors: _errors
337
- )
338
- end
339
-
340
- # 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)
341
165
  # endpoint with a `delay_capture` value of `true`.
342
166
  # See [Delayed capture
343
167
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov