square_connect 2.0.0 → 2.0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +151 -9
- data/Rakefile +8 -0
- data/docs/Address.md +26 -0
- data/docs/CaptureTransactionRequest.md +11 -0
- data/docs/CaptureTransactionResponse.md +12 -0
- data/docs/Card.md +18 -0
- data/docs/CardBrand.md +20 -0
- data/docs/ChargeRequest.md +22 -0
- data/docs/ChargeResponse.md +13 -0
- data/docs/Checkout.md +20 -0
- data/docs/CheckoutApi.md +62 -0
- data/docs/Country.md +261 -0
- data/docs/CreateCheckoutRequest.md +18 -0
- data/docs/CreateCheckoutResponse.md +13 -0
- data/docs/CreateCustomerCardRequest.md +14 -0
- data/docs/CreateCustomerCardResponse.md +13 -0
- data/docs/CreateCustomerRequest.md +20 -0
- data/docs/CreateCustomerResponse.md +13 -0
- data/docs/CreateOrderRequest.md +13 -0
- data/docs/CreateOrderRequestLineItem.md +14 -0
- data/docs/CreateOrderRequestOrder.md +13 -0
- data/docs/CreateRefundRequest.md +15 -0
- data/docs/CreateRefundResponse.md +13 -0
- data/docs/Currency.md +191 -0
- data/docs/Customer.md +26 -0
- data/docs/CustomerApi.md +267 -0
- data/docs/CustomerCardApi.md +116 -0
- data/docs/CustomerGroupInfo.md +13 -0
- data/docs/CustomerPreferences.md +12 -0
- data/docs/DeleteCustomerCardRequest.md +11 -0
- data/docs/DeleteCustomerCardResponse.md +12 -0
- data/docs/DeleteCustomerRequest.md +11 -0
- data/docs/DeleteCustomerResponse.md +12 -0
- data/docs/Error.md +15 -0
- data/docs/ErrorCategory.md +17 -0
- data/docs/ErrorCode.md +83 -0
- data/docs/ListCustomersRequest.md +12 -0
- data/docs/ListCustomersResponse.md +14 -0
- data/docs/ListLocationsRequest.md +11 -0
- data/docs/ListLocationsResponse.md +13 -0
- data/docs/ListRefundsRequest.md +15 -0
- data/docs/ListRefundsResponse.md +14 -0
- data/docs/ListTransactionsRequest.md +15 -0
- data/docs/ListTransactionsResponse.md +14 -0
- data/docs/Location.md +16 -0
- data/docs/LocationApi.md +56 -0
- data/docs/LocationCapability.md +12 -0
- data/docs/Money.md +13 -0
- data/docs/Order.md +16 -0
- data/docs/OrderLineItem.md +16 -0
- data/docs/Refund.md +20 -0
- data/docs/RefundApi.md +126 -0
- data/docs/RefundStatus.md +15 -0
- data/docs/RetrieveCustomerRequest.md +11 -0
- data/docs/RetrieveCustomerResponse.md +13 -0
- data/docs/RetrieveTransactionRequest.md +11 -0
- data/docs/RetrieveTransactionResponse.md +13 -0
- data/docs/SortOrder.md +13 -0
- data/docs/Tender.md +22 -0
- data/docs/TenderCardDetails.md +14 -0
- data/docs/TenderCardDetailsEntryMethod.md +16 -0
- data/docs/TenderCardDetailsStatus.md +15 -0
- data/docs/TenderCashDetails.md +13 -0
- data/docs/TenderType.md +17 -0
- data/docs/Transaction.md +21 -0
- data/docs/TransactionApi.md +285 -0
- data/docs/TransactionProduct.md +19 -0
- data/docs/UpdateCustomerRequest.md +20 -0
- data/docs/UpdateCustomerResponse.md +13 -0
- data/docs/VoidTransactionRequest.md +11 -0
- data/docs/VoidTransactionResponse.md +12 -0
- data/lib/square_connect.rb +33 -16
- data/lib/square_connect/api/checkout_api.rb +82 -0
- data/lib/square_connect/api/customer_api.rb +121 -162
- data/lib/square_connect/api/customer_card_api.rb +31 -50
- data/lib/square_connect/api/location_api.rb +12 -20
- data/lib/square_connect/api/refund_api.rb +70 -90
- data/lib/square_connect/api/transaction_api.rb +119 -165
- data/lib/square_connect/api_client.rb +64 -17
- data/lib/square_connect/api_error.rb +7 -3
- data/lib/square_connect/configuration.rb +31 -1
- data/lib/square_connect/models/address.rb +149 -78
- data/lib/square_connect/models/capture_transaction_request.rb +176 -0
- data/lib/square_connect/models/capture_transaction_response.rb +54 -26
- data/lib/square_connect/models/card.rb +98 -52
- data/lib/square_connect/models/card_brand.rb +12 -133
- data/lib/square_connect/models/charge_request.rb +106 -67
- data/lib/square_connect/models/charge_response.rb +57 -30
- data/lib/square_connect/models/checkout.rb +266 -0
- data/lib/square_connect/models/country.rb +253 -133
- data/lib/square_connect/models/create_checkout_request.rb +316 -0
- data/lib/square_connect/models/create_checkout_response.rb +198 -0
- data/lib/square_connect/models/create_customer_card_request.rb +66 -35
- data/lib/square_connect/models/create_customer_card_response.rb +58 -31
- data/lib/square_connect/models/create_customer_request.rb +79 -59
- data/lib/square_connect/models/create_customer_response.rb +58 -31
- data/lib/square_connect/models/create_order_request.rb +234 -0
- data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
- data/lib/square_connect/models/create_order_request_order.rb +219 -0
- data/lib/square_connect/models/create_refund_request.rb +79 -39
- data/lib/square_connect/models/create_refund_response.rb +57 -30
- data/lib/square_connect/models/currency.rb +183 -133
- data/lib/square_connect/models/customer.rb +130 -77
- data/lib/square_connect/models/customer_group_info.rb +206 -0
- data/lib/square_connect/models/customer_preferences.rb +186 -0
- data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
- data/lib/square_connect/models/delete_customer_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_response.rb +55 -27
- data/lib/square_connect/models/error.rb +107 -45
- data/lib/square_connect/models/error_category.rb +9 -133
- data/lib/square_connect/models/error_code.rb +75 -133
- data/lib/square_connect/models/list_customers_request.rb +55 -27
- data/lib/square_connect/models/list_customers_response.rb +61 -35
- data/lib/square_connect/models/list_locations_request.rb +176 -0
- data/lib/square_connect/models/list_locations_response.rb +57 -30
- data/lib/square_connect/models/list_refunds_request.rb +91 -42
- data/lib/square_connect/models/list_refunds_response.rb +59 -33
- data/lib/square_connect/models/list_transactions_request.rb +91 -42
- data/lib/square_connect/models/list_transactions_response.rb +59 -33
- data/lib/square_connect/models/location.rb +86 -41
- data/lib/square_connect/models/location_capability.rb +4 -133
- data/lib/square_connect/models/money.rb +85 -34
- data/lib/square_connect/models/order.rb +228 -0
- data/lib/square_connect/models/order_line_item.rb +226 -0
- data/lib/square_connect/models/refund.rb +138 -59
- data/lib/square_connect/models/refund_status.rb +7 -133
- data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
- data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
- data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
- data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
- data/lib/square_connect/models/sort_order.rb +5 -133
- data/lib/square_connect/models/tender.rb +112 -65
- data/lib/square_connect/models/tender_card_details.rb +93 -40
- data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
- data/lib/square_connect/models/tender_card_details_status.rb +7 -133
- data/lib/square_connect/models/tender_cash_details.rb +58 -31
- data/lib/square_connect/models/tender_type.rb +9 -133
- data/lib/square_connect/models/transaction.rb +132 -56
- data/lib/square_connect/models/transaction_product.rb +11 -133
- data/lib/square_connect/models/update_customer_request.rb +79 -59
- data/lib/square_connect/models/update_customer_response.rb +58 -31
- data/lib/square_connect/models/void_transaction_request.rb +176 -0
- data/lib/square_connect/models/void_transaction_response.rb +54 -26
- data/lib/square_connect/version.rb +2 -3
- data/spec/api/checkout_api_spec.rb +53 -0
- data/spec/api/customer_api_spec.rb +121 -0
- data/spec/api/customer_card_api_spec.rb +71 -0
- data/spec/api/location_api_spec.rb +58 -0
- data/spec/api/refund_api_spec.rb +75 -0
- data/spec/api/transaction_api_spec.rb +128 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +186 -0
- data/spec/models/capture_transaction_request_spec.rb +36 -0
- data/spec/models/capture_transaction_response_spec.rb +46 -0
- data/spec/models/card_brand_spec.rb +36 -0
- data/spec/models/card_spec.rb +106 -0
- data/spec/models/charge_request_spec.rb +146 -0
- data/spec/models/charge_response_spec.rb +56 -0
- data/spec/models/checkout_spec.rb +126 -0
- data/spec/models/country_spec.rb +36 -0
- data/spec/models/create_checkout_request_spec.rb +106 -0
- data/spec/models/create_checkout_response_spec.rb +56 -0
- data/spec/models/create_customer_card_request_spec.rb +66 -0
- data/spec/models/create_customer_card_response_spec.rb +56 -0
- data/spec/models/create_customer_request_spec.rb +126 -0
- data/spec/models/create_customer_response_spec.rb +56 -0
- data/spec/models/create_order_request_line_item_spec.rb +66 -0
- data/spec/models/create_order_request_order_spec.rb +56 -0
- data/spec/models/create_order_request_spec.rb +56 -0
- data/spec/models/create_refund_request_spec.rb +76 -0
- data/spec/models/create_refund_response_spec.rb +56 -0
- data/spec/models/currency_spec.rb +36 -0
- data/spec/models/customer_group_info_spec.rb +56 -0
- data/spec/models/customer_preferences_spec.rb +46 -0
- data/spec/models/customer_spec.rb +186 -0
- data/spec/models/delete_customer_card_request_spec.rb +36 -0
- data/spec/models/delete_customer_card_response_spec.rb +46 -0
- data/spec/models/delete_customer_request_spec.rb +36 -0
- data/spec/models/delete_customer_response_spec.rb +46 -0
- data/spec/models/error_category_spec.rb +36 -0
- data/spec/models/error_code_spec.rb +36 -0
- data/spec/models/error_spec.rb +76 -0
- data/spec/models/list_customers_request_spec.rb +46 -0
- data/spec/models/list_customers_response_spec.rb +66 -0
- data/spec/models/list_locations_request_spec.rb +36 -0
- data/spec/models/list_locations_response_spec.rb +56 -0
- data/spec/models/list_refunds_request_spec.rb +76 -0
- data/spec/models/list_refunds_response_spec.rb +66 -0
- data/spec/models/list_transactions_request_spec.rb +76 -0
- data/spec/models/list_transactions_response_spec.rb +66 -0
- data/spec/models/location_capability_spec.rb +36 -0
- data/spec/models/location_spec.rb +86 -0
- data/spec/models/money_spec.rb +56 -0
- data/spec/models/order_line_item_spec.rb +86 -0
- data/spec/models/order_spec.rb +86 -0
- data/spec/models/refund_spec.rb +126 -0
- data/spec/models/refund_status_spec.rb +36 -0
- data/spec/models/retrieve_customer_request_spec.rb +36 -0
- data/spec/models/retrieve_customer_response_spec.rb +56 -0
- data/spec/models/retrieve_transaction_request_spec.rb +36 -0
- data/spec/models/retrieve_transaction_response_spec.rb +56 -0
- data/spec/models/sort_order_spec.rb +36 -0
- data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
- data/spec/models/tender_card_details_spec.rb +66 -0
- data/spec/models/tender_card_details_status_spec.rb +36 -0
- data/spec/models/tender_cash_details_spec.rb +56 -0
- data/spec/models/tender_spec.rb +146 -0
- data/spec/models/tender_type_spec.rb +36 -0
- data/spec/models/transaction_product_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +136 -0
- data/spec/models/update_customer_request_spec.rb +126 -0
- data/spec/models/update_customer_response_spec.rb +56 -0
- data/spec/models/void_transaction_request_spec.rb +36 -0
- data/spec/models/void_transaction_response_spec.rb +46 -0
- data/spec/spec_helper.rb +115 -0
- data/square_connect.gemspec +22 -11
- data/travis-ci/accounts.enc +0 -0
- metadata +264 -31
@@ -1,11 +1,10 @@
|
|
1
1
|
=begin
|
2
|
-
Square Connect API
|
2
|
+
#Square Connect API
|
3
3
|
|
4
4
|
OpenAPI spec version: 2.0
|
5
5
|
|
6
6
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
7
|
|
8
|
-
|
9
8
|
=end
|
10
9
|
|
11
10
|
require "uri"
|
@@ -18,66 +17,47 @@ module SquareConnect
|
|
18
17
|
@api_client = api_client
|
19
18
|
end
|
20
19
|
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# @param authorization The value to provide in the Authorization header of
|
24
|
-
# @param location_id
|
20
|
+
# CaptureTransaction
|
21
|
+
# Captures a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/articles/delayed-capture-transactions/) for more information.
|
22
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
23
|
+
# @param location_id
|
24
|
+
# @param transaction_id
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
|
-
# @
|
27
|
-
|
28
|
-
|
29
|
-
# @option opts [String] :cursor A pagination cursor to retrieve the next set of results for your\noriginal query to the endpoint.
|
30
|
-
# @return [ListTransactionsResponse]
|
31
|
-
def list_transactions(authorization, location_id, opts = {})
|
32
|
-
data, status_code, headers = list_transactions_with_http_info(authorization, location_id, opts)
|
26
|
+
# @return [CaptureTransactionResponse]
|
27
|
+
def capture_transaction(authorization, location_id, transaction_id, opts = {})
|
28
|
+
data, _status_code, _headers = capture_transaction_with_http_info(authorization, location_id, transaction_id, opts)
|
33
29
|
return data
|
34
30
|
end
|
35
31
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# @param authorization The value to provide in the Authorization header of
|
39
|
-
# @param location_id
|
32
|
+
# CaptureTransaction
|
33
|
+
# Captures a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/articles/delayed-capture-transactions/) for more information.
|
34
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
35
|
+
# @param location_id
|
36
|
+
# @param transaction_id
|
40
37
|
# @param [Hash] opts the optional parameters
|
41
|
-
# @
|
42
|
-
|
43
|
-
# @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for\nchronological, `DESC` for reverse-chronological).
|
44
|
-
# @option opts [String] :cursor A pagination cursor to retrieve the next set of results for your\noriginal query to the endpoint.
|
45
|
-
# @return [Array<(ListTransactionsResponse, Fixnum, Hash)>] ListTransactionsResponse data, response status code and response headers
|
46
|
-
def list_transactions_with_http_info(authorization, location_id, opts = {})
|
38
|
+
# @return [Array<(CaptureTransactionResponse, Fixnum, Hash)>] CaptureTransactionResponse data, response status code and response headers
|
39
|
+
def capture_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
|
47
40
|
if @api_client.config.debugging
|
48
|
-
@api_client.config.logger.debug "Calling API: TransactionApi
|
41
|
+
@api_client.config.logger.debug "Calling API: TransactionApi.capture_transaction ..."
|
49
42
|
end
|
50
|
-
|
51
43
|
# verify the required parameter 'authorization' is set
|
52
|
-
fail "Missing the required parameter 'authorization' when calling
|
53
|
-
|
44
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling TransactionApi.capture_transaction" if authorization.nil?
|
54
45
|
# verify the required parameter 'location_id' is set
|
55
|
-
fail "Missing the required parameter 'location_id' when calling
|
56
|
-
|
57
|
-
|
58
|
-
fail 'invalid value for "sort_order", must be one of DESC, ASC'
|
59
|
-
end
|
60
|
-
|
46
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling TransactionApi.capture_transaction" if location_id.nil?
|
47
|
+
# verify the required parameter 'transaction_id' is set
|
48
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionApi.capture_transaction" if transaction_id.nil?
|
61
49
|
# resource path
|
62
|
-
|
50
|
+
local_var_path = "/v2/locations/{location_id}/transactions/{transaction_id}/capture".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
|
63
51
|
|
64
52
|
# query parameters
|
65
53
|
query_params = {}
|
66
|
-
query_params[:'begin_time'] = opts[:'begin_time'] if opts[:'begin_time']
|
67
|
-
query_params[:'end_time'] = opts[:'end_time'] if opts[:'end_time']
|
68
|
-
query_params[:'sort_order'] = opts[:'sort_order'] if opts[:'sort_order']
|
69
|
-
query_params[:'cursor'] = opts[:'cursor'] if opts[:'cursor']
|
70
54
|
|
71
55
|
# header parameters
|
72
56
|
header_params = {}
|
73
|
-
|
74
57
|
# HTTP header 'Accept' (if needed)
|
75
|
-
|
76
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
77
|
-
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
78
59
|
# HTTP header 'Content-Type'
|
79
|
-
|
80
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
81
61
|
header_params[:'Authorization'] = authorization
|
82
62
|
|
83
63
|
# form parameters
|
@@ -85,70 +65,61 @@ module SquareConnect
|
|
85
65
|
|
86
66
|
# http body (model)
|
87
67
|
post_body = nil
|
88
|
-
|
89
68
|
auth_names = []
|
90
|
-
data, status_code, headers = @api_client.call_api(:
|
69
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
91
70
|
:header_params => header_params,
|
92
71
|
:query_params => query_params,
|
93
72
|
:form_params => form_params,
|
94
73
|
:body => post_body,
|
95
74
|
:auth_names => auth_names,
|
96
|
-
:return_type => '
|
75
|
+
:return_type => 'CaptureTransactionResponse')
|
97
76
|
if @api_client.config.debugging
|
98
|
-
@api_client.config.logger.debug "API called: TransactionApi#
|
77
|
+
@api_client.config.logger.debug "API called: TransactionApi#capture_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
99
78
|
end
|
100
79
|
return data, status_code, headers
|
101
80
|
end
|
102
81
|
|
103
82
|
# Charge
|
104
|
-
# Charges a card represented by a
|
105
|
-
# @param authorization The value to provide in the Authorization header of
|
106
|
-
# @param location_id The ID of the location to associate the transaction with.
|
107
|
-
# @param body An object containing the fields to POST for the request
|
83
|
+
# Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an e-commerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction.
|
84
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
85
|
+
# @param location_id The ID of the location to associate the created transaction with.
|
86
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
108
87
|
# @param [Hash] opts the optional parameters
|
109
88
|
# @return [ChargeResponse]
|
110
89
|
def charge(authorization, location_id, body, opts = {})
|
111
|
-
data,
|
90
|
+
data, _status_code, _headers = charge_with_http_info(authorization, location_id, body, opts)
|
112
91
|
return data
|
113
92
|
end
|
114
93
|
|
115
94
|
# Charge
|
116
|
-
# Charges a card represented by a
|
117
|
-
# @param authorization The value to provide in the Authorization header of
|
118
|
-
# @param location_id The ID of the location to associate the transaction with.
|
119
|
-
# @param body An object containing the fields to POST for the request
|
95
|
+
# Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an e-commerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction.
|
96
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
97
|
+
# @param location_id The ID of the location to associate the created transaction with.
|
98
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
120
99
|
# @param [Hash] opts the optional parameters
|
121
100
|
# @return [Array<(ChargeResponse, Fixnum, Hash)>] ChargeResponse data, response status code and response headers
|
122
101
|
def charge_with_http_info(authorization, location_id, body, opts = {})
|
123
102
|
if @api_client.config.debugging
|
124
|
-
@api_client.config.logger.debug "Calling API: TransactionApi
|
103
|
+
@api_client.config.logger.debug "Calling API: TransactionApi.charge ..."
|
125
104
|
end
|
126
|
-
|
127
105
|
# verify the required parameter 'authorization' is set
|
128
|
-
fail "Missing the required parameter 'authorization' when calling charge" if authorization.nil?
|
129
|
-
|
106
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling TransactionApi.charge" if authorization.nil?
|
130
107
|
# verify the required parameter 'location_id' is set
|
131
|
-
fail "Missing the required parameter 'location_id' when calling charge" if location_id.nil?
|
132
|
-
|
108
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling TransactionApi.charge" if location_id.nil?
|
133
109
|
# verify the required parameter 'body' is set
|
134
|
-
fail "Missing the required parameter 'body' when calling charge" if body.nil?
|
135
|
-
|
110
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling TransactionApi.charge" if body.nil?
|
136
111
|
# resource path
|
137
|
-
|
112
|
+
local_var_path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
|
138
113
|
|
139
114
|
# query parameters
|
140
115
|
query_params = {}
|
141
116
|
|
142
117
|
# header parameters
|
143
118
|
header_params = {}
|
144
|
-
|
145
119
|
# HTTP header 'Accept' (if needed)
|
146
|
-
|
147
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
148
|
-
|
120
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
149
121
|
# HTTP header 'Content-Type'
|
150
|
-
|
151
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
122
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
152
123
|
header_params[:'Authorization'] = authorization
|
153
124
|
|
154
125
|
# form parameters
|
@@ -156,9 +127,8 @@ module SquareConnect
|
|
156
127
|
|
157
128
|
# http body (model)
|
158
129
|
post_body = @api_client.object_to_http_body(body)
|
159
|
-
|
160
130
|
auth_names = []
|
161
|
-
data, status_code, headers = @api_client.call_api(:POST,
|
131
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
162
132
|
:header_params => header_params,
|
163
133
|
:query_params => query_params,
|
164
134
|
:form_params => form_params,
|
@@ -171,55 +141,58 @@ module SquareConnect
|
|
171
141
|
return data, status_code, headers
|
172
142
|
end
|
173
143
|
|
174
|
-
#
|
175
|
-
#
|
176
|
-
# @param authorization The value to provide in the Authorization header of
|
177
|
-
# @param location_id
|
178
|
-
# @param transaction_id
|
144
|
+
# ListTransactions
|
145
|
+
# Lists transactions for a particular location. Max results per [page](#paginatingresults): 50
|
146
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
147
|
+
# @param location_id The ID of the location to list transactions for.
|
179
148
|
# @param [Hash] opts the optional parameters
|
180
|
-
# @
|
181
|
-
|
182
|
-
|
149
|
+
# @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
|
150
|
+
# @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
|
151
|
+
# @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
|
152
|
+
# @option opts [String] :cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.
|
153
|
+
# @return [ListTransactionsResponse]
|
154
|
+
def list_transactions(authorization, location_id, opts = {})
|
155
|
+
data, _status_code, _headers = list_transactions_with_http_info(authorization, location_id, opts)
|
183
156
|
return data
|
184
157
|
end
|
185
158
|
|
186
|
-
#
|
187
|
-
#
|
188
|
-
# @param authorization The value to provide in the Authorization header of
|
189
|
-
# @param location_id
|
190
|
-
# @param transaction_id
|
159
|
+
# ListTransactions
|
160
|
+
# Lists transactions for a particular location. Max results per [page](#paginatingresults): 50
|
161
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
162
|
+
# @param location_id The ID of the location to list transactions for.
|
191
163
|
# @param [Hash] opts the optional parameters
|
192
|
-
# @
|
193
|
-
|
164
|
+
# @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
|
165
|
+
# @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
|
166
|
+
# @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
|
167
|
+
# @option opts [String] :cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.
|
168
|
+
# @return [Array<(ListTransactionsResponse, Fixnum, Hash)>] ListTransactionsResponse data, response status code and response headers
|
169
|
+
def list_transactions_with_http_info(authorization, location_id, opts = {})
|
194
170
|
if @api_client.config.debugging
|
195
|
-
@api_client.config.logger.debug "Calling API: TransactionApi
|
171
|
+
@api_client.config.logger.debug "Calling API: TransactionApi.list_transactions ..."
|
196
172
|
end
|
197
|
-
|
198
173
|
# verify the required parameter 'authorization' is set
|
199
|
-
fail "Missing the required parameter 'authorization' when calling
|
200
|
-
|
174
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling TransactionApi.list_transactions" if authorization.nil?
|
201
175
|
# verify the required parameter 'location_id' is set
|
202
|
-
fail "Missing the required parameter 'location_id' when calling
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
176
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling TransactionApi.list_transactions" if location_id.nil?
|
177
|
+
if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])
|
178
|
+
fail ArgumentError, 'invalid value for "sort_order", must be one of DESC, ASC'
|
179
|
+
end
|
207
180
|
# resource path
|
208
|
-
|
181
|
+
local_var_path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
|
209
182
|
|
210
183
|
# query parameters
|
211
184
|
query_params = {}
|
185
|
+
query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?
|
186
|
+
query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
|
187
|
+
query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
|
188
|
+
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
|
212
189
|
|
213
190
|
# header parameters
|
214
191
|
header_params = {}
|
215
|
-
|
216
192
|
# HTTP header 'Accept' (if needed)
|
217
|
-
|
218
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
219
|
-
|
193
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
220
194
|
# HTTP header 'Content-Type'
|
221
|
-
|
222
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
195
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
223
196
|
header_params[:'Authorization'] = authorization
|
224
197
|
|
225
198
|
# form parameters
|
@@ -227,70 +200,61 @@ module SquareConnect
|
|
227
200
|
|
228
201
|
# http body (model)
|
229
202
|
post_body = nil
|
230
|
-
|
231
203
|
auth_names = []
|
232
|
-
data, status_code, headers = @api_client.call_api(:GET,
|
204
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
233
205
|
:header_params => header_params,
|
234
206
|
:query_params => query_params,
|
235
207
|
:form_params => form_params,
|
236
208
|
:body => post_body,
|
237
209
|
:auth_names => auth_names,
|
238
|
-
:return_type => '
|
210
|
+
:return_type => 'ListTransactionsResponse')
|
239
211
|
if @api_client.config.debugging
|
240
|
-
@api_client.config.logger.debug "API called: TransactionApi#
|
212
|
+
@api_client.config.logger.debug "API called: TransactionApi#list_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
241
213
|
end
|
242
214
|
return data, status_code, headers
|
243
215
|
end
|
244
216
|
|
245
|
-
#
|
246
|
-
#
|
247
|
-
# @param authorization The value to provide in the Authorization header of
|
248
|
-
# @param location_id
|
249
|
-
# @param transaction_id
|
217
|
+
# RetrieveTransaction
|
218
|
+
# Retrieves details for a single transaction.
|
219
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
220
|
+
# @param location_id The ID of the transaction's associated location.
|
221
|
+
# @param transaction_id The ID of the transaction to retrieve.
|
250
222
|
# @param [Hash] opts the optional parameters
|
251
|
-
# @return [
|
252
|
-
def
|
253
|
-
data,
|
223
|
+
# @return [RetrieveTransactionResponse]
|
224
|
+
def retrieve_transaction(authorization, location_id, transaction_id, opts = {})
|
225
|
+
data, _status_code, _headers = retrieve_transaction_with_http_info(authorization, location_id, transaction_id, opts)
|
254
226
|
return data
|
255
227
|
end
|
256
228
|
|
257
|
-
#
|
258
|
-
#
|
259
|
-
# @param authorization The value to provide in the Authorization header of
|
260
|
-
# @param location_id
|
261
|
-
# @param transaction_id
|
229
|
+
# RetrieveTransaction
|
230
|
+
# Retrieves details for a single transaction.
|
231
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
232
|
+
# @param location_id The ID of the transaction's associated location.
|
233
|
+
# @param transaction_id The ID of the transaction to retrieve.
|
262
234
|
# @param [Hash] opts the optional parameters
|
263
|
-
# @return [Array<(
|
264
|
-
def
|
235
|
+
# @return [Array<(RetrieveTransactionResponse, Fixnum, Hash)>] RetrieveTransactionResponse data, response status code and response headers
|
236
|
+
def retrieve_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
|
265
237
|
if @api_client.config.debugging
|
266
|
-
@api_client.config.logger.debug "Calling API: TransactionApi
|
238
|
+
@api_client.config.logger.debug "Calling API: TransactionApi.retrieve_transaction ..."
|
267
239
|
end
|
268
|
-
|
269
240
|
# verify the required parameter 'authorization' is set
|
270
|
-
fail "Missing the required parameter 'authorization' when calling
|
271
|
-
|
241
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling TransactionApi.retrieve_transaction" if authorization.nil?
|
272
242
|
# verify the required parameter 'location_id' is set
|
273
|
-
fail "Missing the required parameter 'location_id' when calling
|
274
|
-
|
243
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling TransactionApi.retrieve_transaction" if location_id.nil?
|
275
244
|
# verify the required parameter 'transaction_id' is set
|
276
|
-
fail "Missing the required parameter 'transaction_id' when calling
|
277
|
-
|
245
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionApi.retrieve_transaction" if transaction_id.nil?
|
278
246
|
# resource path
|
279
|
-
|
247
|
+
local_var_path = "/v2/locations/{location_id}/transactions/{transaction_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
|
280
248
|
|
281
249
|
# query parameters
|
282
250
|
query_params = {}
|
283
251
|
|
284
252
|
# header parameters
|
285
253
|
header_params = {}
|
286
|
-
|
287
254
|
# HTTP header 'Accept' (if needed)
|
288
|
-
|
289
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
290
|
-
|
255
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
291
256
|
# HTTP header 'Content-Type'
|
292
|
-
|
293
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
257
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
294
258
|
header_params[:'Authorization'] = authorization
|
295
259
|
|
296
260
|
# form parameters
|
@@ -298,70 +262,61 @@ module SquareConnect
|
|
298
262
|
|
299
263
|
# http body (model)
|
300
264
|
post_body = nil
|
301
|
-
|
302
265
|
auth_names = []
|
303
|
-
data, status_code, headers = @api_client.call_api(:
|
266
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
304
267
|
:header_params => header_params,
|
305
268
|
:query_params => query_params,
|
306
269
|
:form_params => form_params,
|
307
270
|
:body => post_body,
|
308
271
|
:auth_names => auth_names,
|
309
|
-
:return_type => '
|
272
|
+
:return_type => 'RetrieveTransactionResponse')
|
310
273
|
if @api_client.config.debugging
|
311
|
-
@api_client.config.logger.debug "API called: TransactionApi#
|
274
|
+
@api_client.config.logger.debug "API called: TransactionApi#retrieve_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
312
275
|
end
|
313
276
|
return data, status_code, headers
|
314
277
|
end
|
315
278
|
|
316
279
|
# VoidTransaction
|
317
|
-
# Cancels a transaction that was created with the
|
318
|
-
# @param authorization The value to provide in the Authorization header of
|
280
|
+
# Cancels a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/articles/delayed-capture-transactions/) for more information.
|
281
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
319
282
|
# @param location_id
|
320
283
|
# @param transaction_id
|
321
284
|
# @param [Hash] opts the optional parameters
|
322
285
|
# @return [VoidTransactionResponse]
|
323
286
|
def void_transaction(authorization, location_id, transaction_id, opts = {})
|
324
|
-
data,
|
287
|
+
data, _status_code, _headers = void_transaction_with_http_info(authorization, location_id, transaction_id, opts)
|
325
288
|
return data
|
326
289
|
end
|
327
290
|
|
328
291
|
# VoidTransaction
|
329
|
-
# Cancels a transaction that was created with the
|
330
|
-
# @param authorization The value to provide in the Authorization header of
|
292
|
+
# Cancels a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/articles/delayed-capture-transactions/) for more information.
|
293
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
331
294
|
# @param location_id
|
332
295
|
# @param transaction_id
|
333
296
|
# @param [Hash] opts the optional parameters
|
334
297
|
# @return [Array<(VoidTransactionResponse, Fixnum, Hash)>] VoidTransactionResponse data, response status code and response headers
|
335
298
|
def void_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
|
336
299
|
if @api_client.config.debugging
|
337
|
-
@api_client.config.logger.debug "Calling API: TransactionApi
|
300
|
+
@api_client.config.logger.debug "Calling API: TransactionApi.void_transaction ..."
|
338
301
|
end
|
339
|
-
|
340
302
|
# verify the required parameter 'authorization' is set
|
341
|
-
fail "Missing the required parameter 'authorization' when calling void_transaction" if authorization.nil?
|
342
|
-
|
303
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling TransactionApi.void_transaction" if authorization.nil?
|
343
304
|
# verify the required parameter 'location_id' is set
|
344
|
-
fail "Missing the required parameter 'location_id' when calling void_transaction" if location_id.nil?
|
345
|
-
|
305
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling TransactionApi.void_transaction" if location_id.nil?
|
346
306
|
# verify the required parameter 'transaction_id' is set
|
347
|
-
fail "Missing the required parameter 'transaction_id' when calling void_transaction" if transaction_id.nil?
|
348
|
-
|
307
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionApi.void_transaction" if transaction_id.nil?
|
349
308
|
# resource path
|
350
|
-
|
309
|
+
local_var_path = "/v2/locations/{location_id}/transactions/{transaction_id}/void".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
|
351
310
|
|
352
311
|
# query parameters
|
353
312
|
query_params = {}
|
354
313
|
|
355
314
|
# header parameters
|
356
315
|
header_params = {}
|
357
|
-
|
358
316
|
# HTTP header 'Accept' (if needed)
|
359
|
-
|
360
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
361
|
-
|
317
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
362
318
|
# HTTP header 'Content-Type'
|
363
|
-
|
364
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
319
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
365
320
|
header_params[:'Authorization'] = authorization
|
366
321
|
|
367
322
|
# form parameters
|
@@ -369,9 +324,8 @@ module SquareConnect
|
|
369
324
|
|
370
325
|
# http body (model)
|
371
326
|
post_body = nil
|
372
|
-
|
373
327
|
auth_names = []
|
374
|
-
data, status_code, headers = @api_client.call_api(:POST,
|
328
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
375
329
|
:header_params => header_params,
|
376
330
|
:query_params => query_params,
|
377
331
|
:form_params => form_params,
|