Sha256: 04177a77c7ba88634befb29181629efd02c9a8d423760aaf408a3f06491ab40c

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

require 'uri'
require 'net/http'
require 'json'

module Khalti
  # Khalti Transaction API wrapper
  class Transaction
    API_URL = 'https://khalti.com/api/merchant-transaction'
    def self.find(idx)
      raise Errors::BlankError, 'Ensure idx is not blank.' \
        if idx.nil? || idx.strip.empty?
      RequestHelper.get("#{API_URL}/#{idx}/")
    end

    def self.all
      RequestHelper.get("#{API_URL}/")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
khalti-0.2.1 lib/khalti/transaction.rb
khalti-0.2.0 lib/khalti/transaction.rb