square_connect 2.0.0 → 2.0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +151 -9
  4. data/Rakefile +8 -0
  5. data/docs/Address.md +26 -0
  6. data/docs/CaptureTransactionRequest.md +11 -0
  7. data/docs/CaptureTransactionResponse.md +12 -0
  8. data/docs/Card.md +18 -0
  9. data/docs/CardBrand.md +20 -0
  10. data/docs/ChargeRequest.md +22 -0
  11. data/docs/ChargeResponse.md +13 -0
  12. data/docs/Checkout.md +20 -0
  13. data/docs/CheckoutApi.md +62 -0
  14. data/docs/Country.md +261 -0
  15. data/docs/CreateCheckoutRequest.md +18 -0
  16. data/docs/CreateCheckoutResponse.md +13 -0
  17. data/docs/CreateCustomerCardRequest.md +14 -0
  18. data/docs/CreateCustomerCardResponse.md +13 -0
  19. data/docs/CreateCustomerRequest.md +20 -0
  20. data/docs/CreateCustomerResponse.md +13 -0
  21. data/docs/CreateOrderRequest.md +13 -0
  22. data/docs/CreateOrderRequestLineItem.md +14 -0
  23. data/docs/CreateOrderRequestOrder.md +13 -0
  24. data/docs/CreateRefundRequest.md +15 -0
  25. data/docs/CreateRefundResponse.md +13 -0
  26. data/docs/Currency.md +191 -0
  27. data/docs/Customer.md +26 -0
  28. data/docs/CustomerApi.md +267 -0
  29. data/docs/CustomerCardApi.md +116 -0
  30. data/docs/CustomerGroupInfo.md +13 -0
  31. data/docs/CustomerPreferences.md +12 -0
  32. data/docs/DeleteCustomerCardRequest.md +11 -0
  33. data/docs/DeleteCustomerCardResponse.md +12 -0
  34. data/docs/DeleteCustomerRequest.md +11 -0
  35. data/docs/DeleteCustomerResponse.md +12 -0
  36. data/docs/Error.md +15 -0
  37. data/docs/ErrorCategory.md +17 -0
  38. data/docs/ErrorCode.md +83 -0
  39. data/docs/ListCustomersRequest.md +12 -0
  40. data/docs/ListCustomersResponse.md +14 -0
  41. data/docs/ListLocationsRequest.md +11 -0
  42. data/docs/ListLocationsResponse.md +13 -0
  43. data/docs/ListRefundsRequest.md +15 -0
  44. data/docs/ListRefundsResponse.md +14 -0
  45. data/docs/ListTransactionsRequest.md +15 -0
  46. data/docs/ListTransactionsResponse.md +14 -0
  47. data/docs/Location.md +16 -0
  48. data/docs/LocationApi.md +56 -0
  49. data/docs/LocationCapability.md +12 -0
  50. data/docs/Money.md +13 -0
  51. data/docs/Order.md +16 -0
  52. data/docs/OrderLineItem.md +16 -0
  53. data/docs/Refund.md +20 -0
  54. data/docs/RefundApi.md +126 -0
  55. data/docs/RefundStatus.md +15 -0
  56. data/docs/RetrieveCustomerRequest.md +11 -0
  57. data/docs/RetrieveCustomerResponse.md +13 -0
  58. data/docs/RetrieveTransactionRequest.md +11 -0
  59. data/docs/RetrieveTransactionResponse.md +13 -0
  60. data/docs/SortOrder.md +13 -0
  61. data/docs/Tender.md +22 -0
  62. data/docs/TenderCardDetails.md +14 -0
  63. data/docs/TenderCardDetailsEntryMethod.md +16 -0
  64. data/docs/TenderCardDetailsStatus.md +15 -0
  65. data/docs/TenderCashDetails.md +13 -0
  66. data/docs/TenderType.md +17 -0
  67. data/docs/Transaction.md +21 -0
  68. data/docs/TransactionApi.md +285 -0
  69. data/docs/TransactionProduct.md +19 -0
  70. data/docs/UpdateCustomerRequest.md +20 -0
  71. data/docs/UpdateCustomerResponse.md +13 -0
  72. data/docs/VoidTransactionRequest.md +11 -0
  73. data/docs/VoidTransactionResponse.md +12 -0
  74. data/lib/square_connect.rb +33 -16
  75. data/lib/square_connect/api/checkout_api.rb +82 -0
  76. data/lib/square_connect/api/customer_api.rb +121 -162
  77. data/lib/square_connect/api/customer_card_api.rb +31 -50
  78. data/lib/square_connect/api/location_api.rb +12 -20
  79. data/lib/square_connect/api/refund_api.rb +70 -90
  80. data/lib/square_connect/api/transaction_api.rb +119 -165
  81. data/lib/square_connect/api_client.rb +64 -17
  82. data/lib/square_connect/api_error.rb +7 -3
  83. data/lib/square_connect/configuration.rb +31 -1
  84. data/lib/square_connect/models/address.rb +149 -78
  85. data/lib/square_connect/models/capture_transaction_request.rb +176 -0
  86. data/lib/square_connect/models/capture_transaction_response.rb +54 -26
  87. data/lib/square_connect/models/card.rb +98 -52
  88. data/lib/square_connect/models/card_brand.rb +12 -133
  89. data/lib/square_connect/models/charge_request.rb +106 -67
  90. data/lib/square_connect/models/charge_response.rb +57 -30
  91. data/lib/square_connect/models/checkout.rb +266 -0
  92. data/lib/square_connect/models/country.rb +253 -133
  93. data/lib/square_connect/models/create_checkout_request.rb +316 -0
  94. data/lib/square_connect/models/create_checkout_response.rb +198 -0
  95. data/lib/square_connect/models/create_customer_card_request.rb +66 -35
  96. data/lib/square_connect/models/create_customer_card_response.rb +58 -31
  97. data/lib/square_connect/models/create_customer_request.rb +79 -59
  98. data/lib/square_connect/models/create_customer_response.rb +58 -31
  99. data/lib/square_connect/models/create_order_request.rb +234 -0
  100. data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
  101. data/lib/square_connect/models/create_order_request_order.rb +219 -0
  102. data/lib/square_connect/models/create_refund_request.rb +79 -39
  103. data/lib/square_connect/models/create_refund_response.rb +57 -30
  104. data/lib/square_connect/models/currency.rb +183 -133
  105. data/lib/square_connect/models/customer.rb +130 -77
  106. data/lib/square_connect/models/customer_group_info.rb +206 -0
  107. data/lib/square_connect/models/customer_preferences.rb +186 -0
  108. data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
  109. data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
  110. data/lib/square_connect/models/delete_customer_request.rb +176 -0
  111. data/lib/square_connect/models/delete_customer_response.rb +55 -27
  112. data/lib/square_connect/models/error.rb +107 -45
  113. data/lib/square_connect/models/error_category.rb +9 -133
  114. data/lib/square_connect/models/error_code.rb +75 -133
  115. data/lib/square_connect/models/list_customers_request.rb +55 -27
  116. data/lib/square_connect/models/list_customers_response.rb +61 -35
  117. data/lib/square_connect/models/list_locations_request.rb +176 -0
  118. data/lib/square_connect/models/list_locations_response.rb +57 -30
  119. data/lib/square_connect/models/list_refunds_request.rb +91 -42
  120. data/lib/square_connect/models/list_refunds_response.rb +59 -33
  121. data/lib/square_connect/models/list_transactions_request.rb +91 -42
  122. data/lib/square_connect/models/list_transactions_response.rb +59 -33
  123. data/lib/square_connect/models/location.rb +86 -41
  124. data/lib/square_connect/models/location_capability.rb +4 -133
  125. data/lib/square_connect/models/money.rb +85 -34
  126. data/lib/square_connect/models/order.rb +228 -0
  127. data/lib/square_connect/models/order_line_item.rb +226 -0
  128. data/lib/square_connect/models/refund.rb +138 -59
  129. data/lib/square_connect/models/refund_status.rb +7 -133
  130. data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
  131. data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
  132. data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
  133. data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
  134. data/lib/square_connect/models/sort_order.rb +5 -133
  135. data/lib/square_connect/models/tender.rb +112 -65
  136. data/lib/square_connect/models/tender_card_details.rb +93 -40
  137. data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
  138. data/lib/square_connect/models/tender_card_details_status.rb +7 -133
  139. data/lib/square_connect/models/tender_cash_details.rb +58 -31
  140. data/lib/square_connect/models/tender_type.rb +9 -133
  141. data/lib/square_connect/models/transaction.rb +132 -56
  142. data/lib/square_connect/models/transaction_product.rb +11 -133
  143. data/lib/square_connect/models/update_customer_request.rb +79 -59
  144. data/lib/square_connect/models/update_customer_response.rb +58 -31
  145. data/lib/square_connect/models/void_transaction_request.rb +176 -0
  146. data/lib/square_connect/models/void_transaction_response.rb +54 -26
  147. data/lib/square_connect/version.rb +2 -3
  148. data/spec/api/checkout_api_spec.rb +53 -0
  149. data/spec/api/customer_api_spec.rb +121 -0
  150. data/spec/api/customer_card_api_spec.rb +71 -0
  151. data/spec/api/location_api_spec.rb +58 -0
  152. data/spec/api/refund_api_spec.rb +75 -0
  153. data/spec/api/transaction_api_spec.rb +128 -0
  154. data/spec/api_client_spec.rb +226 -0
  155. data/spec/configuration_spec.rb +42 -0
  156. data/spec/models/address_spec.rb +186 -0
  157. data/spec/models/capture_transaction_request_spec.rb +36 -0
  158. data/spec/models/capture_transaction_response_spec.rb +46 -0
  159. data/spec/models/card_brand_spec.rb +36 -0
  160. data/spec/models/card_spec.rb +106 -0
  161. data/spec/models/charge_request_spec.rb +146 -0
  162. data/spec/models/charge_response_spec.rb +56 -0
  163. data/spec/models/checkout_spec.rb +126 -0
  164. data/spec/models/country_spec.rb +36 -0
  165. data/spec/models/create_checkout_request_spec.rb +106 -0
  166. data/spec/models/create_checkout_response_spec.rb +56 -0
  167. data/spec/models/create_customer_card_request_spec.rb +66 -0
  168. data/spec/models/create_customer_card_response_spec.rb +56 -0
  169. data/spec/models/create_customer_request_spec.rb +126 -0
  170. data/spec/models/create_customer_response_spec.rb +56 -0
  171. data/spec/models/create_order_request_line_item_spec.rb +66 -0
  172. data/spec/models/create_order_request_order_spec.rb +56 -0
  173. data/spec/models/create_order_request_spec.rb +56 -0
  174. data/spec/models/create_refund_request_spec.rb +76 -0
  175. data/spec/models/create_refund_response_spec.rb +56 -0
  176. data/spec/models/currency_spec.rb +36 -0
  177. data/spec/models/customer_group_info_spec.rb +56 -0
  178. data/spec/models/customer_preferences_spec.rb +46 -0
  179. data/spec/models/customer_spec.rb +186 -0
  180. data/spec/models/delete_customer_card_request_spec.rb +36 -0
  181. data/spec/models/delete_customer_card_response_spec.rb +46 -0
  182. data/spec/models/delete_customer_request_spec.rb +36 -0
  183. data/spec/models/delete_customer_response_spec.rb +46 -0
  184. data/spec/models/error_category_spec.rb +36 -0
  185. data/spec/models/error_code_spec.rb +36 -0
  186. data/spec/models/error_spec.rb +76 -0
  187. data/spec/models/list_customers_request_spec.rb +46 -0
  188. data/spec/models/list_customers_response_spec.rb +66 -0
  189. data/spec/models/list_locations_request_spec.rb +36 -0
  190. data/spec/models/list_locations_response_spec.rb +56 -0
  191. data/spec/models/list_refunds_request_spec.rb +76 -0
  192. data/spec/models/list_refunds_response_spec.rb +66 -0
  193. data/spec/models/list_transactions_request_spec.rb +76 -0
  194. data/spec/models/list_transactions_response_spec.rb +66 -0
  195. data/spec/models/location_capability_spec.rb +36 -0
  196. data/spec/models/location_spec.rb +86 -0
  197. data/spec/models/money_spec.rb +56 -0
  198. data/spec/models/order_line_item_spec.rb +86 -0
  199. data/spec/models/order_spec.rb +86 -0
  200. data/spec/models/refund_spec.rb +126 -0
  201. data/spec/models/refund_status_spec.rb +36 -0
  202. data/spec/models/retrieve_customer_request_spec.rb +36 -0
  203. data/spec/models/retrieve_customer_response_spec.rb +56 -0
  204. data/spec/models/retrieve_transaction_request_spec.rb +36 -0
  205. data/spec/models/retrieve_transaction_response_spec.rb +56 -0
  206. data/spec/models/sort_order_spec.rb +36 -0
  207. data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
  208. data/spec/models/tender_card_details_spec.rb +66 -0
  209. data/spec/models/tender_card_details_status_spec.rb +36 -0
  210. data/spec/models/tender_cash_details_spec.rb +56 -0
  211. data/spec/models/tender_spec.rb +146 -0
  212. data/spec/models/tender_type_spec.rb +36 -0
  213. data/spec/models/transaction_product_spec.rb +36 -0
  214. data/spec/models/transaction_spec.rb +136 -0
  215. data/spec/models/update_customer_request_spec.rb +126 -0
  216. data/spec/models/update_customer_response_spec.rb +56 -0
  217. data/spec/models/void_transaction_request_spec.rb +36 -0
  218. data/spec/models/void_transaction_response_spec.rb +46 -0
  219. data/spec/spec_helper.rb +115 -0
  220. data/square_connect.gemspec +22 -11
  221. data/travis-ci/accounts.enc +0 -0
  222. 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
