Class: Conekta::Charge

Inherits:
Resource show all
Includes:
Operations::Create, Operations::CustomAction, Operations::Find, Operations::Where
Defined in:
lib/conekta/charge.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Attributes inherited from ConektaObject

#values

Instance Method Summary collapse

Methods included from Operations::CustomAction

#custom_action

Methods included from Operations::Create

included

Methods included from Operations::Where

handle_type_of_paging, included

Methods included from Operations::Find

included

Methods inherited from Resource

#_url, _url, #create_member_with_relation, #initialize, underscored_class

Methods inherited from ConektaObject

#class_name, class_name, #create_attr, #first, #initialize, #inspect, #last, #load_from, #set_val, #to_s, #unset_key

Constructor Details

This class inherits a constructor from Conekta::Resource

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def amount
  @amount
end

#amount_in_foreign_currencyObject

Returns the value of attribute amount_in_foreign_currency.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def amount_in_foreign_currency
  @amount_in_foreign_currency
end

#checkout_idObject

Returns the value of attribute checkout_id.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def checkout_id
  @checkout_id
end

#checkout_order_countObject

Returns the value of attribute checkout_order_count.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def checkout_order_count
  @checkout_order_count
end

#created_atObject

Returns the value of attribute created_at.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def description
  @description
end

#device_fingerprintObject

Returns the value of attribute device_fingerprint.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def device_fingerprint
  @device_fingerprint
end

#exchange_rateObject

Returns the value of attribute exchange_rate.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def exchange_rate
  @exchange_rate
end

#failure_codeObject

Returns the value of attribute failure_code.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def failure_code
  @failure_code
end

#failure_messageObject

Returns the value of attribute failure_message.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def failure_message
  @failure_message
end

#feeObject

Returns the value of attribute fee.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def fee
  @fee
end

#foreign_currencyObject

Returns the value of attribute foreign_currency.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def foreign_currency
  @foreign_currency
end

#livemodeObject

Returns the value of attribute livemode.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def livemode
  @livemode
end

#monthly_installmentsObject

Returns the value of attribute monthly_installments.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def monthly_installments
  @monthly_installments
end

#reference_idObject

Returns the value of attribute reference_id.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def reference_id
  @reference_id
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/conekta/charge.rb', line 8

def status
  @status
end

Instance Method Details

#capture(capture_amount = nil) ⇒ Object

Usage: charge_reference.capture(2000)



15
16
17
18
# File 'lib/conekta/charge.rb', line 15

def capture(capture_amount=nil)
  params = { 'amount' => (capture_amount || self.amount) }
  custom_action(:post, 'capture', params)
end

#refund(params = nil) ⇒ Object



20
21
22
23
# File 'lib/conekta/charge.rb', line 20

def refund(params=nil)
  params = { 'amount' => (params || self.amount) }
  custom_action(:post, 'refund', params)
end