square.rb 12.0.0.20210616 → 15.0.0.20211020

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.
@@ -6,13 +6,14 @@ module Square
6
6
  end
7
7
 
8
8
  # Returns a paginated list of `BreakType` instances for a business.
9
- # @param [String] location_id Optional parameter: Filter Break Types
10
- # returned to only those that are associated with the specified location.
11
- # @param [Integer] limit Optional parameter: Maximum number of Break Types
12
- # to return per page. Can range between 1 and 200. The default is the
13
- # maximum at 200.
14
- # @param [String] cursor Optional parameter: Pointer to the next page of
15
- # Break Type results to fetch.
9
+ # @param [String] location_id Optional parameter: Filter the returned
10
+ # `BreakType` results to only those that are associated with the specified
11
+ # location.
12
+ # @param [Integer] limit Optional parameter: The maximum number of
13
+ # `BreakType` results to return per page. The number can range between 1 and
14
+ # 200. The default is 200.
15
+ # @param [String] cursor Optional parameter: A pointer to the next page of
16
+ # `BreakType` results to fetch.
16
17
  # @return [ListBreakTypesResponse Hash] response from the API call
17
18
  def list_break_types(location_id: nil,
18
19
  limit: nil,
@@ -57,8 +58,8 @@ module Square
57
58
  # - `break_name`
58
59
  # - `expected_duration`
59
60
  # - `is_paid`
60
- # You can only have 3 `BreakType` instances per location. If you attempt to
61
- # add a 4th
61
+ # You can only have three `BreakType` instances per location. If you attempt
62
+ # to add a fourth
62
63
  # `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of
63
64
  # 3 breaks per location."
64
65
  # is returned.
@@ -97,7 +98,7 @@ module Square
97
98
 
98
99
  # Deletes an existing `BreakType`.
99
100
  # A `BreakType` can be deleted even if it is referenced from a `Shift`.
100
- # @param [String] id Required parameter: UUID for the `BreakType` being
101
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
101
102
  # deleted.
102
103
  # @return [DeleteBreakTypeResponse Hash] response from the API call
103
104
  def delete_break_type(id:)
@@ -131,8 +132,8 @@ module Square
131
132
  )
132
133
  end
133
134
 
134
- # Returns a single `BreakType` specified by id.
135
- # @param [String] id Required parameter: UUID for the `BreakType` being
135
+ # Returns a single `BreakType` specified by `id`.
136
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
136
137
  # retrieved.
137
138
  # @return [GetBreakTypeResponse Hash] response from the API call
138
139
  def get_break_type(id:)
@@ -167,7 +168,7 @@ module Square
167
168
  end
168
169
 
169
170
  # Updates an existing `BreakType`.
170
- # @param [String] id Required parameter: UUID for the `BreakType` being
171
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
171
172
  # updated.
172
173
  # @param [UpdateBreakTypeRequest] body Required parameter: An object
173
174
  # containing the fields to POST for the request. See the corresponding
@@ -208,13 +209,13 @@ module Square
208
209
  end
209
210
 
210
211
  # Returns a paginated list of `EmployeeWage` instances for a business.
211
- # @param [String] employee_id Optional parameter: Filter wages returned to
212
- # only those that are associated with the specified employee.
213
- # @param [Integer] limit Optional parameter: Maximum number of Employee
214
- # Wages to return per page. Can range between 1 and 200. The default is the
215
- # maximum at 200.
216
- # @param [String] cursor Optional parameter: Pointer to the next page of
217
- # Employee Wage results to fetch.
212
+ # @param [String] employee_id Optional parameter: Filter the returned wages
213
+ # to only those that are associated with the specified employee.
214
+ # @param [Integer] limit Optional parameter: The maximum number of
215
+ # `EmployeeWage` results to return per page. The number can range between 1
216
+ # and 200. The default is 200.
217
+ # @param [String] cursor Optional parameter: A pointer to the next page of
218
+ # `EmployeeWage` results to fetch.
218
219
  # @return [ListEmployeeWagesResponse Hash] response from the API call
219
220
  def list_employee_wages(employee_id: nil,
220
221
  limit: nil,
@@ -252,9 +253,9 @@ module Square
252
253
  )
253
254
  end
254
255
 
255
- # Returns a single `EmployeeWage` specified by id.
256
- # @param [String] id Required parameter: UUID for the `EmployeeWage` being
257
- # retrieved.
256
+ # Returns a single `EmployeeWage` specified by `id`.
257
+ # @param [String] id Required parameter: The UUID for the `EmployeeWage`
258
+ # being retrieved.
258
259
  # @return [GetEmployeeWageResponse Hash] response from the API call
