Sha256: a651a47a9ed13a3873cc99d9fe9db8d2b04d757c204f7d837db47dc2cda21fd3

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

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

module Razorpay
  # Invoice API allows you to create and
  # manage invoices with Razorpay
  class Invoice < Entity
    def self.request
      Razorpay::Request.new('invoices')
    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.edit(id, options = {})
      request.patch id, options
    end

    def self.issue(id)
      request.post "#{id}/issue"
    end

    def self.cancel(id)
      request.post "#{id}/cancel"
    end

    def edit(options = {})
      self.class.edit id, options
    end

    def edit!(options = {})
      with_a_bang { edit options }
    end

    def issue
      self.class.issue id
    end

    def issue!
      with_a_bang { issue }
    end

    def cancel
      self.class.cancel id
    end

    def cancel!
      with_a_bang { cancel }
    end

    def self.notify_by(id, medium)
      request.post "#{id}/notify_by/#{medium}"
    end
    
    def self.delete(id)
      request.delete "#{id}" 
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
razorpay-3.2.2 lib/razorpay/invoice.rb
razorpay-3.2.1 lib/razorpay/invoice.rb
razorpay-3.2.0 lib/razorpay/invoice.rb
razorpay-3.1.0 lib/razorpay/invoice.rb
razorpay-3.0.1 lib/razorpay/invoice.rb
razorruby-3.0.4 lib/razorpay/invoice.rb
razorruby-3.0.1 lib/razorpay/invoice.rb
razorpay-3.0.0 lib/razorpay/invoice.rb