Class: Dodopayments::Resources::Refunds

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/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:



84
85
86
# File 'lib/dodopayments/resources/refunds.rb', line 84

def initialize(client:)
  @client = client
end

Instance Method Details

#create(payment_id: , items: nil, metadata: nil, reason: nil, request_options: {}) ⇒ Dodopayments::Models::Refund

Parameters:

  • payment_id (String)

    The unique identifier of the payment to be refunded.

  • items (Array<Dodopayments::Models::RefundCreateParams::Item>, nil)

    Partially Refund an Individual Item

  • metadata (Hash{Symbol=>String})

    Additional metadata associated with the refund.

  • reason (String, nil)

    The reason for the refund, if any. Maximum length is 3000 characters. Optional.

  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/dodopayments/resources/refunds.rb', line 21

def create(params)
  parsed, options = Dodopayments::RefundCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "refunds",
    body: parsed,
    model: Dodopayments::Refund,
    options: options
  )
end

#list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, status: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::RefundListResponse>

Parameters:

  • created_at_gte (Time)

    Get events after this created time

  • created_at_lte (Time)

    Get events created before this time

  • customer_id (String)

    Filter by customer_id

  • page_number (Integer)

    Page number default is 0

  • page_size (Integer)

    Page size default is 10 max is 100

  • status (Symbol, Dodopayments::Models::RefundListParams::Status)

    Filter by status

  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/dodopayments/resources/refunds.rb', line 69

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

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

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
# File 'lib/dodopayments/resources/refunds.rb', line 41

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