Class: Square::TerminalApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/terminal_api.rb

Overview

TerminalApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#cancel_terminal_action(action_id:) ⇒ CancelTerminalActionResponse Hash

Cancels a Terminal action request if the status of the request permits it. ‘TerminalAction`

Parameters:

  • action_id (String)

    Required parameter: Unique ID for the desired

Returns:

  • (CancelTerminalActionResponse Hash)

    response from the API call



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/square/api/terminal_api.rb', line 75

def cancel_terminal_action(action_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/actions/{action_id}/cancel',
                                 'default')
               .template_param(new_parameter(action_id, key: 'action_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#cancel_terminal_checkout(checkout_id:) ⇒ CancelTerminalCheckoutResponse Hash

Cancels a Terminal checkout request if the status of the request permits it. desired ‘TerminalCheckout`.

Parameters:

  • checkout_id (String)

    Required parameter: The unique ID for the

Returns:

  • (CancelTerminalCheckoutResponse Hash)

    response from the API call



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/square/api/terminal_api.rb', line 166

def cancel_terminal_checkout(checkout_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/checkouts/{checkout_id}/cancel',
                                 'default')
               .template_param(new_parameter(checkout_id, key: 'checkout_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#cancel_terminal_refund(terminal_refund_id:) ⇒ CancelTerminalRefundResponse Hash

Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it. the desired ‘TerminalRefund`.

Parameters:

  • terminal_refund_id (String)

    Required parameter: The unique ID for

Returns:

  • (CancelTerminalRefundResponse Hash)

    response from the API call



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/square/api/terminal_api.rb', line 258

def cancel_terminal_refund(terminal_refund_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/refunds/{terminal_refund_id}/cancel',
                                 'default')
               .template_param(new_parameter(terminal_refund_id, key: 'terminal_refund_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#create_terminal_action(body:) ⇒ CreateTerminalActionResponse Hash

Creates a Terminal action request and sends it to the specified device. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (CreateTerminalActionRequest)

    Required parameter: An object

Returns:

  • (CreateTerminalActionResponse Hash)

    response from the API call



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/square/api/terminal_api.rb', line 9

def create_terminal_action(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/actions',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#create_terminal_checkout(body:) ⇒ CreateTerminalCheckoutResponse Hash

Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (CreateTerminalCheckoutRequest)

    Required parameter: An object

Returns:

  • (CreateTerminalCheckoutResponse Hash)

    response from the API call



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/square/api/terminal_api.rb', line 98

def create_terminal_checkout(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/checkouts',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#create_terminal_refund(body:) ⇒ CreateTerminalRefundResponse Hash

Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API]($e/Refunds). containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (CreateTerminalRefundRequest)

    Required parameter: An object

Returns:

  • (CreateTerminalRefundResponse Hash)

    response from the API call



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/square/api/terminal_api.rb', line 191

def create_terminal_refund(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/refunds',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#get_terminal_action(action_id:) ⇒ GetTerminalActionResponse Hash

Retrieves a Terminal action request by ‘action_id`. Terminal action requests are available for 30 days. `TerminalAction`

Parameters:

  • action_id (String)

    Required parameter: Unique ID for the desired

Returns:

  • (GetTerminalActionResponse Hash)

    response from the API call



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/square/api/terminal_api.rb', line 55

def get_terminal_action(action_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/terminals/actions/{action_id}',
                                 'default')
               .template_param(new_parameter(action_id, key: 'action_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#get_terminal_checkout(checkout_id:) ⇒ GetTerminalCheckoutResponse Hash

Retrieves a Terminal checkout request by ‘checkout_id`. Terminal checkout requests are available for 30 days. desired `TerminalCheckout`.

Parameters:

  • checkout_id (String)

    Required parameter: The unique ID for the

Returns:

  • (GetTerminalCheckoutResponse Hash)

    response from the API call



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/square/api/terminal_api.rb', line 145

def get_terminal_checkout(checkout_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/terminals/checkouts/{checkout_id}',
                                 'default')
               .template_param(new_parameter(checkout_id, key: 'checkout_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#get_terminal_refund(terminal_refund_id:) ⇒ GetTerminalRefundResponse Hash

Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. the desired ‘TerminalRefund`.

Parameters:

  • terminal_refund_id (String)

    Required parameter: The unique ID for

Returns:

  • (GetTerminalRefundResponse Hash)

    response from the API call



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/square/api/terminal_api.rb', line 237

def get_terminal_refund(terminal_refund_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/terminals/refunds/{terminal_refund_id}',
                                 'default')
               .template_param(new_parameter(terminal_refund_id, key: 'terminal_refund_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#search_terminal_actions(body:) ⇒ SearchTerminalActionsResponse Hash

Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (SearchTerminalActionsRequest)

    Required parameter: An object

Returns:

  • (SearchTerminalActionsResponse Hash)

    response from the API call



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/square/api/terminal_api.rb', line 33

def search_terminal_actions(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/actions/search',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#search_terminal_checkouts(body:) ⇒ SearchTerminalCheckoutsResponse Hash

Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (SearchTerminalCheckoutsRequest)

    Required parameter: An object

Returns:

  • (SearchTerminalCheckoutsResponse Hash)

    response from the API call



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/square/api/terminal_api.rb', line 123

def search_terminal_checkouts(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/checkouts/search',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#search_terminal_refunds(body:) ⇒ SearchTerminalRefundsResponse Hash

Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • body (SearchTerminalRefundsRequest)

    Required parameter: An object

Returns:

  • (SearchTerminalRefundsResponse Hash)

    response from the API call



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/square/api/terminal_api.rb', line 215

def search_terminal_refunds(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/terminals/refunds/search',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end