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.
-
#received_on ⇒ Date
Date reflecting when the payment was received from a customer.
-
#transaction_id ⇒ Integer
TODO: Write general description for this method.
-
#transaction_time ⇒ DateTime
TODO: Write general description for this method.
-
#uid ⇒ String
Date reflecting when the payment was received from a customer.
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, received_on: SKIP, uid: SKIP, additional_properties: {}) ⇒ InvoicePayment
constructor
A new instance of InvoicePayment.
- #to_custom_transaction_time ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
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, received_on: SKIP, uid: SKIP, additional_properties: {}) ⇒ InvoicePayment
Returns a new instance of InvoicePayment.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 110 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, received_on: SKIP, uid: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @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 @received_on = received_on unless received_on == SKIP @uid = uid unless uid == SKIP 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 |
#received_on ⇒ Date
Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to ‘external` payments.
57 58 59 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 57 def received_on @received_on 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 |
#uid ⇒ String
Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to ‘external` payments.
63 64 65 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 63 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 135 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 received_on = hash.key?('received_on') ? hash['received_on'] : SKIP uid = hash.key?('uid') ? hash['uid'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(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, received_on: received_on, uid: uid, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 66 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['received_on'] = 'received_on' @_hash['uid'] = 'uid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
102 103 104 105 106 107 108 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 102 def self.nullables %w[ gateway_handle gateway_transaction_id received_on ] end |
.optionals ⇒ Object
An array for optional fields
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 84 def self.optionals %w[ transaction_time memo original_amount applied_amount payment_method transaction_id prepayment gateway_handle gateway_used gateway_transaction_id received_on uid ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
187 188 189 190 191 192 193 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 187 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
181 182 183 |
# File 'lib/advanced_billing/models/invoice_payment.rb', line 181 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |