Class: SquareConnect::V1TransactionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/square_connect/api/v1_transactions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ V1TransactionsApi

Returns a new instance of V1TransactionsApi.



16
17
18
# File 'lib/square_connect/api/v1_transactions_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/square_connect/api/v1_transactions_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#create_refund(location_id, body, opts = {}) ⇒ V1Refund

CreateRefund Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them.

Parameters:

  • location_id

    The ID of the original payment's associated location.

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



26
27
28
29
# File 'lib/square_connect/api/v1_transactions_api.rb', line 26

def create_refund(location_id, body, opts = {})
  data, _status_code, _headers = create_refund_with_http_info(location_id, body, opts)
  return data
end

#create_refund_with_http_info(location_id, body, opts = {}) ⇒ Array<(V1Refund, Fixnum, Hash)>

CreateRefund Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them.

Parameters:

  • location_id

    The ID of the original payment&#39;s associated location.

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1Refund, Fixnum, Hash)>)

    V1Refund data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/square_connect/api/v1_transactions_api.rb', line 37

def create_refund_with_http_info(location_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.create_refund ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund" if location_id.nil?
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling V1TransactionsApi.create_refund" if body.nil?
  # resource path
  local_var_path = "/v1/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1Refund')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_bank_accounts(location_id, opts = {}) ⇒ Array<V1BankAccount>

ListBankAccounts Provides non-confidential details for all of a location’s associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Parameters:

  • location_id

    The ID of the location to list bank accounts for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



84
85
86
87
# File 'lib/square_connect/api/v1_transactions_api.rb', line 84

def list_bank_accounts(location_id, opts = {})
  data, _status_code, _headers = list_bank_accounts_with_http_info(location_id, opts)
  return data
end

#list_bank_accounts_with_http_info(location_id, opts = {}) ⇒ Array<(Array<V1BankAccount>, Fixnum, Hash)>

ListBankAccounts Provides non-confidential details for all of a location&#39;s associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Parameters:

  • location_id

    The ID of the location to list bank accounts for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<V1BankAccount>, Fixnum, Hash)>)

    Array<V1BankAccount> data, response status code and response headers



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/square_connect/api/v1_transactions_api.rb', line 94

