Sha256: fd962e47dc0d765a587c46d408039312c014f4ebdb588974e17a61fdc00eaacb

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

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

module Razorpay
  # Order API allows you to associate
  # Payments with an order entity
  class Order < Entity
    def self.request
      Razorpay::Request.new('orders')
    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 payments(options = {})
      r = self.class.request
      r.request :get, "/v1/orders/#{id}/payments", options
    end
    
    def self.edit(id, options = {})
      request.patch id, options
    end
    
    def self.fetch_transfer_order(id)
      # Fetch Transfer for an Order
      # Docs: https://razorpay.com/docs/api/payments/route/#fetch-transfer-for-an-order
      request.get "#{id}/?expand[]=transfers&status"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
razorpay-3.2.2 lib/razorpay/order.rb
razorpay-3.2.1 lib/razorpay/order.rb
razorpay-3.2.0 lib/razorpay/order.rb
razorpay-3.1.0 lib/razorpay/order.rb