Sha256: 4ad41f9925467b16e0c227b6b214bfbdf016bb89284a252651c3dc2f67d60b8f

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

module ChargeBee
  class Transaction < Model

    class LinkedInvoice < Model
      attr_accessor :invoice_id, :applied_amount, :invoice_date, :invoice_amount
    end

  attr_accessor :id, :customer_id, :subscription_id, :payment_method, :reference_number, :gateway,
  :description, :type, :date, :amount, :id_at_gateway, :status, :error_code, :error_text, :voided_at,
  :void_description, :masked_card_number, :refunded_txn_id, :linked_invoices

  # OPERATIONS
  #-----------

  def self.list(params={}, env=nil)
    Request.send('get', uri_path("transactions"), params, env)
  end

  def self.transactions_for_customer(id, params={}, env=nil)
    Request.send('get', uri_path("customers",id.to_s,"transactions"), params, env)
  end

  def self.transactions_for_subscription(id, params={}, env=nil)
    Request.send('get', uri_path("subscriptions",id.to_s,"transactions"), params, env)
  end

  def self.transactions_for_invoice(id, params={}, env=nil)
    Request.send('get', uri_path("invoices",id.to_s,"transactions"), params, env)
  end

  def self.retrieve(id, env=nil)
    Request.send('get', uri_path("transactions",id.to_s), {}, env)
  end

  def self.record_payment(id, params, env=nil)
    Request.send('post', uri_path("invoices",id.to_s,"record_payment"), params, env)
  end

  def self.refund(id, params={}, env=nil)
    Request.send('post', uri_path("transactions",id.to_s,"refund"), params, env)
  end

  end # ~Transaction
end # ~ChargeBee

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chargebee-1.4.3 lib/chargebee/models/transaction.rb
chargebee-1.4.2 lib/chargebee/models/transaction.rb