Sha256: 1996cf2412043cfd08b0f362ae743ee12dc937c5b326c251ea93174987da5330

Contents?: true

Size: 708 Bytes

Versions: 10

Compression:

Stored size: 708 Bytes

Contents

module Paddle
  module Classic
    class PaymentsResource < Resource

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

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

      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

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
paddle-2.2.0 lib/paddle/classic/resources/payments.rb
paddle-2.1.4 lib/paddle/classic/resources/payments.rb
paddle-2.1.3 lib/paddle/classic/resources/payments.rb
paddle-2.1.2 lib/paddle/classic/resources/payments.rb
paddle-2.1.1 lib/paddle/classic/resources/payments.rb
paddle-2.1.0 lib/paddle/classic/resources/payments.rb
paddle-2.0.0 lib/paddle/classic/resources/payments.rb
paddle-1.1.2 lib/paddle/classic/resources/payments.rb
paddle-1.1.1 lib/paddle/classic/resources/payments.rb
paddle-1.1.0 lib/paddle/classic/resources/payments.rb