Sha256: 1661dcbcd5b4eb75fa9646e983bf3e6cfdd75a075ec73f19cbc0497f1e5683c8

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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