259
260
  def get_employee_wage(id:)
260
261
  warn 'Endpoint get_employee_wage in LaborApi is deprecated'
@@ -289,7 +290,7 @@ module Square
289
290
  end
290
291
 
291
292
  # Creates a new `Shift`.
292
- # A `Shift` represents a complete work day for a single employee.
293
+ # A `Shift` represents a complete workday for a single employee.
293
294
  # You must provide the following values in your request to this
294
295
  # endpoint:
295
296
  # - `location_id`
@@ -299,12 +300,12 @@ module Square
299
300
  # when:
300
301
  # - The `status` of the new `Shift` is `OPEN` and the employee has another
301
302
  # shift with an `OPEN` status.
302
- # - The `start_at` date is in the future
303
- # - the `start_at` or `end_at` overlaps another shift for the same employee
304
- # - If `Break`s are set in the request, a break `start_at`
305
- # must not be before the `Shift.start_at`. A break `end_at` must not be
306
- # after
307
- # the `Shift.end_at`
303
+ # - The `start_at` date is in the future.
304
+ # - The `start_at` or `end_at` date overlaps another shift for the same
305
+ # employee.
306
+ # - The `Break` instances are set in the request and a break `start_at`
307
+ # is before the `Shift.start_at`, a break `end_at` is after
308
+ # the `Shift.end_at`, or both.
308
309
  # @param [CreateShiftRequest] body Required parameter: An object containing
309
310
  # the fields to POST for the request. See the corresponding object
310
311
  # definition for field details.
@@ -340,17 +341,17 @@ module Square
340
341
 
341
342
  # Returns a paginated list of `Shift` records for a business.
342
343
  # The list to be returned can be filtered by:
343
- # - Location IDs **and**
344
- # - employee IDs **and**
345
- # - shift status (`OPEN`, `CLOSED`) **and**
346
- # - shift start **and**
347
- # - shift end **and**
348
- # - work day details
344
+ # - Location IDs.
345
+ # - Employee IDs.
346
+ # - Shift status (`OPEN` and `CLOSED`).
347
+ # - Shift start.
348
+ # - Shift end.
349
+ # - Workday details.
349
350
  # The list can be sorted by:
350
- # - `start_at`
351
- # - `end_at`
352
- # - `created_at`
353
- # - `updated_at`
351
+ # - `start_at`.
352
+ # - `end_at`.
353
+ # - `created_at`.
354
+ # - `updated_at`.
354
355
  # @param [SearchShiftsRequest] body Required parameter: An object containing
355
356
  # the fields to POST for the request. See the corresponding object
356
357
  # definition for field details.
@@ -385,7 +386,7 @@ module Square
385
386
  end
386
387
 
387
388
  # Deletes a `Shift`.
388
- # @param [String] id Required parameter: UUID for the `Shift` being
389
+ # @param [String] id Required parameter: The UUID for the `Shift` being
389
390
  # deleted.
390
391
  # @return [DeleteShiftResponse Hash] response from the API call
391
392
  def delete_shift(id:)
@@ -419,8 +420,8 @@ module Square
419
420
  )
420
421
  end
421
422
 
422
- # Returns a single `Shift` specified by id.
423
- # @param [String] id Required parameter: UUID for the `Shift` being
423
+ # Returns a single `Shift` specified by `id`.
424
+ # @param [String] id Required parameter: The UUID for the `Shift` being
424
425
  # retrieved.
425
426
  # @return [GetShiftResponse Hash] response from the API call
426
427
  def get_shift(id:)
@@ -455,13 +456,14 @@ module Square
455
456
  end
456
457
 
457
458
  # Updates an existing `Shift`.
458
- # When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift`
459
- # have
459
+ # When adding a `Break` to a `Shift`, any earlier `Break` instances in the
460
+ # `Shift` have
460
461
  # the `end_at` property set to a valid RFC-3339 datetime string.
461
- # When closing a `Shift`, all `Break` instances in the shift must be
462
+ # When closing a `Shift`, all `Break` instances in the `Shift` must be
462
463
  # complete with `end_at`
463
464
  # set on each `Break`.
464
- # @param [String] id Required parameter: ID of the object being updated.
465
+ # @param [String] id Required parameter: The ID of the object being
466
+ # updated.
465
467
  # @param [UpdateShiftRequest] body Required parameter: An object containing
466
468
  # the fields to POST for the request. See the corresponding object
467
469
  # definition for field details.
@@ -501,13 +503,13 @@ module Square
501
503
  end
502
504
 
503
505
  # Returns a paginated list of `TeamMemberWage` instances for a business.
