Class: AdvancedBilling::InvoicePayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::InvoicePayment
- Defined in:
- lib/advanced_billing/models/invoice_payment.rb
Overview
InvoicePayment Model.
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
TODO: Write general description for this method.
-
#gateway_handle ⇒ String
TODO: Write general description for this method.
-
#gateway_transaction_id ⇒ String
The transaction ID for the payment as returned from the payment gateway.
-
#gateway_used ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#original_amount ⇒ String
TODO: Write general description for this method.
-
#payment_method ⇒ InvoicePaymentMethod
TODO: Write general description for this method.
-
#prepayment ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#transaction_id ⇒ Integer
TODO: Write general description for this method.
-
#transaction_time ⇒ DateTime
TODO: Write general description for this method.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, payment_method: SKIP, transaction_id: SKIP, prepayment: SKIP, gateway_handle: SKIP, gateway_used: SKIP, gateway_transaction_id: SKIP, additional_properties: {}) ⇒ InvoicePayment
constructor
A new instance of InvoicePayment.
- #to_custom_transaction_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, payment_method: SKIP, transaction_id: SKIP, prepayment: SKIP, gateway_handle: SKIP, gateway_used: SKIP, gateway_transaction_id: SKIP, additional_properties: {}) ⇒ InvoicePayment
Returns a new instance of InvoicePayment.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 93 def initialize(transaction_time: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, payment_method: SKIP, transaction_id: SKIP, prepayment: SKIP, gateway_handle: SKIP, gateway_used: SKIP, gateway_transaction_id: SKIP, additional_properties: {}) @transaction_time = transaction_time unless transaction_time == SKIP @memo = memo unless memo == SKIP @original_amount = original_amount unless original_amount == SKIP @applied_amount = applied_amount unless applied_amount == SKIP @payment_method = payment_method unless payment_method == SKIP @transaction_id = transaction_id unless transaction_id == SKIP @prepayment = prepayment unless prepayment == SKIP @gateway_handle = gateway_handle unless gateway_handle == SKIP @gateway_used = gateway_used unless gateway_used == SKIP @gateway_transaction_id = gateway_transaction_id unless gateway_transaction_id == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#applied_amount ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 27 def applied_amount @applied_amount end |
#gateway_handle ⇒ String
TODO: Write general description for this method
43 44 45 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 43 def gateway_handle @gateway_handle end |
#gateway_transaction_id ⇒ String
The transaction ID for the payment as returned from the payment gateway
51 52 53 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 51 def gateway_transaction_id @gateway_transaction_id end |
#gateway_used ⇒ String
TODO: Write general description for this method
47 48 49 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 47 def gateway_used @gateway_used end |
#memo ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 19 def memo @memo end |
#original_amount ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 23 def original_amount @original_amount end |
#payment_method ⇒ InvoicePaymentMethod
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 31 def payment_method @payment_method end |
#prepayment ⇒ TrueClass | FalseClass
TODO: Write general description for this method
39 40 41 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 39 def prepayment @prepayment end |
#transaction_id ⇒ Integer
TODO: Write general description for this method
35 36 37 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 35 def transaction_id @transaction_id end |
#transaction_time ⇒ DateTime
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 15 def transaction_time @transaction_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 116 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_time = if hash.key?('transaction_time') (DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time']) else SKIP end memo = hash.key?('memo') ? hash['memo'] : SKIP original_amount = hash.key?('original_amount') ? hash['original_amount'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP payment_method = InvoicePaymentMethod.from_hash(hash['payment_method']) if hash['payment_method'] transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : SKIP prepayment = hash.key?('prepayment') ? hash['prepayment'] : SKIP gateway_handle = hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP gateway_used = hash.key?('gateway_used') ? hash['gateway_used'] : SKIP gateway_transaction_id = hash.key?('gateway_transaction_id') ? hash['gateway_transaction_id'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. InvoicePayment.new(transaction_time: transaction_time, memo: memo, original_amount: original_amount, applied_amount: applied_amount, payment_method: payment_method, transaction_id: transaction_id, prepayment: prepayment, gateway_handle: gateway_handle, gateway_used: gateway_used, gateway_transaction_id: gateway_transaction_id, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_time'] = 'transaction_time' @_hash['memo'] = 'memo' @_hash['original_amount'] = 'original_amount' @_hash['applied_amount'] = 'applied_amount' @_hash['payment_method'] = 'payment_method' @_hash['transaction_id'] = 'transaction_id' @_hash['prepayment'] = 'prepayment' @_hash['gateway_handle'] = 'gateway_handle' @_hash['gateway_used'] = 'gateway_used' @_hash['gateway_transaction_id'] = 'gateway_transaction_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 89 90 91 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 86 def self.nullables %w[ gateway_handle gateway_transaction_id ] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 70 def self.optionals %w[ transaction_time memo original_amount applied_amount payment_method transaction_id prepayment gateway_handle gateway_used gateway_transaction_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
164 165 166 167 168 169 170 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 164 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#to_custom_transaction_time ⇒ Object
158 159 160 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 158 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |