Class: SquareLegacy::RefundsApi
- Defined in:
- lib/square_legacy/api/refunds_api.rb
Overview
RefundsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_payment_refund(refund_id:) ⇒ ApiResponse
Retrieves a specific refund using the ‘refund_id`.
-
#list_payment_refunds(begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, location_id: nil, status: nil, source_type: nil, limit: nil, updated_at_begin_time: nil, updated_at_end_time: nil, sort_field: nil) ⇒ ApiResponse
Retrieves a list of refunds for the account making the request.
-
#refund_payment(body:) ⇒ ApiResponse
Refunds a payment.
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
#get_payment_refund(refund_id:) ⇒ ApiResponse
Retrieves a specific refund using the ‘refund_id`. desired `PaymentRefund`.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/square_legacy/api/refunds_api.rb', line 123 def get_payment_refund(refund_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/refunds/{refund_id}', 'default') .template_param(new_parameter(refund_id, key: 'refund_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_payment_refunds(begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, location_id: nil, status: nil, source_type: nil, limit: nil, updated_at_begin_time: nil, updated_at_end_time: nil, sort_field: nil) ⇒ ApiResponse
Retrieves a list of refunds for the account making the request. Results are eventually consistent, and new refunds or changes to refunds might take several seconds to appear. The maximum results per page is 100. time range to retrieve each ‘PaymentRefund` for, in RFC 3339 format. The range is determined using the `created_at` field for each `PaymentRefund`.
Default: The current time minus one year.
range to retrieve each ‘PaymentRefund` for, in RFC 3339 format. The range is determined using the `created_at` field for each `PaymentRefund`.
Default: The current time.
are listed by ‘PaymentRefund.created_at`: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest (default). a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). location supplied. By default, results are returned for all locations associated with the seller. the given status are returned. For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). Default: If omitted, refunds are returned regardless of their status. refunds whose payments have the indicated source type. Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. For information about these payment source types, see [Take Payments](developer.squareup.com/docs/payments-api/take-payments).
Default: If omitted, refunds are returned regardless of the source
type. to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. If the supplied value is greater than 100, no more than 100 results are returned. Default: 100 start of the time range to retrieve each ‘PaymentRefund` for, in RFC 3339 format. The range is determined using the `updated_at` field for each `PaymentRefund`. Default: if omitted, the time range starts at `begin_time`. of the time range to retrieve each `PaymentRefund` for, in RFC 3339 format. The range is determined using the `updated_at` field for each `PaymentRefund`. Default: The current time. results by. The default is `CREATED_AT`. Current values include `CREATED_AT` and `UPDATED_AT`.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/square_legacy/api/refunds_api.rb', line 56 def list_payment_refunds(begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, location_id: nil, status: nil, source_type: nil, limit: nil, updated_at_begin_time: nil, updated_at_end_time: nil, sort_field: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/refunds', 'default') .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')) .query_param(new_parameter(location_id, key: 'location_id')) .query_param(new_parameter(status, key: 'status')) .query_param(new_parameter(source_type, key: 'source_type')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(updated_at_begin_time, key: 'updated_at_begin_time')) .query_param(new_parameter(updated_at_end_time, key: 'updated_at_end_time')) .query_param(new_parameter(sort_field, key: 'sort_field')) .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 |
#refund_payment(body:) ⇒ ApiResponse
Refunds a payment. You can refund the entire payment amount or a portion of it. You can use this endpoint to refund a card payment or record a refund of a cash or external payment. For more information, see [Refund Payment](developer.squareup.com/docs/payments-api/refund-payments) . containing the fields to POST for the request. See the corresponding object definition for field details.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/square_legacy/api/refunds_api.rb', line 102 def refund_payment(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/refunds', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |