Class: EasyPing::Model::Charge

Inherits:
Abstract
  • Object
show all
Defined in:
lib/easy_ping/model.rb

Constant Summary collapse

ATTRIBUTES =
[:id, :object, :created, :livemode, :paid, :refunded, :app,
  :channel, :order_no, :client_ip, :amount, :amount_settle, :currency,
  :subject, :body, :extra, :time_expire, :time_settle, :transaction_no,
  :refunds, :amount_refunded, :failure_code, :failure_msg, :metadata,
  :credential, :description
]

Instance Attribute Summary

Attributes inherited from Abstract

#values

Instance Method Summary collapse

Methods inherited from Abstract

#[], #initialize

Constructor Details

This class inherits a constructor from EasyPing::Model::Abstract

Instance Method Details

#all_refund(config, *args) ⇒ Object Also known as: all_refunds, get_refund_list



178
179
180
# File 'lib/easy_ping/model.rb', line 178

def all_refund(config, *args)
  EasyPing::Refund.new(config).all(id, *args)
end

#live?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/easy_ping/model.rb', line 170

def live?
  live ? true : false
end

#refund(config, *args) ⇒ Object



174
175
176
# File 'lib/easy_ping/model.rb', line 174

def refund(config, *args)
  EasyPing::Refund.new(config).refund(*args, charge_id: id)
end

#refundsObject



166
167
168
# File 'lib/easy_ping/model.rb', line 166

def refunds
  refunded? ? @refunds['data'].map {|refund| Refund.new(refund)} : nil
end