square.rb 9.0.0.20210226 → 9.1.0.20210317
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/square/api/apple_pay_api.rb +8 -7
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/checkout_api.rb +2 -2
- data/lib/square/api/payments_api.rb +57 -18
- data/lib/square/api/refunds_api.rb +6 -1
- data/lib/square/api/terminal_api.rb +15 -14
- data/lib/square/client.rb +2 -2
- data/lib/square/configuration.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0073c43aaa6518848223c41ea272fa28f77cf58b9ade77aae705423849a37bb3
|
4
|
+
data.tar.gz: 6d1f79d5fd9c6224e3a1b6769faf8c1c7b93b2a98357878a42a816a522d2a0a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d9da7a0178efe277fcacb6ea12c73b4c03aee542edd5ce2791eeda0d97f5e8787d467f1031f260321305c060b0bb59904bab13ecf5218507d2d236c0b5ab945
|
7
|
+
data.tar.gz: 54f48e7dd8de672b7eadc9282e4e1dfb41e8c925a60093b450b94d2e26f7e92859f61b59c7730e65b81b1510ff9bf9affa40b28b4e8a35807e811e2a0a816802
|
@@ -5,17 +5,18 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Activates a domain for use with
|
9
|
-
#
|
8
|
+
# Activates a domain for use with Apple Pay on the Web and Square. A
|
9
|
+
# validation
|
10
|
+
# is performed on this domain by Apple to ensure that it is properly set up
|
10
11
|
# as
|
11
12
|
# an Apple Pay enabled domain.
|
12
13
|
# This endpoint provides an easy way for platform developers to bulk
|
13
14
|
# activate
|
14
|
-
#
|
15
|
-
# To learn more about
|
16
|
-
# [
|
17
|
-
#
|
18
|
-
# -
|
15
|
+
# Apple Pay on the Web with Square for merchants using their platform.
|
16
|
+
# To learn more about Web Apple Pay, see
|
17
|
+
# [Add the Apple Pay on the Web
|
18
|
+
# Button](https://developer.squareup.com/docs/payment-form/add-digital-walle
|
19
|
+
# ts/apple-pay).
|
19
20
|
# @param [RegisterDomainRequest] body Required parameter: An object
|
20
21
|
# containing the fields to POST for the request. See the corresponding
|
21
22
|
# object definition for field details.
|
data/lib/square/api/base_api.rb
CHANGED
@@ -5,8 +5,8 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Links a `checkoutId` to a `checkout_page_url` that customers
|
9
|
-
#
|
8
|
+
# Links a `checkoutId` to a `checkout_page_url` that customers are
|
9
|
+
# directed to in order to provide their payment information using a
|
10
10
|
# payment processing workflow hosted on connect.squareup.com.
|
11
11
|
# @param [String] location_id Required parameter: The ID of the business
|
12
12
|
# location to associate the checkout with.
|
@@ -83,16 +83,14 @@ module Square
|
|
83
83
|
)
|
84
84
|
end
|
85
85
|
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
# The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required
|
95
|
-
# to enable application fees.
|
86
|
+
# Creates a payment using the provided source. You can use this endpoint
|
87
|
+
# to charge a card (credit/debit card or
|
88
|
+
# Square gift card) or record a payment that the seller received outside of
|
89
|
+
# Square
|
90
|
+
# (cash payment from a buyer or a payment that an external entity
|
91
|
+
# procesed on behalf of the seller).
|
92
|
+
# The endpoint creates a
|
93
|
+
# `Payment` object and returns it in the response.
|
96
94
|
# @param [CreatePaymentRequest] body Required parameter: An object
|
97
95
|
# containing the fields to POST for the request. See the corresponding
|
98
96
|
# object definition for field details.
|
@@ -209,11 +207,53 @@ module Square
|
|
209
207
|
)
|
210
208
|
end
|
211
209
|
|
212
|
-
#
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
210
|
+
# Updates a payment with the APPROVED status.
|
211
|
+
# You can update the `amount_money` and `tip_money` using this endpoint.
|
212
|
+
# @param [String] payment_id Required parameter: The ID of the payment to
|
213
|
+
# update.
|
214
|
+
# @param [UpdatePaymentRequest] body Required parameter: An object
|
215
|
+
# containing the fields to POST for the request. See the corresponding
|
216
|
+
# object definition for field details.
|
217
|
+
# @return [UpdatePaymentResponse Hash] response from the API call
|
218
|
+
def update_payment(payment_id:,
|
219
|
+
body:)
|
220
|
+
# Prepare query url.
|
221
|
+
_query_builder = config.get_base_uri
|
222
|
+
_query_builder << '/v2/payments/{payment_id}'
|
223
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
224
|
+
_query_builder,
|
225
|
+
'payment_id' => { 'value' => payment_id, 'encode' => true }
|
226
|
+
)
|
227
|
+
_query_url = APIHelper.clean_url _query_builder
|
228
|
+
|
229
|
+
# Prepare headers.
|
230
|
+
_headers = {
|
231
|
+
'accept' => 'application/json',
|
232
|
+
'content-type' => 'application/json; charset=utf-8'
|
233
|
+
}
|
234
|
+
|
235
|
+
# Prepare and execute HttpRequest.
|
236
|
+
_request = config.http_client.put(
|
237
|
+
_query_url,
|
238
|
+
headers: _headers,
|
239
|
+
parameters: body.to_json
|
240
|
+
)
|
241
|
+
OAuth2.apply(config, _request)
|
242
|
+
_response = execute_request(_request)
|
243
|
+
|
244
|
+
# Return appropriate response type.
|
245
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
246
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
247
|
+
ApiResponse.new(
|
248
|
+
_response, data: decoded, errors: _errors
|
249
|
+
)
|
250
|
+
end
|
251
|
+
|
252
|
+
# Cancels (voids) a payment. You can use this endpoint to cancel a payment
|
253
|
+
# with
|
254
|
+
# the APPROVED `status`.
|
255
|
+
# @param [String] payment_id Required parameter: The ID of the payment to
|
256
|
+
# cancel.
|
217
257
|
# @return [CancelPaymentResponse Hash] response from the API call
|
218
258
|
def cancel_payment(payment_id:)
|
219
259
|
# Prepare query url.
|
@@ -249,9 +289,8 @@ module Square
|
|
249
289
|
# Completes (captures) a payment.
|
250
290
|
# By default, payments are set to complete immediately after they are
|
251
291
|
# created.
|
252
|
-
#
|
253
|
-
#
|
254
|
-
# the payment using this endpoint.
|
292
|
+
# You can use this endpoint to complete a payment with the APPROVED
|
293
|
+
# `status`.
|
255
294
|
# @param [String] payment_id Required parameter: The unique ID identifying
|
256
295
|
# the payment to be completed.
|
257
296
|
# @return [CompletePaymentResponse Hash] response from the API call
|
@@ -83,7 +83,12 @@ module Square
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Refunds a payment. You can refund the entire payment amount or a
|
86
|
-
# portion of it.
|
86
|
+
# portion of it. You can use this endpoint to refund a card payment or
|
87
|
+
# record a
|
88
|
+
# refund of a cash or external payment. For more information, see
|
89
|
+
# [Refund
|
90
|
+
# Payment](https://developer.squareup.com/docs/payments-api/refund-payments)
|
91
|
+
# .
|
87
92
|
# @param [RefundPaymentRequest] body Required parameter: An object
|
88
93
|
# containing the fields to POST for the request. See the corresponding
|
89
94
|
# object definition for field details.
|
@@ -5,8 +5,9 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a
|
9
|
-
#
|
8
|
+
# Creates a Terminal checkout request and sends it to the specified device
|
9
|
+
# to take a payment
|
10
|
+
# for the requested amount.
|
10
11
|
# @param [CreateTerminalCheckoutRequest] body Required parameter: An object
|
11
12
|
# containing the fields to POST for the request. See the corresponding
|
12
13
|
# object definition for field details.
|
@@ -75,9 +76,9 @@ module Square
|
|
75
76
|
)
|
76
77
|
end
|
77
78
|
|
78
|
-
# Retrieves a Terminal checkout request by checkout_id
|
79
|
-
# @param [String] checkout_id Required parameter:
|
80
|
-
# `TerminalCheckout
|
79
|
+
# Retrieves a Terminal checkout request by `checkout_id`.
|
80
|
+
# @param [String] checkout_id Required parameter: The unique ID for the
|
81
|
+
# desired `TerminalCheckout`.
|
81
82
|
# @return [GetTerminalCheckoutResponse Hash] response from the API call
|
82
83
|
def get_terminal_checkout(checkout_id:)
|
83
84
|
# Prepare query url.
|
@@ -112,8 +113,8 @@ module Square
|
|
112
113
|
|
113
114
|
# Cancels a Terminal checkout request if the status of the request permits
|
114
115
|
# it.
|
115
|
-
# @param [String] checkout_id Required parameter:
|
116
|
-
# `TerminalCheckout
|
116
|
+
# @param [String] checkout_id Required parameter: The unique ID for the
|
117
|
+
# desired `TerminalCheckout`.
|
117
118
|
# @return [CancelTerminalCheckoutResponse Hash] response from the API call
|
118
119
|
def cancel_terminal_checkout(checkout_id:)
|
119
120
|
# Prepare query url.
|
@@ -181,7 +182,7 @@ module Square
|
|
181
182
|
)
|
182
183
|
end
|
183
184
|
|
184
|
-
# Retrieves a filtered list of Terminal
|
185
|
+
# Retrieves a filtered list of Interac Terminal refund requests created by
|
185
186
|
# the seller making the request.
|
186
187
|
# @param [SearchTerminalRefundsRequest] body Required parameter: An object
|
187
188
|
# containing the fields to POST for the request. See the corresponding
|
@@ -216,9 +217,9 @@ module Square
|
|
216
217
|
)
|
217
218
|
end
|
218
219
|
|
219
|
-
# Retrieves an Interac
|
220
|
-
# @param [String] terminal_refund_id Required parameter:
|
221
|
-
# desired `TerminalRefund
|
220
|
+
# Retrieves an Interac Terminal refund object by ID.
|
221
|
+
# @param [String] terminal_refund_id Required parameter: The unique ID for
|
222
|
+
# the desired `TerminalRefund`.
|
222
223
|
# @return [GetTerminalRefundResponse Hash] response from the API call
|
223
224
|
def get_terminal_refund(terminal_refund_id:)
|
224
225
|
# Prepare query url.
|
@@ -251,10 +252,10 @@ module Square
|
|
251
252
|
)
|
252
253
|
end
|
253
254
|
|
254
|
-
# Cancels an Interac
|
255
|
+
# Cancels an Interac Terminal refund request by refund request ID if the
|
255
256
|
# status of the request permits it.
|
256
|
-
# @param [String] terminal_refund_id Required parameter:
|
257
|
-
# desired `TerminalRefund
|
257
|
+
# @param [String] terminal_refund_id Required parameter: The unique ID for
|
258
|
+
# the desired `TerminalRefund`.
|
258
259
|
# @return [CancelTerminalRefundResponse Hash] response from the API call
|
259
260
|
def cancel_terminal_refund(terminal_refund_id:)
|
260
261
|
# Prepare query url.
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'9.
|
7
|
+
'9.1.0.20210317'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -188,7 +188,7 @@ module Square
|
|
188
188
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
189
189
|
backoff_factor: 1, environment: 'production',
|
190
190
|
custom_url: 'https://connect.squareup.com',
|
191
|
-
square_version: '2021-
|
191
|
+
square_version: '2021-03-17', access_token: 'TODO: Replace',
|
192
192
|
additional_headers: {}, config: nil)
|
193
193
|
@config = if config.nil?
|
194
194
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
data/lib/square/configuration.rb
CHANGED
@@ -24,7 +24,7 @@ module Square
|
|
24
24
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
25
25
|
backoff_factor: 1, environment: 'production',
|
26
26
|
custom_url: 'https://connect.squareup.com',
|
27
|
-
square_version: '2021-
|
27
|
+
square_version: '2021-03-17', access_token: 'TODO: Replace',
|
28
28
|
additional_headers: {})
|
29
29
|
# The value to use for connection timeout
|
30
30
|
@timeout = timeout
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.1.0.20210317
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square Developer Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|