Class: Square::RefundsApi
- Defined in:
- lib/square/api/refunds_api.rb
Overview
RefundsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_payment_refund(refund_id:) ⇒ GetPaymentRefundResponse Hash
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) ⇒ ListPaymentRefundsResponse Hash
Retrieves a list of refunds for the account making the request.
-
#refund_payment(body:) ⇒ RefundPaymentResponse Hash
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 Square::BaseApi
Instance Method Details
#get_payment_refund(refund_id:) ⇒ GetPaymentRefundResponse Hash
Retrieves a specific refund using the ‘refund_id`. desired `PaymentRefund`.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/square/api/refunds_api.rb', line 103 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) ⇒ ListPaymentRefundsResponse Hash
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. beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year. the requested reporting period, in RFC 3339 format. Default: The current time. are listed: - ‘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/basics/api101/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]($m/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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/square/api/refunds_api.rb', line 42 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) 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')) .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:) ⇒ RefundPaymentResponse Hash
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.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/square/api/refunds_api.rb', line 82 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 |