504
- # @param [String] team_member_id Optional parameter: Filter wages returned
505
- # to only those that are associated with the specified team member.
506
- # @param [Integer] limit Optional parameter: Maximum number of Team Member
507
- # Wages to return per page. Can range between 1 and 200. The default is the
508
- # maximum at 200.
509
- # @param [String] cursor Optional parameter: Pointer to the next page of
510
- # Employee Wage results to fetch.
506
+ # @param [String] team_member_id Optional parameter: Filter the returned
507
+ # wages to only those that are associated with the specified team member.
508
+ # @param [Integer] limit Optional parameter: The maximum number of
509
+ # `TeamMemberWage` results to return per page. The number can range between
510
+ # 1 and 200. The default is 200.
511
+ # @param [String] cursor Optional parameter: A pointer to the next page of
512
+ # `EmployeeWage` results to fetch.
511
513
  # @return [ListTeamMemberWagesResponse Hash] response from the API call
512
514
  def list_team_member_wages(team_member_id: nil,
513
515
  limit: nil,
@@ -544,9 +546,9 @@ module Square
544
546
  )
545
547
  end
546
548
 
547
- # Returns a single `TeamMemberWage` specified by id.
548
- # @param [String] id Required parameter: UUID for the `TeamMemberWage` being
549
- # retrieved.
549
+ # Returns a single `TeamMemberWage` specified by `id `.
550
+ # @param [String] id Required parameter: The UUID for the `TeamMemberWage`
551
+ # being retrieved.
550
552
  # @return [GetTeamMemberWageResponse Hash] response from the API call
551
553
  def get_team_member_wage(id:)
552
554
  # Prepare query url.
@@ -580,10 +582,10 @@ module Square
580
582
  end
581
583
 
582
584
  # Returns a list of `WorkweekConfig` instances for a business.
583
- # @param [Integer] limit Optional parameter: Maximum number of Workweek
584
- # Configs to return per page.
585
- # @param [String] cursor Optional parameter: Pointer to the next page of
586
- # Workweek Config results to fetch.
585
+ # @param [Integer] limit Optional parameter: The maximum number of
586
+ # `WorkweekConfigs` results to return per page.
587
+ # @param [String] cursor Optional parameter: A pointer to the next page of
588
+ # `WorkweekConfig` results to fetch.
587
589
  # @return [ListWorkweekConfigsResponse Hash] response from the API call
588
590
  def list_workweek_configs(limit: nil,
589
591
  cursor: nil)
@@ -619,7 +621,7 @@ module Square
619
621
  end
620
622
 
621
623
  # Updates a `WorkweekConfig`.
622
- # @param [String] id Required parameter: UUID for the `WorkweekConfig`
624
+ # @param [String] id Required parameter: The UUID for the `WorkweekConfig`
623
625
  # object being updated.
624
626
  # @param [UpdateWorkweekConfigRequest] body Required parameter: An object
625
627
  # containing the fields to POST for the request. See the corresponding
@@ -120,12 +120,16 @@ module Square
120
120
  # account.
121
121
  # - If you are not using the Orders API to manage orders,
122
122
  # you first perform a client-side computation to compute the points.
123
- # For spend-based and visit-based programs, you can call
123
+ # For spend-based and visit-based programs, you can first call
124
124
  # [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute the
125
- # points. For more information,
126
- # see [Loyalty Program
127
- # Overview](https://developer.squareup.com/docs/loyalty/overview).
128
- # You then provide the points in a request to this endpoint.
125
+ # points
126
+ # that you provide to this endpoint.
127
+ # __Note:__ The country of the seller's Square account determines whether
128
+ # tax is included in the purchase amount when accruing points for
129
+ # spend-based and visit-based programs.
130
+ # For more information, see [Availability of Square
131
+ # Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-
132
+ # market-availability).
129
133
  # @param [String] account_id Required parameter: The [loyalty
130
134
  # account]($m/LoyaltyAccount) ID to which to add the points.
131
135
  # @param [AccumulateLoyaltyPointsRequest] body Required parameter: An object
@@ -341,6 +345,12 @@ module Square
341
345
  # An application might call this endpoint to show the points that a buyer
342
346
  # can earn with the
343
347
  # specific purchase.
348
+ # __Note:__ The country of the seller's Square account determines whether
349
+ # tax is included in the purchase amount when accruing points for
350
+ # spend-based and visit-based programs.
351
+ # For more information, see [Availability of Square
352
+ # Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-
353
+ # market-availability).
344
354
  # @param [String] program_id Required parameter: The [loyalty
345
355
  # program]($m/LoyaltyProgram) ID, which defines the rules for accruing
346
356
  # points.
@@ -27,8 +27,8 @@ module Square
27
27
  # Credentials
