Class: SixSaferpay::Transaction
- Inherits:
-
Object
- Object
- SixSaferpay::Transaction
- Defined in:
- lib/six_saferpay/models/transaction.rb
Instance Attribute Summary collapse
-
#acquirer_name ⇒ Object
Returns the value of attribute acquirer_name.
-
#acquirer_reference ⇒ Object
Returns the value of attribute acquirer_reference.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#approval_code ⇒ Object
Returns the value of attribute approval_code.
-
#capture_id ⇒ Object
Returns the value of attribute capture_id.
-
#date ⇒ Object
Returns the value of attribute date.
-
#direct_debit ⇒ Object
Returns the value of attribute direct_debit.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invoice ⇒ Object
Returns the value of attribute invoice.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#six_transaction_reference ⇒ Object
Returns the value of attribute six_transaction_reference.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, status:, id:, capture_id: nil, date:, amount:, order_id: nil, acquirer_name: nil, acquirer_reference: nil, six_transaction_reference:, approval_code: nil, direct_debit: nil, invoice: nil) ⇒ Transaction
constructor
A new instance of Transaction.
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(type:, status:, id:, capture_id: nil, date:, amount:, order_id: nil, acquirer_name: nil, acquirer_reference: nil, six_transaction_reference:, approval_code: nil, direct_debit: nil, invoice: nil) ⇒ Transaction
Returns a new instance of Transaction.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/six_saferpay/models/transaction.rb', line 20 def initialize(type:, status:, id:, capture_id: nil, date:, amount:, order_id: nil, acquirer_name: nil, acquirer_reference: nil, six_transaction_reference:, approval_code: nil, direct_debit: nil, invoice: nil ) @type = type @status = status @id = id @capture_id = capture_id @date = date @amount = SixSaferpay::Amount.new(**amount.to_h) @order_id = order_id @acquirer_name = acquirer_name @acquirer_reference = acquirer_reference @six_transaction_reference = six_transaction_reference @approval_code = approval_code @direct_debit = SixSaferpay::DirectDebit.new(**direct_debit.to_h) if direct_debit @invoice = SixSaferpay::Invoice.new(**invoice.to_h) if invoice end |
Instance Attribute Details
#acquirer_name ⇒ Object
Returns the value of attribute acquirer_name.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def acquirer_name @acquirer_name end |
#acquirer_reference ⇒ Object
Returns the value of attribute acquirer_reference.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def acquirer_reference @acquirer_reference end |
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def amount @amount end |
#approval_code ⇒ Object
Returns the value of attribute approval_code.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def approval_code @approval_code end |
#capture_id ⇒ Object
Returns the value of attribute capture_id.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def capture_id @capture_id end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def date @date end |
#direct_debit ⇒ Object
Returns the value of attribute direct_debit.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def direct_debit @direct_debit end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def id @id end |
#invoice ⇒ Object
Returns the value of attribute invoice.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def invoice @invoice end |
#order_id ⇒ Object
Returns the value of attribute order_id.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def order_id @order_id end |
#six_transaction_reference ⇒ Object
Returns the value of attribute six_transaction_reference.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def six_transaction_reference @six_transaction_reference end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/six_saferpay/models/transaction.rb', line 4 def type @type end |
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/six_saferpay/models/transaction.rb', line 49 def to_hash hash = Hash.new hash.merge!(type: @type) hash.merge!(status: @status) hash.merge!(id: @id) hash.merge!(capture_id: @capture_id) if @capture_id hash.merge!(date: @date) hash.merge!(amount: @amount.to_h) hash.merge!(order_id: @order_id) if @order_id hash.merge!(acquirer_name: @acquirer_name) if @acquirer_name hash.merge!(acquirer_reference: @acquirer_reference) if @acquirer_reference hash.merge!(six_transaction_reference: @six_transaction_reference) hash.merge!(approval_code: @approval_code) if @approval_code hash.merge!(direct_debit: @direct_debit.to_h) if @direct_debit hash.merge!(invoice: @invoice.to_h) if @invoice hash end |