Class: Yookassa::Refunds

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

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Refunds

Returns a new instance of Refunds.



7
8
9
# File 'lib/yookassa/refunds.rb', line 7

def initialize(api)
  @api = api
end

Instance Method Details

#create(payload:, idempotency_key: SecureRandom.hex(10)) ⇒ Object



16
17
18
19
# File 'lib/yookassa/refunds.rb', line 16

def create(payload:, idempotency_key: SecureRandom.hex(10))
  data = api.post("refunds", payload: payload, idempotency_key: idempotency_key)
  Entity::Refund.new(**data.merge(idempotency_key: idempotency_key))
end

#find(payment_id:) ⇒ Object



11
12
13
14
# File 'lib/yookassa/refunds.rb', line 11

def find(payment_id:)
  data = api.get("refunds/#{payment_id}")
  Entity::Refund.new(**data)
end