28
28
  # page in the [developer dashboard](https://developer.squareup.com/apps).
29
29
  # @param [String] client_id Required parameter: Your application ID,
30
- # available from the [developer
31
- # dashboard](https://developer.squareup.com/apps).
30
+ # available from the OAuth page for your application on the Developer
31
+ # Dashboard.
32
32
  # @param [RenewTokenRequest] body Required parameter: An object containing
33
33
  # the fields to POST for the request. See the corresponding object
34
34
  # definition for field details.
@@ -84,7 +84,7 @@ module Square
84
84
  # Authorization: Client APPLICATION_SECRET
85
85
  # ```
86
86
  # Replace `APPLICATION_SECRET` with the application secret on the OAuth
87
- # page in the [developer dashboard](https://developer.squareup.com/apps).
87
+ # page for your application on the Developer Dashboard.
88
88
  # @param [RevokeTokenRequest] body Required parameter: An object containing
89
89
  # the fields to POST for the request. See the corresponding object
90
90
  # definition for field details.
@@ -121,15 +121,22 @@ module Square
121
121
  )
122
122
  end
123
123
 
124
- # Returns an OAuth access token.
125
- # The endpoint supports distinct methods of obtaining OAuth access tokens.
126
- # Applications specify a method by adding the `grant_type` parameter
127
- # in the request and also provide relevant information.
128
- # __Note:__ Regardless of the method application specified,
129
- # the endpoint always returns two items; an OAuth access token and
130
- # a refresh token in the response.
131
- # __OAuth tokens should only live on secure servers. Application clients
132
- # should never interact directly with OAuth tokens__.
124
+ # Returns an OAuth access token and a refresh token unless the
125
+ # `short_lived` parameter is set to `true`, in which case the endpoint
126
+ # returns only an access token.
127
+ # The `grant_type` parameter specifies the type of OAuth request. If
128
+ # `grant_type` is `authorization_code`, you must include the authorization
129
+ # code you received when a seller granted you authorization. If `grant_type`
130
+ # is `refresh_token`, you must provide a valid refresh token. If you are
131
+ # using
132
+ # an old version of the Square APIs (prior to March 13, 2019), `grant_type`
133
+ # can be `migration_token` and you must provide a valid migration token.
134
+ # You can use the `scopes` parameter to limit the set of permissions granted
135
+ # to the access token and refresh token. You can use the `short_lived`
136
+ # parameter
137
+ # to create an access token that expires in 24 hours.
138
+ # __Note:__ OAuth tokens should be encrypted and stored on a secure server.
139
+ # Application clients should never interact directly with OAuth tokens.
133
140
  # @param [ObtainTokenRequest] body Required parameter: An object containing
134
141
  # the fields to POST for the request. See the corresponding object
135
142
  # definition for field details.
@@ -116,6 +116,43 @@ module Square
116
116
  )
117
117
  end
118
118
 
119
+ # Creates a new order, in the `DRAFT` state, by duplicating an existing
120
+ # order. The newly created order has
121
+ # only the core fields (such as line items, taxes, and discounts) copied
122
+ # from the original order.
123
+ # @param [CloneOrderRequest] body Required parameter: An object containing
124
+ # the fields to POST for the request. See the corresponding object
125
+ # definition for field details.
126
+ # @return [CloneOrderResponse Hash] response from the API call
127
+ def clone_order(body:)
128
+ # Prepare query url.
129
+ _query_builder = config.get_base_uri
130
+ _query_builder << '/v2/orders/clone'
131
+ _query_url = APIHelper.clean_url _query_builder
132
+
133
+ # Prepare headers.
134
+ _headers = {
135
+ 'accept' => 'application/json',
136
+ 'content-type' => 'application/json; charset=utf-8'
137
+ }
138
+
139
+ # Prepare and execute HttpRequest.
140
+ _request = config.http_client.post(
141
+ _query_url,
142
+ headers: _headers,
143
+ parameters: body.to_json
144
+ )
145
+ OAuth2.apply(config, _request)
146
+ _response = execute_request(_request)
147
+
148
+ # Return appropriate response type.
149
+ decoded = APIHelper.json_deserialize(_response.raw_body)
150
+ _errors = APIHelper.map_response(decoded, ['errors'])
151
+ ApiResponse.new(
152
+ _response, data: decoded, errors: _errors
153
+ )
154
+ end
155
+
119
156
  # Search all orders for one or more locations. Orders include all sales,
120
157
  # returns, and exchanges regardless of how or when they entered the Square
121
158
  # ecosystem (such as Point of Sale, Invoices, and Connect APIs).
@@ -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; charset=utf-8'
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)
@@ -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`.