Class: Yoomoney::Resources::Refunds

Inherits:
Object
  • Object
show all
Defined in:
lib/yoomoney/resources/refunds.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Refunds

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Refunds.

Parameters:



96
97
98
# File 'lib/yoomoney/resources/refunds.rb', line 96

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, payment_id:, idempotence_key:, deal: nil, description: nil, metadata: nil, receipt: nil, refund_method_data: nil, sources: nil, request_options: {}) ⇒ Yoomoney::Models::Refund

Some parameter documentations has been truncated, see Models::RefundCreateParams for more details.

Создание возврата

Parameters:

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/yoomoney/resources/refunds.rb', line 36

def create(params)
  parsed, options = Yoomoney::RefundCreateParams.dump_request(params)
  header_params = {idempotence_key: "idempotence-key"}
  @client.request(
    method: :post,
    path: "refunds",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Yoomoney::Refund,
    options: options
  )
end

#list(created_at: nil, cursor: nil, limit: nil, payment_id: nil, status: nil, request_options: {}) ⇒ Yoomoney::Models::RefundListResponse

Список возвратов

Parameters:

Returns:

See Also:



82
83
84
85
86
87
88
89
90
91
# File 'lib/yoomoney/resources/refunds.rb', line 82

def list(params = {})
  parsed, options = Yoomoney::RefundListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "refunds",
    query: parsed,
    model: Yoomoney::Models::RefundListResponse,
    options: options
  )
end

#retrieve(refund_id, request_options: {}) ⇒ Yoomoney::Models::Refund

Информация о возврате

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
# File 'lib/yoomoney/resources/refunds.rb', line 59

def retrieve(refund_id, params = {})
  @client.request(
    method: :get,
    path: ["refunds/%1$s", refund_id],
    model: Yoomoney::Refund,
    options: params[:request_options]
  )
end