Class: MaxipagoApi::TransactionModel
- Inherits:
-
Object
- Object
- MaxipagoApi::TransactionModel
- Defined in:
- lib/maxipago_api/models/transaction_model.rb
Instance Attribute Summary collapse
-
#charge_total ⇒ Object
Returns the value of attribute charge_total.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#processor_id ⇒ Object
Returns the value of attribute processor_id.
-
#reference_number ⇒ Object
Returns the value of attribute reference_number.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(options = {}) ⇒ TransactionModel
constructor
A new instance of TransactionModel.
- #save ⇒ Object
- #to_object ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TransactionModel
Returns a new instance of TransactionModel.
5 6 7 8 9 10 11 12 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 5 def initialize( = {}) self.customer_id = [:customer_id] self.processor_id = [:processor_id] self.token = [:token] self.ip_address = [:ip_address] self.reference_number = [:reference_number] self.charge_total = [:charge_total] end |
Instance Attribute Details
#charge_total ⇒ Object
Returns the value of attribute charge_total.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def charge_total @charge_total end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def customer_id @customer_id end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def ip_address @ip_address end |
#processor_id ⇒ Object
Returns the value of attribute processor_id.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def processor_id @processor_id end |
#reference_number ⇒ Object
Returns the value of attribute reference_number.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def reference_number @reference_number end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 4 def token @token end |
Instance Method Details
#find ⇒ Object
18 19 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 18 def find end |
#save ⇒ Object
14 15 16 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 14 def save MaxipagoApi::TransactionRequest.create(self) end |
#to_object ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/maxipago_api/models/transaction_model.rb', line 21 def to_object { sale: { processorID: self.processor_id, referenceNum: self.reference_number, transactionDetail: { payType: { onFile: { customerId: self.customer_id, token: self.token, }, } }, payment: { currencyCode: 'BRL', chargeTotal: self.charge_total } } }.select{|k,v| v.present?} end |