Class: PagarMe::Transaction

Inherits:
TransactionCommon show all
Defined in:
lib/pagarme/resources/transaction.rb

Constant Summary

Constants inherited from PagarMeObject

PagarMeObject::RESOURCES

Instance Attribute Summary

Attributes inherited from PagarMeObject

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TransactionCommon

#create, #initialize, #save

Methods inherited from Model

all, class_name, #create, create, extract_page_count_or_params, find_by, find_by_id, #save, underscored_class_name, url, #url

Methods inherited from PagarMeObject

#==, #[]=, convert, #empty?, #initialize, #respond_to?, #to_hash, #to_s, #unsaved_attributes

Constructor Details

This class inherits a constructor from PagarMe::TransactionCommon

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PagarMe::PagarMeObject

Class Method Details

.calculate_installments(params) ⇒ Object



44
45
46
# File 'lib/pagarme/resources/transaction.rb', line 44

def calculate_installments(params)
  PagarMe::Request.get(url('calculate_installments_amount'), query: params).run
end

.generate_card_hashObject

Raises:



48
49
50
51
# File 'lib/pagarme/resources/transaction.rb', line 48

def generate_card_hash
  raise RequestError.new('Invalid Encryption Key') if PagarMe.encryption_key.blank?
  PagarMe::Request.get(url('card_hash_key'), params: { encryption_key: PagarMe.encryption_key }).call
end

Instance Method Details

#antifraud_analysesObject



9
10
11
# File 'lib/pagarme/resources/transaction.rb', line 9

def antifraud_analyses
  PagarMe::Request.get( url 'antifraud_analyses' ).call
end

#capture(params = {}) ⇒ Object



33
34
35
# File 'lib/pagarme/resources/transaction.rb', line 33

def capture(params={})
  update PagarMe::Request.post(url('capture'), params: params).run
end

#collect_payment(params = {}) ⇒ Object



29
30
31
# File 'lib/pagarme/resources/transaction.rb', line 29

def collect_payment(params={})
  PagarMe::Request.post(url('collect_payment'), params: params).run
end

#eventsObject



25
26
27
# File 'lib/pagarme/resources/transaction.rb', line 25

def events
  PagarMe::Request.get( url 'events' ).call
end

#operationsObject



21
22
23
# File 'lib/pagarme/resources/transaction.rb', line 21

def operations
  PagarMe::Request.get( url 'operations' ).call
end

#payablesObject



13
14
15
# File 'lib/pagarme/resources/transaction.rb', line 13

def payables
  PagarMe::Request.get( url 'payables' ).call
end

#postbacksObject



17
18
19
# File 'lib/pagarme/resources/transaction.rb', line 17

def postbacks
  PagarMe::Request.get( url 'postbacks' ).call
end

#refund(params = {}) ⇒ Object



37
38
39
# File 'lib/pagarme/resources/transaction.rb', line 37

def refund(params={})
  update PagarMe::Request.post(url('refund'), params: params).run
end

#split_rulesObject



5
6
7
# File 'lib/pagarme/resources/transaction.rb', line 5

def split_rules
  PagarMe::Request.get( url 'split_rules' ).call
end