Sha256: c4330ce3f5d77949eb2edebba456e844603482e81a452e56a5b3f3c8ffbfc8d3

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
razorpay-2.2.0 lib/razorpay/payment.rb
razorpay-2.1.0 lib/razorpay/payment.rb
razorpay-2.1.0.pre lib/razorpay/payment.rb