Class: PaymentsApi::Payment
- Defined in:
- lib/payments_api/models/payment.rb
Overview
Payment Information Object
Instance Attribute Summary collapse
-
#beneficiary ⇒ Beneficiary
Beneficiary Information Object.
-
#beneficiary_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment.
-
#details ⇒ PaymentDetails
Payment Information Data.
-
#id ⇒ Integer
Payment ID.
-
#intermediary_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment.
-
#originator ⇒ Originator
Originator Information Object.
-
#originator_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment.
-
#quote_id ⇒ Integer
Quote ID.
-
#status ⇒ PaymentStatus
Payment Information Data.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(quote_id = nil, originator = nil, beneficiary = nil, beneficiary_bank_account = nil, details = nil, id = nil, originator_bank_account = nil, intermediary_bank_account = nil, status = nil) ⇒ Payment
constructor
A new instance of Payment.
Methods inherited from BaseModel
Constructor Details
#initialize(quote_id = nil, originator = nil, beneficiary = nil, beneficiary_bank_account = nil, details = nil, id = nil, originator_bank_account = nil, intermediary_bank_account = nil, status = nil) ⇒ Payment
Returns a new instance of Payment.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/payments_api/models/payment.rb', line 72 def initialize(quote_id = nil, originator = nil, beneficiary = nil, beneficiary_bank_account = nil, details = nil, id = nil, originator_bank_account = nil, intermediary_bank_account = nil, status = nil) @id = id @quote_id = quote_id @originator = originator @originator_bank_account = originator_bank_account @beneficiary = beneficiary @beneficiary_bank_account = beneficiary_bank_account @intermediary_bank_account = intermediary_bank_account @details = details @status = status end |
Instance Attribute Details
#beneficiary ⇒ Beneficiary
Beneficiary Information Object
31 32 33 |
# File 'lib/payments_api/models/payment.rb', line 31 def beneficiary @beneficiary end |
#beneficiary_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment. This information is retrieved from the database based on the provided bank ID.NOTE - bank object is required for all BankAccount objects except originatorBankAccount
39 40 41 |
# File 'lib/payments_api/models/payment.rb', line 39 def beneficiary_bank_account @beneficiary_bank_account end |
#details ⇒ PaymentDetails
Payment Information Data
51 52 53 |
# File 'lib/payments_api/models/payment.rb', line 51 def details @details end |
#id ⇒ Integer
Payment ID
11 12 13 |
# File 'lib/payments_api/models/payment.rb', line 11 def id @id end |
#intermediary_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment. This information is retrieved from the database based on the provided bank ID.NOTE - bank object is required for all BankAccount objects except originatorBankAccount
47 48 49 |
# File 'lib/payments_api/models/payment.rb', line 47 def intermediary_bank_account @intermediary_bank_account end |
#originator ⇒ Originator
Originator Information Object
19 20 21 |
# File 'lib/payments_api/models/payment.rb', line 19 def originator @originator end |
#originator_bank_account ⇒ BankAccount
Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment. This information is retrieved from the database based on the provided bank ID.NOTE - bank object is required for all BankAccount objects except originatorBankAccount
27 28 29 |
# File 'lib/payments_api/models/payment.rb', line 27 def originator_bank_account @originator_bank_account end |
#quote_id ⇒ Integer
Quote ID
15 16 17 |
# File 'lib/payments_api/models/payment.rb', line 15 def quote_id @quote_id end |
#status ⇒ PaymentStatus
Payment Information Data
55 56 57 |
# File 'lib/payments_api/models/payment.rb', line 55 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/payments_api/models/payment.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. quote_id = hash['quoteId'] originator = Originator.from_hash(hash['originator']) if hash['originator'] beneficiary = Beneficiary.from_hash(hash['beneficiary']) if hash['beneficiary'] if hash['beneficiaryBankAccount'] beneficiary_bank_account = BankAccount.from_hash(hash['beneficiaryBankAccount']) end details = PaymentDetails.from_hash(hash['details']) if hash['details'] id = hash['id'] if hash['originatorBankAccount'] originator_bank_account = BankAccount.from_hash(hash['originatorBankAccount']) end if hash['intermediaryBankAccount'] intermediary_bank_account = BankAccount.from_hash(hash['intermediaryBankAccount']) end status = PaymentStatus.from_hash(hash['status']) if hash['status'] # Create object from extracted values. Payment.new(quote_id, originator, beneficiary, beneficiary_bank_account, details, id, originator_bank_account, intermediary_bank_account, status) end |
.names ⇒ Object
A mapping from model property names to API property names.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/payments_api/models/payment.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['quote_id'] = 'quoteId' @_hash['originator'] = 'originator' @_hash['originator_bank_account'] = 'originatorBankAccount' @_hash['beneficiary'] = 'beneficiary' @_hash['beneficiary_bank_account'] = 'beneficiaryBankAccount' @_hash['intermediary_bank_account'] = 'intermediaryBankAccount' @_hash['details'] = 'details' @_hash['status'] = 'status' @_hash end |