Sha256: ea3a767421f0560a2d0cd5fb8cb30583e62d133fef293ec464fe223259f7d669

Contents?: true

Size: 800 Bytes

Versions: 1

Compression:

Stored size: 800 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 refund(options = {})
      self.class.request.post "#{id}/refund", options
    end

    def refunds
      # This needs to be a string, not a symbol
      Refund.new('payment_id' => id)
    end

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

    def method
      method_missing(:method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
razorpay-1.2.1 lib/razorpay/payment.rb