- # 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.
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
- # @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)
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
- # 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.
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
- # @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 = {})
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#list_transactions ..."
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 list_transactions" if authorization.nil?
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 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
-
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
- path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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(:GET, path,
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 => 'ListTransactionsResponse')
75
+ :return_type => 'CaptureTransactionResponse')
97
76
  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}"
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 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.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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, status_code, headers = charge_with_http_info(authorization, location_id, body, opts)
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 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.
95
+ # Charges a card represented by a card nonce or a customer&#39;s card on file. Your request to this endpoint must include _either_: - A value for the &#x60;card_nonce&#x60; parameter (to charge a card nonce generated with the &#x60;SqPaymentForm&#x60;) - Values for the &#x60;customer_card_id&#x60; and &#x60;customer_id&#x60; parameters (to charge a customer&#39;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: - &#x60;buyer_email_address&#x60; - At least one of &#x60;billing_address&#x60; or &#x60;shipping_address&#x60; When this response is returned, the amount of Square&#39;s processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the &#x60;processing_fee_money&#x60; 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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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#charge ..."
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
- path = "/v2/locations/{location_id}/transactions".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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
- # 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
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
147
+ # @param location_id The ID of the location to list transactions for.
179
148
  # @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)
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 (&#x60;ASC&#x60; for oldest first, &#x60;DESC&#x60; for newest first). Default value: &#x60;DESC&#x60;
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
- # 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
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
162
+ # @param location_id The ID of the location to list transactions for.
191
163
  # @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 = {})
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 (&#x60;ASC&#x60; for oldest first, &#x60;DESC&#x60; for newest first). Default value: &#x60;DESC&#x60;
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#retrieve_transaction ..."
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 retrieve_transaction" if authorization.nil?
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 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
-
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
- 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)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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 => 'RetrieveTransactionResponse')
210
+ :return_type => 'ListTransactionsResponse')
239
211
  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}"
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
- # 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
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
220
+ # @param location_id The ID of the transaction&#39;s associated location.
221
+ # @param transaction_id The ID of the transaction to retrieve.
250
222
  # @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)
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
- # 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
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
232
+ # @param location_id The ID of the transaction&#39;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<(CaptureTransactionResponse, Fixnum, Hash)>] CaptureTransactionResponse data, response status code and response headers
264
- def capture_transaction_with_http_info(authorization, location_id, transaction_id, opts = {})
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#capture_transaction ..."
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 capture_transaction" if authorization.nil?
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 capture_transaction" if location_id.nil?
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 capture_transaction" if transaction_id.nil?
277
-
245
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionApi.retrieve_transaction" if transaction_id.nil?
278
246
  # 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)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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(:POST, path,
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 => 'CaptureTransactionResponse')
272
+ :return_type => 'RetrieveTransactionResponse')
310
273
  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}"
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 **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`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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, status_code, headers = void_transaction_with_http_info(authorization, location_id, transaction_id, opts)
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 **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`.
292
+ # Cancels a transaction that was created with the [Charge](#endpoint-charge) endpoint with a &#x60;delay_capture&#x60; value of &#x60;true&#x60;. 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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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#void_transaction ..."
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
- 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)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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,