Sha256: 2e36b770903b9623db48993274c4184f6fb6aa59c02b58be026681a91108cdf2

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

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

module Razorpay
  # Virtual Account API allows you to create and
  # manage virtual accounts with Razorpay
  class VirtualAccount < Entity
    def self.request
      Razorpay::Request.new('virtual_accounts')
    end

    def self.create(options)
      request.create options
    end

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

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

    def self.close(id)
      request.patch id, status: 'closed'
    end

    def close
      self.class.request.patch id, status: 'closed'
    end

    def close!
      with_a_bang { close }
    end

    def payments(options = {})
      r = self.class.request
      r.request :get, "/virtual_accounts/#{id}/payments", options
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
razorpay-2.4.1 lib/razorpay/virtual_account.rb
razorpay-2.4.0 lib/razorpay/virtual_account.rb
razorpay-2.3.0 lib/razorpay/virtual_account.rb