square.rb 26.1.0.20230119 → 26.2.0.20230315
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.
- checksums.yaml +4 -4
- data/lib/square/api/apple_pay_api.rb +14 -30
- data/lib/square/api/bank_accounts_api.rb +40 -90
- data/lib/square/api/base_api.rb +42 -42
- data/lib/square/api/booking_custom_attributes_api.rb +164 -329
- data/lib/square/api/bookings_api.rb +135 -260
- data/lib/square/api/cards_api.rb +56 -118
- data/lib/square/api/cash_drawers_api.rb +47 -103
- data/lib/square/api/catalog_api.rb +197 -423
- data/lib/square/api/checkout_api.rb +85 -175
- data/lib/square/api/customer_custom_attributes_api.rb +150 -303
- data/lib/square/api/customer_groups_api.rb +69 -145
- data/lib/square/api/customer_segments_api.rb +26 -61
- data/lib/square/api/customers_api.rb +147 -294
- data/lib/square/api/devices_api.rb +42 -89
- data/lib/square/api/disputes_api.rb +130 -288
- data/lib/square/api/employees_api.rb +28 -63
- data/lib/square/api/gift_card_activities_api.rb +33 -65
- data/lib/square/api/gift_cards_api.rb +103 -202
- data/lib/square/api/inventory_api.rb +179 -366
- data/lib/square/api/invoices_api.rb +118 -237
- data/lib/square/api/labor_api.rb +223 -459
- data/lib/square/api/location_custom_attributes_api.rb +166 -331
- data/lib/square/api/locations_api.rb +54 -112
- data/lib/square/api/loyalty_api.rb +259 -512
- data/lib/square/api/merchants_api.rb +25 -60
- data/lib/square/api/mobile_authorization_api.rb +14 -30
- data/lib/square/api/o_auth_api.rb +54 -109
- data/lib/square/api/order_custom_attributes_api.rb +168 -333
- data/lib/square/api/orders_api.rb +115 -222
- data/lib/square/api/payments_api.rb +106 -208
- data/lib/square/api/payouts_api.rb +47 -100
- data/lib/square/api/refunds_api.rb +46 -93
- data/lib/square/api/sites_api.rb +11 -28
- data/lib/square/api/snippets_api.rb +42 -90
- data/lib/square/api/subscriptions_api.rb +150 -299
- data/lib/square/api/team_api.rb +114 -224
- data/lib/square/api/terminal_api.rb +162 -328
- data/lib/square/api/transactions_api.rb +62 -126
- data/lib/square/api/v1_transactions_api.rb +155 -296
- data/lib/square/api/vendors_api.rb +99 -192
- data/lib/square/api/webhook_subscriptions_api.rb +115 -235
- data/lib/square/api_helper.rb +1 -437
- data/lib/square/client.rb +77 -47
- data/lib/square/configuration.rb +28 -53
- data/lib/square/exceptions/api_exception.rb +1 -11
- data/lib/square/http/api_response.rb +13 -19
- data/lib/square/http/auth/o_auth2.rb +14 -7
- data/lib/square/http/http_call_back.rb +1 -15
- data/lib/square/http/http_method_enum.rb +1 -4
- data/lib/square/http/http_request.rb +1 -45
- data/lib/square/http/http_response.rb +1 -20
- data/lib/square/utilities/date_time_helper.rb +1 -146
- data/lib/square/utilities/file_wrapper.rb +5 -5
- data/lib/square.rb +6 -6
- data/spec/user_journey_spec.rb +2 -2
- data/test/api/api_test_base.rb +13 -5
- data/test/api/test_catalog_api.rb +5 -4
- data/test/api/test_customers_api.rb +3 -2
- data/test/api/test_employees_api.rb +4 -3
- data/test/api/test_labor_api.rb +6 -5
- data/test/api/test_locations_api.rb +3 -2
- data/test/api/test_merchants_api.rb +4 -3
- data/test/api/test_payments_api.rb +4 -3
- data/test/api/test_refunds_api.rb +4 -3
- metadata +11 -111
- data/lib/square/exceptions/validation_exception.rb +0 -13
- data/lib/square/http/faraday_client.rb +0 -93
- data/lib/square/http/http_client.rb +0 -118
- data/test/test_helper.rb +0 -89
@@ -1,10 +1,6 @@
|
|
1
1
|
module Square
|
2
2
|
# PaymentsApi
|
3
3
|
class PaymentsApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
4
|
# Retrieves a list of payments taken by the account making the request.
|
9
5
|
# Results are eventually consistent, and new payments or changes to payments
|
10
6
|
# might take several
|
@@ -48,42 +44,26 @@ module Square
|
|
48
44
|
last_4: nil,
|
49
45
|
card_brand: nil,
|
50
46
|
limit: nil)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
# Prepare and execute HttpRequest.
|
74
|
-
_request = config.http_client.get(
|
75
|
-
_query_url,
|
76
|
-
headers: _headers
|
77
|
-
)
|
78
|
-
OAuth2.apply(config, _request)
|
79
|
-
_response = execute_request(_request)
|
80
|
-
|
81
|
-
# Return appropriate response type.
|
82
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
83
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
84
|
-
ApiResponse.new(
|
85
|
-
_response, data: decoded, errors: _errors
|
86
|
-
)
|
47
|
+
new_api_call_builder
|
48
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
49
|
+
'/v2/payments',
|
50
|
+
'default')
|
51
|
+
.query_param(new_parameter(begin_time, key: 'begin_time'))
|
52
|
+
.query_param(new_parameter(end_time, key: 'end_time'))
|
53
|
+
.query_param(new_parameter(sort_order, key: 'sort_order'))
|
54
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
55
|
+
.query_param(new_parameter(location_id, key: 'location_id'))
|
56
|
+
.query_param(new_parameter(total, key: 'total'))
|
57
|
+
.query_param(new_parameter(last_4, key: 'last_4'))
|
58
|
+
.query_param(new_parameter(card_brand, key: 'card_brand'))
|
59
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
60
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
61
|
+
.auth(Single.new('global')))
|
62
|
+
.response(new_response_handler
|
63
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
64
|
+
.is_api_response(true)
|
65
|
+
.convertor(ApiResponse.method(:create)))
|
66
|
+
.execute
|
87
67
|
end
|
88
68
|
|
89
69
|
# Creates a payment using the provided source. You can use this endpoint
|
@@ -99,32 +79,20 @@ module Square
|
|
99
79
|
# object definition for field details.
|
100
80
|
# @return [CreatePaymentResponse Hash] response from the API call
|
101
81
|
def create_payment(body:)
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
headers: _headers,
|
117
|
-
parameters: body.to_json
|
118
|
-
)
|
119
|
-
OAuth2.apply(config, _request)
|
120
|
-
_response = execute_request(_request)
|
121
|
-
|
122
|
-
# Return appropriate response type.
|
123
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
124
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
125
|
-
ApiResponse.new(
|
126
|
-
_response, data: decoded, errors: _errors
|
127
|
-
)
|
82
|
+
new_api_call_builder
|
83
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
84
|
+
'/v2/payments',
|
85
|
+
'default')
|
86
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
87
|
+
.body_param(new_parameter(body))
|
88
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
89
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
90
|
+
.auth(Single.new('global')))
|
91
|
+
.response(new_response_handler
|
92
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
93
|
+
.is_api_response(true)
|
94
|
+
.convertor(ApiResponse.method(:create)))
|
95
|
+
.execute
|
128
96
|
end
|
129
97
|
|
130
98
|
# Cancels (voids) a payment identified by the idempotency key that is
|
@@ -147,32 +115,20 @@ module Square
|
|
147
115
|
# corresponding object definition for field details.
|
148
116
|
# @return [CancelPaymentByIdempotencyKeyResponse Hash] response from the API call
|
149
117
|
def cancel_payment_by_idempotency_key(body:)
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
headers: _headers,
|
165
|
-
parameters: body.to_json
|
166
|
-
)
|
167
|
-
OAuth2.apply(config, _request)
|
168
|
-
_response = execute_request(_request)
|
169
|
-
|
170
|
-
# Return appropriate response type.
|
171
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
172
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
173
|
-
ApiResponse.new(
|
174
|
-
_response, data: decoded, errors: _errors
|
175
|
-
)
|
118
|
+
new_api_call_builder
|
119
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
120
|
+
'/v2/payments/cancel',
|
121
|
+
'default')
|
122
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
123
|
+
.body_param(new_parameter(body))
|
124
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
125
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
126
|
+
.auth(Single.new('global')))
|
127
|
+
.response(new_response_handler
|
128
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
129
|
+
.is_api_response(true)
|
130
|
+
.convertor(ApiResponse.method(:create)))
|
131
|
+
.execute
|
176
132
|
end
|
177
133
|
|
178
134
|
# Retrieves details for a specific payment.
|
@@ -180,34 +136,19 @@ module Square
|
|
180
136
|
# payment.
|
181
137
|
# @return [GetPaymentResponse Hash] response from the API call
|
182
138
|
def get_payment(payment_id:)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
# Prepare and execute HttpRequest.
|
198
|
-
_request = config.http_client.get(
|
199
|
-
_query_url,
|
200
|
-
headers: _headers
|
201
|
-
)
|
202
|
-
OAuth2.apply(config, _request)
|
203
|
-
_response = execute_request(_request)
|
204
|
-
|
205
|
-
# Return appropriate response type.
|
206
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
207
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
208
|
-
ApiResponse.new(
|
209
|
-
_response, data: decoded, errors: _errors
|
210
|
-
)
|
139
|
+
new_api_call_builder
|
140
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
141
|
+
'/v2/payments/{payment_id}',
|
142
|
+
'default')
|
143
|
+
.template_param(new_parameter(payment_id, key: 'payment_id')
|
144
|
+
.should_encode(true))
|
145
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
146
|
+
.auth(Single.new('global')))
|
147
|
+
.response(new_response_handler
|
148
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
149
|
+
.is_api_response(true)
|
150
|
+
.convertor(ApiResponse.method(:create)))
|
151
|
+
.execute
|
211
152
|
end
|
212
153
|
|
213
154
|
# Updates a payment with the APPROVED status.
|
@@ -220,36 +161,22 @@ module Square
|
|
220
161
|
# @return [UpdatePaymentResponse Hash] response from the API call
|
221
162
|
def update_payment(payment_id:,
|
222
163
|
body:)
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
_request = config.http_client.put(
|
240
|
-
_query_url,
|
241
|
-
headers: _headers,
|
242
|
-
parameters: body.to_json
|
243
|
-
)
|
244
|
-
OAuth2.apply(config, _request)
|
245
|
-
_response = execute_request(_request)
|
246
|
-
|
247
|
-
# Return appropriate response type.
|
248
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
249
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
250
|
-
ApiResponse.new(
|
251
|
-
_response, data: decoded, errors: _errors
|
252
|
-
)
|
164
|
+
new_api_call_builder
|
165
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
166
|
+
'/v2/payments/{payment_id}',
|
167
|
+
'default')
|
168
|
+
.template_param(new_parameter(payment_id, key: 'payment_id')
|
169
|
+
.should_encode(true))
|
170
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
171
|
+
.body_param(new_parameter(body))
|
172
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
173
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
174
|
+
.auth(Single.new('global')))
|
175
|
+
.response(new_response_handler
|
176
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
177
|
+
.is_api_response(true)
|
178
|
+
.convertor(ApiResponse.method(:create)))
|
179
|
+
.execute
|
253
180
|
end
|
254
181
|
|
255
182
|
# Cancels (voids) a payment. You can use this endpoint to cancel a payment
|
@@ -259,34 +186,19 @@ module Square
|
|
259
186
|
# cancel.
|
260
187
|
# @return [CancelPaymentResponse Hash] response from the API call
|
261
188
|
def cancel_payment(payment_id:)
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
# Prepare and execute HttpRequest.
|
277
|
-
_request = config.http_client.post(
|
278
|
-
_query_url,
|
279
|
-
headers: _headers
|
280
|
-
)
|
281
|
-
OAuth2.apply(config, _request)
|
282
|
-
_response = execute_request(_request)
|
283
|
-
|
284
|
-
# Return appropriate response type.
|
285
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
286
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
287
|
-
ApiResponse.new(
|
288
|
-
_response, data: decoded, errors: _errors
|
289
|
-
)
|
189
|
+
new_api_call_builder
|
190
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
191
|
+
'/v2/payments/{payment_id}/cancel',
|
192
|
+
'default')
|
193
|
+
.template_param(new_parameter(payment_id, key: 'payment_id')
|
194
|
+
.should_encode(true))
|
195
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
196
|
+
.auth(Single.new('global')))
|
197
|
+
.response(new_response_handler
|
198
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
199
|
+
.is_api_response(true)
|
200
|
+
.convertor(ApiResponse.method(:create)))
|
201
|
+
.execute
|
290
202
|
end
|
291
203
|
|
292
204
|
# Completes (captures) a payment.
|
@@ -302,36 +214,22 @@ module Square
|
|
302
214
|
# @return [CompletePaymentResponse Hash] response from the API call
|
303
215
|
def complete_payment(payment_id:,
|
304
216
|
body:)
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
_request = config.http_client.post(
|
322
|
-
_query_url,
|
323
|
-
headers: _headers,
|
324
|
-
parameters: body.to_json
|
325
|
-
)
|
326
|
-
OAuth2.apply(config, _request)
|
327
|
-
_response = execute_request(_request)
|
328
|
-
|
329
|
-
# Return appropriate response type.
|
330
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
331
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
332
|
-
ApiResponse.new(
|
333
|
-
_response, data: decoded, errors: _errors
|
334
|
-
)
|
217
|
+
new_api_call_builder
|
218
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
219
|
+
'/v2/payments/{payment_id}/complete',
|
220
|
+
'default')
|
221
|
+
.template_param(new_parameter(payment_id, key: 'payment_id')
|
222
|
+
.should_encode(true))
|
223
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
224
|
+
.body_param(new_parameter(body))
|
225
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
226
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
227
|
+
.auth(Single.new('global')))
|
228
|
+
.response(new_response_handler
|
229
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
230
|
+
.is_api_response(true)
|
231
|
+
.convertor(ApiResponse.method(:create)))
|
232
|
+
.execute
|
335
233
|
end
|
336
234
|
end
|
337
235
|
end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
module Square
|
2
2
|
# PayoutsApi
|
3
3
|
class PayoutsApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
4
|
# Retrieves a list of all payouts for the default location.
|
9
5
|
# You can filter payouts by location ID, status, time range, and order them
|
10
6
|
# in ascending or descending order.
|
@@ -40,40 +36,24 @@ module Square
|
|
40
36
|
sort_order: nil,
|
41
37
|
cursor: nil,
|
42
38
|
limit: nil)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
# Prepare and execute HttpRequest.
|
64
|
-
_request = config.http_client.get(
|
65
|
-
_query_url,
|
66
|
-
headers: _headers
|
67
|
-
)
|
68
|
-
OAuth2.apply(config, _request)
|
69
|
-
_response = execute_request(_request)
|
70
|
-
|
71
|
-
# Return appropriate response type.
|
72
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
-
ApiResponse.new(
|
75
|
-
_response, data: decoded, errors: _errors
|
76
|
-
)
|
39
|
+
new_api_call_builder
|
40
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
41
|
+
'/v2/payouts',
|
42
|
+
'default')
|
43
|
+
.query_param(new_parameter(location_id, key: 'location_id'))
|
44
|
+
.query_param(new_parameter(status, key: 'status'))
|
45
|
+
.query_param(new_parameter(begin_time, key: 'begin_time'))
|
46
|
+
.query_param(new_parameter(end_time, key: 'end_time'))
|
47
|
+
.query_param(new_parameter(sort_order, key: 'sort_order'))
|
48
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
49
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
50
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
51
|
+
.auth(Single.new('global')))
|
52
|
+
.response(new_response_handler
|
53
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
54
|
+
.is_api_response(true)
|
55
|
+
.convertor(ApiResponse.method(:create)))
|
56
|
+
.execute
|
77
57
|
end
|
78
58
|
|
79
59
|
# Retrieves details of a specific payout identified by a payout ID.
|
@@ -82,34 +62,19 @@ module Square
|
|
82
62
|
# retrieve the information for.
|
83
63
|
# @return [GetPayoutResponse Hash] response from the API call
|
84
64
|
def get_payout(payout_id:)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
# Prepare and execute HttpRequest.
|
100
|
-
_request = config.http_client.get(
|
101
|
-
_query_url,
|
102
|
-
headers: _headers
|
103
|
-
)
|
104
|
-
OAuth2.apply(config, _request)
|
105
|
-
_response = execute_request(_request)
|
106
|
-
|
107
|
-
# Return appropriate response type.
|
108
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
109
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
110
|
-
ApiResponse.new(
|
111
|
-
_response, data: decoded, errors: _errors
|
112
|
-
)
|
65
|
+
new_api_call_builder
|
66
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
67
|
+
'/v2/payouts/{payout_id}',
|
68
|
+
'default')
|
69
|
+
.template_param(new_parameter(payout_id, key: 'payout_id')
|
70
|
+
.should_encode(true))
|
71
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
72
|
+
.auth(Single.new('global')))
|
73
|
+
.response(new_response_handler
|
74
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
75
|
+
.is_api_response(true)
|
76
|
+
.convertor(ApiResponse.method(:create)))
|
77
|
+
.execute
|
113
78
|
end
|
114
79
|
|
115
80
|
# Retrieves a list of all payout entries for a specific payout.
|
@@ -134,40 +99,22 @@ module Square
|
|
134
99
|
sort_order: nil,
|
135
100
|
cursor: nil,
|
136
101
|
limit: nil)
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
_headers = {
|
154
|
-
'accept' => 'application/json'
|
155
|
-
}
|
156
|
-
|
157
|
-
# Prepare and execute HttpRequest.
|
158
|
-
_request = config.http_client.get(
|
159
|
-
_query_url,
|
160
|
-
headers: _headers
|
161
|
-
)
|
162
|
-
OAuth2.apply(config, _request)
|
163
|
-
_response = execute_request(_request)
|
164
|
-
|
165
|
-
# Return appropriate response type.
|
166
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
167
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
168
|
-
ApiResponse.new(
|
169
|
-
_response, data: decoded, errors: _errors
|
170
|
-
)
|
102
|
+
new_api_call_builder
|
103
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
104
|
+
'/v2/payouts/{payout_id}/payout-entries',
|
105
|
+
'default')
|
106
|
+
.template_param(new_parameter(payout_id, key: 'payout_id')
|
107
|
+
.should_encode(true))
|
108
|
+
.query_param(new_parameter(sort_order, key: 'sort_order'))
|
109
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
110
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
111
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
112
|
+
.auth(Single.new('global')))
|
113
|
+
.response(new_response_handler
|
114
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
115
|
+
.is_api_response(true)
|
116
|
+
.convertor(ApiResponse.method(:create)))
|
117
|
+
.execute
|
171
118
|
end
|
172
119
|
end
|
173
120
|
end
|