Class: SquareLegacy::TransactionsApi
- Defined in:
- lib/square_legacy/api/transactions_api.rb
Overview
TransactionsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#capture_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Captures a transaction that was created with the Charge endpoint with a
delay_capturevalue oftrue. -
#list_transactions(location_id:, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil) ⇒ ApiResponse
Lists transactions for a particular location.
-
#retrieve_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Retrieves details for a single transaction.
-
#void_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Cancels a transaction that was created with the Charge endpoint with a
delay_capturevalue oftrue.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SquareLegacy::BaseApi
Instance Method Details
#capture_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Captures a transaction that was created with the
Charge
endpoint with a delay_capture value of true.
See [Delayed capture
transactions](https://developer.squareup.com/docs/payments/transactions/ov
erview#delayed-capture)
for more information.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/square_legacy/api/transactions_api.rb', line 93 def capture_transaction(location_id:, transaction_id:) warn 'Endpoint capture_transaction in TransactionsApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/{location_id}/transactions/{transaction_id}/capture', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(transaction_id, key: 'transaction_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_transactions(location_id:, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil) ⇒ ApiResponse
Lists transactions for a particular location.
Transactions include payment information from sales and exchanges and
refund
information from returns and exchanges.
Max results per
page:
50
list transactions for.
requested reporting period, in RFC 3339 format. See [Date
ranges](https://developer.squareup.com/docs/build-basics/working-with-date
s) for details on date inclusivity/exclusivity. Default value: The
current time minus one year.
reporting period, in RFC 3339 format. See [Date
ranges](https://developer.squareup.com/docs/build-basics/working-with-date
s) for details on date inclusivity/exclusivity. Default value: The
current time.
results are listed in the response (ASC for oldest first, DESC for
newest first). Default value: DESC
a previous call to this endpoint. Provide this to retrieve the next set of
results for your original query. See Paginating
results
for more information.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/square_legacy/api/transactions_api.rb', line 32 def list_transactions(location_id:, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil) warn 'Endpoint list_transactions in TransactionsApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/{location_id}/transactions', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .query_param(new_parameter(begin_time, key: 'begin_time')) .query_param(new_parameter(end_time, key: 'end_time')) .query_param(new_parameter(sort_order, key: 'sort_order')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Retrieves details for a single transaction. transaction's associated location. transaction to retrieve.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/square_legacy/api/transactions_api.rb', line 63 def retrieve_transaction(location_id:, transaction_id:) warn 'Endpoint retrieve_transaction in TransactionsApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/{location_id}/transactions/{transaction_id}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(transaction_id, key: 'transaction_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#void_transaction(location_id:, transaction_id:) ⇒ ApiResponse
Cancels a transaction that was created with the
Charge
endpoint with a delay_capture value of true.
See [Delayed capture
transactions](https://developer.squareup.com/docs/payments/transactions/ov
erview#delayed-capture)
for more information.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/square_legacy/api/transactions_api.rb', line 123 def void_transaction(location_id:, transaction_id:) warn 'Endpoint void_transaction in TransactionsApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/{location_id}/transactions/{transaction_id}/void', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(transaction_id, key: 'transaction_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |