square_connect 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +5 -0
  3. data/CONTRIBUTING.md +5 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.md +47 -0
  6. data/lib/square_connect.rb +88 -0
  7. data/lib/square_connect/api/customer_api.rb +354 -0
  8. data/lib/square_connect/api/customer_card_api.rb +163 -0
  9. data/lib/square_connect/api/location_api.rb +82 -0
  10. data/lib/square_connect/api/refund_api.rb +179 -0
  11. data/lib/square_connect/api/transaction_api.rb +387 -0
  12. data/lib/square_connect/api_client.rb +337 -0
  13. data/lib/square_connect/api_error.rb +31 -0
  14. data/lib/square_connect/configuration.rb +163 -0
  15. data/lib/square_connect/models/address.rb +288 -0
  16. data/lib/square_connect/models/capture_transaction_response.rb +160 -0
  17. data/lib/square_connect/models/card.rb +233 -0
  18. data/lib/square_connect/models/card_brand.rb +147 -0
  19. data/lib/square_connect/models/charge_request.rb +257 -0
  20. data/lib/square_connect/models/charge_response.rb +171 -0
  21. data/lib/square_connect/models/country.rb +147 -0
  22. data/lib/square_connect/models/create_customer_card_request.rb +180 -0
  23. data/lib/square_connect/models/create_customer_card_response.rb +171 -0
  24. data/lib/square_connect/models/create_customer_request.rb +246 -0
  25. data/lib/square_connect/models/create_customer_response.rb +171 -0
  26. data/lib/square_connect/models/create_refund_request.rb +191 -0
  27. data/lib/square_connect/models/create_refund_response.rb +171 -0
  28. data/lib/square_connect/models/currency.rb +147 -0
  29. data/lib/square_connect/models/customer.rb +292 -0
  30. data/lib/square_connect/models/delete_customer_card_response.rb +160 -0
  31. data/lib/square_connect/models/delete_customer_response.rb +160 -0
  32. data/lib/square_connect/models/error.rb +209 -0
  33. data/lib/square_connect/models/error_category.rb +147 -0
  34. data/lib/square_connect/models/error_code.rb +147 -0
  35. data/lib/square_connect/models/list_customers_request.rb +158 -0
  36. data/lib/square_connect/models/list_customers_response.rb +184 -0
  37. data/lib/square_connect/models/list_locations_response.rb +173 -0
  38. data/lib/square_connect/models/list_refunds_request.rb +200 -0
  39. data/lib/square_connect/models/list_refunds_response.rb +184 -0
  40. data/lib/square_connect/models/list_transactions_request.rb +200 -0
  41. data/lib/square_connect/models/list_transactions_response.rb +184 -0
  42. data/lib/square_connect/models/location.rb +204 -0
  43. data/lib/square_connect/models/location_capability.rb +147 -0
  44. data/lib/square_connect/models/money.rb +178 -0
  45. data/lib/square_connect/models/refund.rb +255 -0
  46. data/lib/square_connect/models/refund_status.rb +147 -0
  47. data/lib/square_connect/models/retrieve_customer_response.rb +171 -0
  48. data/lib/square_connect/models/retrieve_transaction_response.rb +171 -0
  49. data/lib/square_connect/models/sort_order.rb +147 -0
  50. data/lib/square_connect/models/tender.rb +277 -0
  51. data/lib/square_connect/models/tender_card_details.rb +198 -0
  52. data/lib/square_connect/models/tender_card_details_entry_method.rb +147 -0
  53. data/lib/square_connect/models/tender_card_details_status.rb +147 -0
  54. data/lib/square_connect/models/tender_cash_details.rb +169 -0
  55. data/lib/square_connect/models/tender_type.rb +147 -0
  56. data/lib/square_connect/models/transaction.rb +237 -0
  57. data/lib/square_connect/models/transaction_product.rb +147 -0
  58. data/lib/square_connect/models/update_customer_request.rb +246 -0
  59. data/lib/square_connect/models/update_customer_response.rb +171 -0
  60. data/lib/square_connect/models/void_transaction_response.rb +160 -0
  61. data/lib/square_connect/version.rb +13 -0
  62. data/square_connect.gemspec +32 -0
  63. metadata +286 -0
