Class: Paddle::Classic::PaymentsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/paddle/classic/resources/payments.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Paddle::Classic::Resource

Instance Method Details

#list(**params) ⇒ Object



4
5
6
7
# File 'lib/paddle/classic/resources/payments.rb', line 4

def list(**params)
  response = post_request("2.0/subscription/payments", body: params)
  Collection.from_response(response, type: Payment)
end

#refund(order_id:, **params) ⇒ Object



15
16
17
18
19
# File 'lib/paddle/classic/resources/payments.rb', line 15

def refund(order_id:, **params)
  attrs = { order_id: order_id }
  response = post_request("2.0/payment/refund", body: attrs.merge(params))
  PaymentRefund.new(response.body["response"])
end

#reschedule(payment_id:, date:) ⇒ Object



9
10
11
12
13
# File 'lib/paddle/classic/resources/payments.rb', line 9

def reschedule(payment_id:, date:)
  attrs = { payment_id: payment_id, date: date }
  response = post_request("2.0/subscription/payments_reschedule", body: attrs)
  true if response.success?
end