Sha256: 09b22026afe19780c240d2219f302aab4da21b08358f369cdea09b9c90f19bc0

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 Bytes

Contents

require 'razorpay/request'
require 'razorpay/refund'
require 'razorpay/entity'

module Razorpay
  # Payment class is the most commonly used class
  # and is used to interact with Payments, the most
  # common type of transactions
  class Payment < Entity
    def self.request
      Razorpay::Request.new('payments')
    end

    def self.fetch(id)
      request.fetch id
    end

    def self.all(options = {})
      request.all options
    end

    def self.capture(id, options)
      request.post "#{id}/capture", options
    end

    def refund(options = {})
      self.class.request.post "#{id}/refund", options
    end

    def capture(options)
      self.class.request.post "#{id}/capture", options
    end

    def refunds
      self.class.request.get "#{id}/refunds"
    end

    def method
      method_missing(:method)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
razorpay-2.0.1 lib/razorpay/payment.rb
razorpay-2.0.0 lib/razorpay/payment.rb