@@ -0,0 +1,163 @@
1
+ =begin
2
+ Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+
9
+ =end
10
+
11
+ require "uri"
12
+
13
+ module SquareConnect
14
+ class CustomerCardApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+
21
+ # CreateCustomerCard
22
+ # Adds a card on file to an existing customer.
23
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
24
+ # @param customer_id
25
+ # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [CreateCustomerCardResponse]
28
+ def create_customer_card(authorization, customer_id, body, opts = {})
29
+ data, status_code, headers = create_customer_card_with_http_info(authorization, customer_id, body, opts)
30
+ return data
31
+ end
32
+
33
+ # CreateCustomerCard
34
+ # Adds a card on file to an existing customer.
35
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
36
+ # @param customer_id
37
+ # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(CreateCustomerCardResponse, Fixnum, Hash)>] CreateCustomerCardResponse data, response status code and response headers
40
+ def create_customer_card_with_http_info(authorization, customer_id, body, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: CustomerCardApi#create_customer_card ..."
43
+ end
44
+
45
+ # verify the required parameter 'authorization' is set
46
+ fail "Missing the required parameter 'authorization' when calling create_customer_card" if authorization.nil?
47
+
48
+ # verify the required parameter 'customer_id' is set
49
+ fail "Missing the required parameter 'customer_id' when calling create_customer_card" if customer_id.nil?
50
+
51
+ # verify the required parameter 'body' is set
52
+ fail "Missing the required parameter 'body' when calling create_customer_card" if body.nil?
53
+
54
+ # resource path
55
+ path = "/v2/customers/{customer_id}/cards".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
56
+
57
+ # query parameters
58
+ query_params = {}
59
+
60
+ # header parameters
61
+ header_params = {}
62
+
63
+ # HTTP header 'Accept' (if needed)
64
+ _header_accept = ['application/json']
65
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
66
+
67
+ # HTTP header 'Content-Type'
68
+ _header_content_type = ['application/json']
69
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
70
+ header_params[:'Authorization'] = authorization
71
+
72
+ # form parameters
73
+ form_params = {}
74
+
75
+ # http body (model)
76
+ post_body = @api_client.object_to_http_body(body)
77
+
78
+ auth_names = []
79
+ data, status_code, headers = @api_client.call_api(:POST, path,
80
+ :header_params => header_params,
81
+ :query_params => query_params,
82
+ :form_params => form_params,
83
+ :body => post_body,
84
+ :auth_names => auth_names,
85
+ :return_type => 'CreateCustomerCardResponse')
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: CustomerCardApi#create_customer_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
92
+ # DeleteCustomerCard
93
+ # Removes a card on file from a customer.
94
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
95
+ # @param customer_id
96
+ # @param card_id
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [DeleteCustomerCardResponse]
99
+ def delete_customer_card(authorization, customer_id, card_id, opts = {})
100
+ data, status_code, headers = delete_customer_card_with_http_info(authorization, customer_id, card_id, opts)
101
+ return data
102
+ end
103
+
104
+ # DeleteCustomerCard
105
+ # Removes a card on file from a customer.
106
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
107
+ # @param customer_id
108
+ # @param card_id
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(DeleteCustomerCardResponse, Fixnum, Hash)>] DeleteCustomerCardResponse data, response status code and response headers
111
+ def delete_customer_card_with_http_info(authorization, customer_id, card_id, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "Calling API: CustomerCardApi#delete_customer_card ..."
114
+ end
115
+
116
+ # verify the required parameter 'authorization' is set
117
+ fail "Missing the required parameter 'authorization' when calling delete_customer_card" if authorization.nil?
118
+
119
+ # verify the required parameter 'customer_id' is set
120
+ fail "Missing the required parameter 'customer_id' when calling delete_customer_card" if customer_id.nil?
121
+
122
+ # verify the required parameter 'card_id' is set
123
+ fail "Missing the required parameter 'card_id' when calling delete_customer_card" if card_id.nil?
124
+
125
+ # resource path
126
+ path = "/v2/customers/{customer_id}/cards/{card_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'card_id' + '}', card_id.to_s)
127
+
128
+ # query parameters
129
+ query_params = {}
130
+
131
+ # header parameters
132
+ header_params = {}
133
+
134
+ # HTTP header 'Accept' (if needed)
135
+ _header_accept = ['application/json']
136
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
137
+
138
+ # HTTP header 'Content-Type'
139
+ _header_content_type = ['application/json']
140
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
141
+ header_params[:'Authorization'] = authorization
142
+
143
+ # form parameters
144
+ form_params = {}
145
+
146
+ # http body (model)
147
+ post_body = nil
148
+
149
+ auth_names = []
150
+ data, status_code, headers = @api_client.call_api(:DELETE, path,
151
+ :header_params => header_params,
152
+ :query_params => query_params,
153
+ :form_params => form_params,
154
+ :body => post_body,
155
+ :auth_names => auth_names,
156
+ :return_type => 'DeleteCustomerCardResponse')
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug "API called: CustomerCardApi#delete_customer_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
159
+ end
160
+ return data, status_code, headers
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,82 @@
1
+ =begin
2
+ Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+
9
+ =end
10
+
11
+ require "uri"
12
+
13
+ module SquareConnect
14
+ class LocationApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+
21
+ # ListLocations
22
+ # Provides summary information for all of a business&#39;s locations.
23
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [ListLocationsResponse]
26
+ def list_locations(authorization, opts = {})
27
+ data, status_code, headers = list_locations_with_http_info(authorization, opts)
28
+ return data
29
+ end
30
+
31
+ # ListLocations
32
+ # Provides summary information for all of a business&#39;s locations.
33
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(ListLocationsResponse, Fixnum, Hash)>] ListLocationsResponse data, response status code and response headers
36
+ def list_locations_with_http_info(authorization, opts = {})
37
+ if @api_client.config.debugging
38
+ @api_client.config.logger.debug "Calling API: LocationApi#list_locations ..."
39
+ end
40
+
41
+ # verify the required parameter 'authorization' is set
42
+ fail "Missing the required parameter 'authorization' when calling list_locations" if authorization.nil?
43
+
44
+ # resource path
45
+ path = "/v2/locations".sub('{format}','json')
46
+
47
+ # query parameters
48
+ query_params = {}
49
+
50
+ # header parameters
51
+ header_params = {}
52
+
53
+ # HTTP header 'Accept' (if needed)
54
+ _header_accept = ['application/json']
55
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
56
+
57
+ # HTTP header 'Content-Type'
58
+ _header_content_type = ['application/json']
59
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
60
+ header_params[:'Authorization'] = authorization
61
+
62
+ # form parameters
63
+ form_params = {}
64
+
65
+ # http body (model)
66
+ post_body = nil
67
+
68
+ auth_names = []
69
+ data, status_code, headers = @api_client.call_api(:GET, path,
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => 'ListLocationsResponse')
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: LocationApi#list_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,179 @@
1
+ =begin
2
+ Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+
9
+ =end
10
+
11
+ require "uri"
12
+
13
+ module SquareConnect
14
+ class RefundApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+
21
+ # ListRefunds
22
+ # Lists refunds for one of a business&#39;s locations.
23
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
24
+ # @param location_id The ID of the location to list refunds for.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
27
+ # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
28
+ # @option opts [String] :sort_order The order in which results are listed in the response.
29
+ # @option opts [String] :cursor A pagination cursor to retrieve the next set of results for your\noriginal query to the endpoint.
30
+ # @return [ListRefundsResponse]
31
+ def list_refunds(authorization, location_id, opts = {})
32
+ data, status_code, headers = list_refunds_with_http_info(authorization, location_id, opts)
33
+ return data
34
+ end
35
+
36
+ # ListRefunds
37
+ # Lists refunds for one of a business&#39;s locations.
38
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
39
+ # @param location_id The ID of the location to list refunds for.
40
+ # @param [Hash] opts the optional parameters
41
+ # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
42
+ # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
43
+ # @option opts [String] :sort_order The order in which results are listed in the response.
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<(ListRefundsResponse, Fixnum, Hash)>] ListRefundsResponse data, response status code and response headers
46
+ def list_refunds_with_http_info(authorization, location_id, opts = {})
47
+ if @api_client.config.debugging
48
+ @api_client.config.logger.debug "Calling API: RefundApi#list_refunds ..."
49
+ end
50
+
51
+ # verify the required parameter 'authorization' is set
52
+ fail "Missing the required parameter 'authorization' when calling list_refunds" if authorization.nil?
53
+
54
+ # verify the required parameter 'location_id' is set
55
+ fail "Missing the required parameter 'location_id' when calling list_refunds" if location_id.nil?
56
+
57
+ if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])
58
+ fail 'invalid value for "sort_order", must be one of DESC, ASC'
59
+ end
60
+
61
+ # resource path
62
+ path = "/v2/locations/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
63
+
64
+ # query parameters
65
+ 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
+
71
+ # header parameters
72
+ header_params = {}
73
+
74
+ # HTTP header 'Accept' (if needed)
75
+ _header_accept = ['application/json']
76
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
77
+
78
+ # HTTP header 'Content-Type'
79
+ _header_content_type = ['application/json']
80
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
81
+ header_params[:'Authorization'] = authorization
82
+
83
+ # form parameters
84
+ form_params = {}
85
+
86
+ # http body (model)
87
+ post_body = nil
88
+
89
+ auth_names = []
90
+ data, status_code, headers = @api_client.call_api(:GET, path,
91
+ :header_params => header_params,
92
+ :query_params => query_params,
93
+ :form_params => form_params,
94
+ :body => post_body,
95
+ :auth_names => auth_names,
96
+ :return_type => 'ListRefundsResponse')
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug "API called: RefundApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
99
+ end
100
+ return data, status_code, headers
101
+ end
102
+
103
+ # CreateRefund
104
+ # Initiates a refund for a previously charged tender.
105
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
106
+ # @param location_id The ID of the original transaction&#39;s associated location.
107
+ # @param transaction_id
108
+ # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [CreateRefundResponse]
111
+ def create_refund(authorization, location_id, transaction_id, body, opts = {})
112
+ data, status_code, headers = create_refund_with_http_info(authorization, location_id, transaction_id, body, opts)
113
+ return data
114
+ end
115
+
116
+ # CreateRefund
117
+ # Initiates a refund for a previously charged tender.
118
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
119
+ # @param location_id The ID of the original transaction&#39;s associated location.
120
+ # @param transaction_id
121
+ # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
122
+ # @param [Hash] opts the optional parameters
123
+ # @return [Array<(CreateRefundResponse, Fixnum, Hash)>] CreateRefundResponse data, response status code and response headers
124
+ def create_refund_with_http_info(authorization, location_id, transaction_id, body, opts = {})
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug "Calling API: RefundApi#create_refund ..."
127
+ end
128
+
129
+ # verify the required parameter 'authorization' is set
130
+ fail "Missing the required parameter 'authorization' when calling create_refund" if authorization.nil?
131
+
132
+ # verify the required parameter 'location_id' is set
133
+ fail "Missing the required parameter 'location_id' when calling create_refund" if location_id.nil?
134
+
135
+ # verify the required parameter 'transaction_id' is set
136
+ fail "Missing the required parameter 'transaction_id' when calling create_refund" if transaction_id.nil?
137
+
138
+ # verify the required parameter 'body' is set
139
+ fail "Missing the required parameter 'body' when calling create_refund" if body.nil?
140
+
141
+ # resource path
142
+ path = "/v2/locations/{location_id}/transactions/{transaction_id}/refund".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
143
+
144
+ # query parameters
145
+ query_params = {}
146
+
147
+ # header parameters
148
+ header_params = {}
149
+
150
+ # HTTP header 'Accept' (if needed)
151
+ _header_accept = ['application/json']
152
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
153
+
154
+ # HTTP header 'Content-Type'
155
+ _header_content_type = ['application/json']
156
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
157
+ header_params[:'Authorization'] = authorization
158
+
159
+ # form parameters
160
+ form_params = {}
161
+
162
+ # http body (model)
163
+ post_body = @api_client.object_to_http_body(body)
164
+
165
+ auth_names = []
166
+ data, status_code, headers = @api_client.call_api(:POST, path,
167
+ :header_params => header_params,
168
+ :query_params => query_params,
169
+ :form_params => form_params,
170
+ :body => post_body,
171
+ :auth_names => auth_names,
172
+ :return_type => 'CreateRefundResponse')
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug "API called: RefundApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
175
+ end
176
+ return data, status_code, headers
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,387 @@
1
+ =begin
2
+ Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+
9
+ =end
10
+
11
+ require "uri"
12
+
13
+ module SquareConnect
14
+ class TransactionApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+
21
+ # ListTransactions
22
+ # Lists transactions for a particular location.\n\nWhen making a request to this endpoint, your request body **must** include either the `cursor` parameter, or it must\ninclude both `begin_time` and `end_time` with an optional `sort_order`.
23
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
24
+ # @param location_id The ID of the location to list transactions for.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
27
+ # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
28
+ # @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for\nchronological, `DESC` for reverse-chronological).
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)
33
+ return data
34
+ end
35
+
36
+ # ListTransactions
37
+ # Lists transactions for a particular location.\n\nWhen making a request to this endpoint, your request body **must** include either the `cursor` parameter, or it must\ninclude both `begin_time` and `end_time` with an optional `sort_order`.
38
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
39
+ # @param location_id The ID of the location to list transactions for.
40
+ # @param [Hash] opts the optional parameters
41
+ # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
42
+ # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
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 = {})
47
+ if @api_client.config.debugging
48
+ @api_client.config.logger.debug "Calling API: TransactionApi#list_transactions ..."
49
+ end
50
+
51
+ # verify the required parameter 'authorization' is set
52
+ fail "Missing the required parameter 'authorization' when calling list_transactions" if authorization.nil?
53
+
54
+ # verify the required parameter 'location_id' is set
55
+ fail "Missing the required parameter 'location_id' when calling list_transactions" if location_id.nil?
56
+
57
+ if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])
58
+ fail 'invalid value for "sort_order", must be one of DESC, ASC'
59
+ end
60
+
61
+ # resource path
62
+ path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
63
+
64
+ # query parameters
65
+ 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
+
71
+ # header parameters
72
+ header_params = {}
73
+
74
+ # HTTP header 'Accept' (if needed)
75
+ _header_accept = ['application/json']
76
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
77
+
78
+ # HTTP header 'Content-Type'
79
+ _header_content_type = ['application/json']
80
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
81
+ header_params[:'Authorization'] = authorization
82
+
83
+ # form parameters
84
+ form_params = {}
85
+
86
+ # http body (model)
87
+ post_body = nil
88
+
89
+ auth_names = []
90
+ data, status_code, headers = @api_client.call_api(:GET, path,
91
+ :header_params => header_params,
92
+ :query_params => query_params,
93
+ :form_params => form_params,
94
+ :body => post_body,
95
+ :auth_names => auth_names,
96
+ :return_type => 'ListTransactionsResponse')
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug "API called: TransactionApi#list_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
99
+ end
100
+ return data, status_code, headers
101
+ end
102
+
103
+ # Charge
104
+ # Charges a card represented by a token.
105
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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.\n\nSee the corresponding object definition for field details.
108
+ # @param [Hash] opts the optional parameters
109
+ # @return [ChargeResponse]
110
+ def charge(authorization, location_id, body, opts = {})
111
+ data, status_code, headers = charge_with_http_info(authorization, location_id, body, opts)
112
+ return data
113
+ end
114
+
115
+ # Charge
116
+ # Charges a card represented by a token.
117
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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.\n\nSee the corresponding object definition for field details.
120
+ # @param [Hash] opts the optional parameters
121
+ # @return [Array<(ChargeResponse, Fixnum, Hash)>] ChargeResponse data, response status code and response headers
122
+ def charge_with_http_info(authorization, location_id, body, opts = {})
123
+ if @api_client.config.debugging
124
+ @api_client.config.logger.debug "Calling API: TransactionApi#charge ..."
125
+ end
126
+
127
+ # verify the required parameter 'authorization' is set
128
+ fail "Missing the required parameter 'authorization' when calling charge" if authorization.nil?
129
+
130
+ # verify the required parameter 'location_id' is set
131
+ fail "Missing the required parameter 'location_id' when calling charge" if location_id.nil?
132
+
133
+ # verify the required parameter 'body' is set
134
+ fail "Missing the required parameter 'body' when calling charge" if body.nil?
135
+
136
+ # resource path
137
+ path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
138
+
139
+ # query parameters
140
+ query_params = {}
141
+
142
+ # header parameters
143
+ header_params = {}
144
+
145
+ # HTTP header 'Accept' (if needed)
146
+ _header_accept = ['application/json']
147
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
148
+
149
+ # HTTP header 'Content-Type'
150
+ _header_content_type = ['application/json']
151
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
152
+ header_params[:'Authorization'] = authorization
153
+
154
+ # form parameters
155
+ form_params = {}
156
+
157
+ # http body (model)
158
+ post_body = @api_client.object_to_http_body(body)
159
+
160
+ auth_names = []
161
+ data, status_code, headers = @api_client.call_api(:POST, path,
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => 'ChargeResponse')
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug "API called: TransactionApi#charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
170
+ end
171
+ return data, status_code, headers
172
+ end
173
+
174
+ # RetrieveTransaction
175
+ # Retrieves details for a single transaction.
176
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
177
+ # @param location_id
178
+ # @param transaction_id
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [RetrieveTransactionResponse]
181
+ def retrieve_transaction(authorization, location_id, transaction_id, opts = {})
182
+ data, status_code, headers = retrieve_transaction_with_http_info(authorization, location_id, transaction_id, opts)
183
+ return data
184
+ end
185
+
186
+ # RetrieveTransaction
187
+ # Retrieves details for a single transaction.
188
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
189
+ # @param location_id
190
+ # @param transaction_id
191
+ # @param [Hash] opts the optional parameters
192
+ # @return [Array<(RetrieveTransactionResponse, Fixnum, Hash)>] RetrieveTransactionResponse data, response status code and response headers
193
+ def retrieve_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug "Calling API: TransactionApi#retrieve_transaction ..."
196
+ end
197
+
198
+ # verify the required parameter 'authorization' is set
199
+ fail "Missing the required parameter 'authorization' when calling retrieve_transaction" if authorization.nil?
200
+
201
+ # verify the required parameter 'location_id' is set
202
+ fail "Missing the required parameter 'location_id' when calling retrieve_transaction" if location_id.nil?
203
+
204
+ # verify the required parameter 'transaction_id' is set
205
+ fail "Missing the required parameter 'transaction_id' when calling retrieve_transaction" if transaction_id.nil?
206
+
207
+ # resource path
208
+ 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)
209
+
210
+ # query parameters
211
+ query_params = {}
212
+
213
+ # header parameters
214
+ header_params = {}
215
+
216
+ # HTTP header 'Accept' (if needed)
217
+ _header_accept = ['application/json']
218
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
219
+
220
+ # HTTP header 'Content-Type'
221
+ _header_content_type = ['application/json']
222
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
223
+ header_params[:'Authorization'] = authorization
224
+
225
+ # form parameters
226
+ form_params = {}
227
+
228
+ # http body (model)
229
+ post_body = nil
230
+
231
+ auth_names = []
232
+ data, status_code, headers = @api_client.call_api(:GET, path,
233
+ :header_params => header_params,
234
+ :query_params => query_params,
235
+ :form_params => form_params,
236
+ :body => post_body,
237
+ :auth_names => auth_names,
238
+ :return_type => 'RetrieveTransactionResponse')
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug "API called: TransactionApi#retrieve_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
241
+ end
242
+ return data, status_code, headers
243
+ end
244
+
245
+ # CaptureTransaction
246
+ # Captures a transaction that was created with the **Charge**\nendpoint with a `delay_capture` value of `true`.
247
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
248
+ # @param location_id
249
+ # @param transaction_id
250
+ # @param [Hash] opts the optional parameters
251
+ # @return [CaptureTransactionResponse]
252
+ def capture_transaction(authorization, location_id, transaction_id, opts = {})
253
+ data, status_code, headers = capture_transaction_with_http_info(authorization, location_id, transaction_id, opts)
254
+ return data
255
+ end
256
+
257
+ # CaptureTransaction
258
+ # Captures a transaction that was created with the **Charge**\nendpoint with a `delay_capture` value of `true`.
259
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
260
+ # @param location_id
261
+ # @param transaction_id
262
+ # @param [Hash] opts the optional parameters
263
+ # @return [Array<(CaptureTransactionResponse, Fixnum, Hash)>] CaptureTransactionResponse data, response status code and response headers
264
+ def capture_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
265
+ if @api_client.config.debugging
266
+ @api_client.config.logger.debug "Calling API: TransactionApi#capture_transaction ..."
267
+ end
268
+
269
+ # verify the required parameter 'authorization' is set
270
+ fail "Missing the required parameter 'authorization' when calling capture_transaction" if authorization.nil?
271
+
272
+ # verify the required parameter 'location_id' is set
273
+ fail "Missing the required parameter 'location_id' when calling capture_transaction" if location_id.nil?
274
+
275
+ # verify the required parameter 'transaction_id' is set
276
+ fail "Missing the required parameter 'transaction_id' when calling capture_transaction" if transaction_id.nil?
277
+
278
+ # resource path
279
+ 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)
280
+
281
+ # query parameters
282
+ query_params = {}
283
+
284
+ # header parameters
285
+ header_params = {}
286
+
287
+ # HTTP header 'Accept' (if needed)
288
+ _header_accept = ['application/json']
289
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
290
+
291
+ # HTTP header 'Content-Type'
292
+ _header_content_type = ['application/json']
293
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
294
+ header_params[:'Authorization'] = authorization
295
+
296
+ # form parameters
297
+ form_params = {}
298
+
299
+ # http body (model)
300
+ post_body = nil
301
+
302
+ auth_names = []
303
+ data, status_code, headers = @api_client.call_api(:POST, path,
304
+ :header_params => header_params,
305
+ :query_params => query_params,
306
+ :form_params => form_params,
307
+ :body => post_body,
308
+ :auth_names => auth_names,
309
+ :return_type => 'CaptureTransactionResponse')
310
+ if @api_client.config.debugging
311
+ @api_client.config.logger.debug "API called: TransactionApi#capture_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
312
+ end
313
+ return data, status_code, headers
314
+ end
315
+
316
+ # VoidTransaction
317
+ # Cancels a transaction that was created with the **Charge**\nendpoint with a `delay_capture` value of `true`.
318
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
319
+ # @param location_id
320
+ # @param transaction_id
321
+ # @param [Hash] opts the optional parameters
322
+ # @return [VoidTransactionResponse]
323
+ def void_transaction(authorization, location_id, transaction_id, opts = {})
324
+ data, status_code, headers = void_transaction_with_http_info(authorization, location_id, transaction_id, opts)
325
+ return data
326
+ end
327
+
328
+ # VoidTransaction
329
+ # Cancels a transaction that was created with the **Charge**\nendpoint with a `delay_capture` value of `true`.
330
+ # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
331
+ # @param location_id
332
+ # @param transaction_id
333
+ # @param [Hash] opts the optional parameters
334
+ # @return [Array<(VoidTransactionResponse, Fixnum, Hash)>] VoidTransactionResponse data, response status code and response headers
335
+ def void_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "Calling API: TransactionApi#void_transaction ..."
338
+ end
339
+
340
+ # verify the required parameter 'authorization' is set
341
+ fail "Missing the required parameter 'authorization' when calling void_transaction" if authorization.nil?
342
+
343
+ # 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
+
346
+ # 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
+
349
+ # resource path
350
+ 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
+
352
+ # query parameters
353
+ query_params = {}
354
+
355
+ # header parameters
356
+ header_params = {}
357
+
358
+ # HTTP header 'Accept' (if needed)
359
+ _header_accept = ['application/json']
360
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
361
+
362
+ # HTTP header 'Content-Type'
363
+ _header_content_type = ['application/json']
364
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
365
+ header_params[:'Authorization'] = authorization
366
+
367
+ # form parameters
368
+ form_params = {}
369
+
370
+ # http body (model)
371
+ post_body = nil
372
+
373
+ auth_names = []
374
+ data, status_code, headers = @api_client.call_api(:POST, path,
375
+ :header_params => header_params,
376
+ :query_params => query_params,
377
+ :form_params => form_params,
378
+ :body => post_body,
379
+ :auth_names => auth_names,
380
+ :return_type => 'VoidTransactionResponse')
381
+ if @api_client.config.debugging
382
+ @api_client.config.logger.debug "API called: TransactionApi#void_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
383
+ end
384
+ return data, status_code, headers
385
+ end
386
+ end
387
+ end