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



180
181
182
# File 'lib/easy_ping/model.rb', line 180

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

#live?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/easy_ping/model.rb', line 172

def live?
  live ? true : false
end

#refund(config, *args) ⇒ Object



176
177
178
# File 'lib/easy_ping/model.rb', line 176

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

#refundsObject



168
169
170
# File 'lib/easy_ping/model.rb', line 168

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