def list_bank_accounts_with_http_info(location_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_bank_accounts ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_bank_accounts" if location_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/bank-accounts".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<V1BankAccount>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#list_bank_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_orders(location_id, opts = {}) ⇒ Array<V1Order>

ListOrders Provides summary information for a merchant’s online store orders.

Parameters:

  • location_id

    The ID of the location to list online store orders for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:



142
143
144
145
# File 'lib/square_connect/api/v1_transactions_api.rb', line 142

def list_orders(location_id, opts = {})
  data, _status_code, _headers = list_orders_with_http_info(location_id, opts)
  return data
end

#list_orders_with_http_info(location_id, opts = {}) ⇒ Array<(Array<V1Order>, Fixnum, Hash)>

ListOrders Provides summary information for a merchant&#39;s online store orders.

Parameters:

  • location_id

    The ID of the location to list online store orders for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:

  • (Array<(Array<V1Order>, Fixnum, Hash)>)

    Array<V1Order> data, response status code and response headers



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/square_connect/api/v1_transactions_api.rb', line 155

def list_orders_with_http_info(location_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_orders ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_orders" if location_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/orders".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<V1Order>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#list_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_payments(location_id, opts = {}) ⇒ Array<V1Payment>

ListPayments Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. Note*: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a ‘created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request.

Parameters:

  • location_id

    The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business&#39;s locations.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    The order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

  • :include_partial (BOOLEAN)

    Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed.

Returns:



209
210
211
212
# File 'lib/square_connect/api/v1_transactions_api.rb', line 209

def list_payments(location_id, opts = {})
  data, _status_code, _headers = list_payments_with_http_info(location_id, opts)
  return data
end

#list_payments_with_http_info(location_id, opts = {}) ⇒ Array<(Array<V1Payment>, Fixnum, Hash)>

ListPayments Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. Note*: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a &#x60;created_at&#x60; value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request.

Parameters:

  • location_id

    The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business&#39;s locations.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    The order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

  • :include_partial (BOOLEAN)

    Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed.

Returns:

  • (Array<(Array<V1Payment>, Fixnum, Hash)>)

    Array<V1Payment> data, response status code and response headers



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/square_connect/api/v1_transactions_api.rb', line 225

def list_payments_with_http_info(location_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_payments ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_payments" if location_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/payments".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?
  query_params[:'include_partial'] = opts[:'include_partial'] if !opts[:'include_partial'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<V1Payment>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#list_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_refunds(location_id, opts = {}) ⇒ Array<V1Refund>

ListRefunds Provides the details for all refunds initiated by a merchant or any of the merchant’s mobile staff during a date range. Date ranges cannot exceed one year in length.

Parameters:

  • location_id

    The ID of the location to list refunds for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:



281
282
283
284
# File 'lib/square_connect/api/v1_transactions_api.rb', line 281

def list_refunds(location_id, opts = {})
  data, _status_code, _headers = list_refunds_with_http_info(location_id, opts)
  return data
end

#list_refunds_with_http_info(location_id, opts = {}) ⇒ Array<(Array<V1Refund>, Fixnum, Hash)>

ListRefunds Provides the details for all refunds initiated by a merchant or any of the merchant&#39;s mobile staff during a date range. Date ranges cannot exceed one year in length.

Parameters:

  • location_id

    The ID of the location to list refunds for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods.

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:

  • (Array<(Array<V1Refund>, Fixnum, Hash)>)

    Array<V1Refund> data, response status code and response headers



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/square_connect/api/v1_transactions_api.rb', line 296

def list_refunds_with_http_info(location_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_refunds ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds" if location_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<V1Refund>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_settlements(location_id, opts = {}) ⇒ Array<V1Settlement>

ListSettlements Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. Note*: the ListSettlements endpoint does not provide entry information.

Parameters:

  • location_id

    The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business&#39;s locations.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :status (String)

    Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED).

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:



352
353
354
355
# File 'lib/square_connect/api/v1_transactions_api.rb', line 352

def list_settlements(location_id, opts = {})
  data, _status_code, _headers = list_settlements_with_http_info(location_id, opts)
  return data
end

#list_settlements_with_http_info(location_id, opts = {}) ⇒ Array<(Array<V1Settlement>, Fixnum, Hash)>

ListSettlements Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. Note*: the ListSettlements endpoint does not provide entry information.

Parameters:

  • location_id

    The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business&#39;s locations.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :order (String)

    TThe order in which payments are listed in the response.

  • :begin_time (String)

    The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.

  • :end_time (String)

    The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.

  • :limit (Integer)

    The maximum number of payments to return in a single response. This value cannot exceed 200.

  • :status (String)

    Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED).

  • :batch_token (String)

    A pagination cursor to retrieve the next set of results for your original query to the endpoint.

Returns:

  • (Array<(Array<V1Settlement>, Fixnum, Hash)>)

    Array<V1Settlement> data, response status code and response headers



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/square_connect/api/v1_transactions_api.rb', line 368

def list_settlements_with_http_info(location_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_settlements ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_settlements" if location_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/settlements".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<V1Settlement>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#list_settlements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_bank_account(location_id, bank_account_id, opts = {}) ⇒ V1BankAccount

RetrieveBankAccount Provides non-confidential details for a merchant’s associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Parameters:

  • location_id

    The ID of the bank account&#39;s associated location.

  • bank_account_id

    The bank account&#39;s Square-issued ID. You obtain this value from Settlement objects returned.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



420
421
422
423
# File 'lib/square_connect/api/v1_transactions_api.rb', line 420

def (location_id, , opts = {})
  data, _status_code, _headers = (location_id, , opts)
  return data
end

#retrieve_bank_account_with_http_info(location_id, bank_account_id, opts = {}) ⇒ Array<(V1BankAccount, Fixnum, Hash)>

RetrieveBankAccount Provides non-confidential details for a merchant&#39;s associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Parameters:

  • location_id

    The ID of the bank account&#39;s associated location.

  • bank_account_id

    The bank account&#39;s Square-issued ID. You obtain this value from Settlement objects returned.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1BankAccount, Fixnum, Hash)>)

    V1BankAccount data, response status code and response headers



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/square_connect/api/v1_transactions_api.rb', line 431

def (location_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_bank_account ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_bank_account" if location_id.nil?
  # verify the required parameter 'bank_account_id' is set
  fail ArgumentError, "Missing the required parameter 'bank_account_id' when calling V1TransactionsApi.retrieve_bank_account" if .nil?
  # resource path
  local_var_path = "/v1/{location_id}/bank-accounts/{bank_account_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'bank_account_id' + '}', .to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1BankAccount')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_bank_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_order(location_id, order_id, opts = {}) ⇒ V1Order

RetrieveOrder Provides comprehensive information for a single online store order, including the order’s history.

Parameters:

  • location_id

    The ID of the order&#39;s associated location.

  • order_id

    The order&#39;s Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



479
480
481
482
# File 'lib/square_connect/api/v1_transactions_api.rb', line 479

def retrieve_order(location_id, order_id, opts = {})
  data, _status_code, _headers = retrieve_order_with_http_info(location_id, order_id, opts)
  return data
end

#retrieve_order_with_http_info(location_id, order_id, opts = {}) ⇒ Array<(V1Order, Fixnum, Hash)>

RetrieveOrder Provides comprehensive information for a single online store order, including the order&#39;s history.

Parameters:

  • location_id

    The ID of the order&#39;s associated location.

  • order_id

    The order&#39;s Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1Order, Fixnum, Hash)>)

    V1Order data, response status code and response headers



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/square_connect/api/v1_transactions_api.rb', line 490

def retrieve_order_with_http_info(location_id, order_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_order ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_order" if location_id.nil?
  # verify the required parameter 'order_id' is set
  fail ArgumentError, "Missing the required parameter 'order_id' when calling V1TransactionsApi.retrieve_order" if order_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/orders/{order_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'order_id' + '}', order_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1Order')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_payment(location_id, payment_id, opts = {}) ⇒ V1Payment

RetrievePayment Provides comprehensive information for a single payment.

Parameters:

  • location_id

    The ID of the payment&#39;s associated location.

  • payment_id

    The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



538
539
540
541
# File 'lib/square_connect/api/v1_transactions_api.rb', line 538

def retrieve_payment(location_id, payment_id, opts = {})
  data, _status_code, _headers = retrieve_payment_with_http_info(location_id, payment_id, opts)
  return data
end

#retrieve_payment_with_http_info(location_id, payment_id, opts = {}) ⇒ Array<(V1Payment, Fixnum, Hash)>

RetrievePayment Provides comprehensive information for a single payment.

Parameters:

  • location_id

    The ID of the payment&#39;s associated location.

  • payment_id

    The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1Payment, Fixnum, Hash)>)

    V1Payment data, response status code and response headers



549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/square_connect/api/v1_transactions_api.rb', line 549

def retrieve_payment_with_http_info(location_id, payment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_payment ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_payment" if location_id.nil?
  # verify the required parameter 'payment_id' is set
  fail ArgumentError, "Missing the required parameter 'payment_id' when calling V1TransactionsApi.retrieve_payment" if payment_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/payments/{payment_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'payment_id' + '}', payment_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1Payment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_settlement(location_id, settlement_id, opts = {}) ⇒ V1Settlement

RetrieveSettlement Provides comprehensive information for a single settlement. The returned ‘Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement completes, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer.

Parameters:

  • location_id

    The ID of the settlements&#39;s associated location.

  • settlement_id

    The settlement&#39;s Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



597
598
599
600
# File 'lib/square_connect/api/v1_transactions_api.rb', line 597

def retrieve_settlement(location_id, settlement_id, opts = {})
  data, _status_code, _headers = retrieve_settlement_with_http_info(location_id, settlement_id, opts)
  return data
end

#retrieve_settlement_with_http_info(location_id, settlement_id, opts = {}) ⇒ Array<(V1Settlement, Fixnum, Hash)>

RetrieveSettlement Provides comprehensive information for a single settlement. The returned &#x60;Settlement&#x60; objects include an &#x60;entries&#x60; field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement completes, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer.

Parameters:

  • location_id

    The ID of the settlements&#39;s associated location.

  • settlement_id

    The settlement&#39;s Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1Settlement, Fixnum, Hash)>)

    V1Settlement data, response status code and response headers



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/square_connect/api/v1_transactions_api.rb', line 608

def retrieve_settlement_with_http_info(location_id, settlement_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_settlement ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_settlement" if location_id.nil?
  # verify the required parameter 'settlement_id' is set
  fail ArgumentError, "Missing the required parameter 'settlement_id' when calling V1TransactionsApi.retrieve_settlement" if settlement_id.nil?
  # resource path
  local_var_path = "/v1/{location_id}/settlements/{settlement_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'settlement_id' + '}', settlement_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1Settlement')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_settlement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_order(location_id, order_id, body, opts = {}) ⇒ V1Order

UpdateOrder Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:

Parameters:

  • location_id

    The ID of the order&#39;s associated location.

  • order_id

    The order&#39;s Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



657
658
659
660
# File 'lib/square_connect/api/v1_transactions_api.rb', line 657

def update_order(location_id, order_id, body, opts = {})
  data, _status_code, _headers = update_order_with_http_info(location_id, order_id, body, opts)
  return data
end

#update_order_with_http_info(location_id, order_id, body, opts = {}) ⇒ Array<(V1Order, Fixnum, Hash)>

UpdateOrder Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:

Parameters:

  • location_id

    The ID of the order&#39;s associated location.

  • order_id

    The order&#39;s Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(V1Order, Fixnum, Hash)>)

    V1Order data, response status code and response headers



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/square_connect/api/v1_transactions_api.rb', line 669

def update_order_with_http_info(location_id, order_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: V1TransactionsApi.update_order ..."
  end
  # verify the required parameter 'location_id' is set
  fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.update_order" if location_id.nil?
  # verify the required parameter 'order_id' is set
  fail ArgumentError, "Missing the required parameter 'order_id' when calling V1TransactionsApi.update_order" if order_id.nil?
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling V1TransactionsApi.update_order" if body.nil?
  # resource path
  local_var_path = "/v1/{location_id}/orders/{order_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'order_id' + '}', order_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  
  header_params['Square-Version'] = "2019-06-12"

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1Order')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: V1TransactionsApi#update_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end