Class: AdvancedBilling::InvoiceRefund
- Defined in:
- lib/advanced_billing/models/invoice_refund.rb
Overview
InvoiceRefund Model.
Instance Attribute Summary collapse
-
#ach_late_reject ⇒ TrueClass | FalseClass
The transaction ID for the refund as returned from the payment gateway.
-
#applied_amount ⇒ String
TODO: Write general description for this method.
-
#gateway_handle ⇒ String
The transaction ID for the refund as returned from the payment gateway.
-
#gateway_transaction_id ⇒ String
The transaction ID for the refund as returned from the payment gateway.
-
#gateway_used ⇒ String
The transaction ID for the refund as returned from the payment gateway.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#original_amount ⇒ String
TODO: Write general description for this method.
-
#payment_id ⇒ Integer
TODO: Write general description for this method.
-
#transaction_id ⇒ Integer
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_id: SKIP, payment_id: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, gateway_transaction_id: SKIP, gateway_used: SKIP, gateway_handle: SKIP, ach_late_reject: SKIP, additional_properties: {}) ⇒ InvoiceRefund
constructor
A new instance of InvoiceRefund.
Methods inherited from BaseModel
Constructor Details
#initialize(transaction_id: SKIP, payment_id: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, gateway_transaction_id: SKIP, gateway_used: SKIP, gateway_handle: SKIP, ach_late_reject: SKIP, additional_properties: {}) ⇒ InvoiceRefund
Returns a new instance of InvoiceRefund.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 87 def initialize(transaction_id: SKIP, payment_id: SKIP, memo: SKIP, original_amount: SKIP, applied_amount: SKIP, gateway_transaction_id: SKIP, gateway_used: SKIP, gateway_handle: SKIP, ach_late_reject: SKIP, additional_properties: {}) @transaction_id = transaction_id unless transaction_id == SKIP @payment_id = payment_id unless payment_id == SKIP @memo = memo unless memo == SKIP @original_amount = original_amount unless original_amount == SKIP @applied_amount = applied_amount unless applied_amount == SKIP @gateway_transaction_id = gateway_transaction_id unless gateway_transaction_id == SKIP @gateway_used = gateway_used unless gateway_used == SKIP @gateway_handle = gateway_handle unless gateway_handle == SKIP @ach_late_reject = ach_late_reject unless ach_late_reject == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#ach_late_reject ⇒ TrueClass | FalseClass
The transaction ID for the refund as returned from the payment gateway
46 47 48 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 46 def ach_late_reject @ach_late_reject end |
#applied_amount ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 30 def applied_amount @applied_amount end |
#gateway_handle ⇒ String
The transaction ID for the refund as returned from the payment gateway
42 43 44 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 42 def gateway_handle @gateway_handle end |
#gateway_transaction_id ⇒ String
The transaction ID for the refund as returned from the payment gateway
34 35 36 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 34 def gateway_transaction_id @gateway_transaction_id end |
#gateway_used ⇒ String
The transaction ID for the refund as returned from the payment gateway
38 39 40 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 38 def gateway_used @gateway_used end |
#memo ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 22 def memo @memo end |
#original_amount ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 26 def original_amount @original_amount end |
#payment_id ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 18 def payment_id @payment_id end |
#transaction_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 14 def transaction_id @transaction_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
109 110 111 112 113 114 115 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 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 109 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : SKIP payment_id = hash.key?('payment_id') ? hash['payment_id'] : SKIP 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 gateway_transaction_id = hash.key?('gateway_transaction_id') ? hash['gateway_transaction_id'] : SKIP gateway_used = hash.key?('gateway_used') ? hash['gateway_used'] : SKIP gateway_handle = hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP ach_late_reject = hash.key?('ach_late_reject') ? hash['ach_late_reject'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. InvoiceRefund.new(transaction_id: transaction_id, payment_id: payment_id, memo: memo, original_amount: original_amount, applied_amount: applied_amount, gateway_transaction_id: gateway_transaction_id, gateway_used: gateway_used, gateway_handle: gateway_handle, ach_late_reject: ach_late_reject, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_id'] = 'transaction_id' @_hash['payment_id'] = 'payment_id' @_hash['memo'] = 'memo' @_hash['original_amount'] = 'original_amount' @_hash['applied_amount'] = 'applied_amount' @_hash['gateway_transaction_id'] = 'gateway_transaction_id' @_hash['gateway_used'] = 'gateway_used' @_hash['gateway_handle'] = 'gateway_handle' @_hash['ach_late_reject'] = 'ach_late_reject' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 82 83 84 85 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 79 def self.nullables %w[ gateway_transaction_id gateway_handle ach_late_reject ] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 64 def self.optionals %w[ transaction_id payment_id memo original_amount applied_amount gateway_transaction_id gateway_used gateway_handle ach_late_reject ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
147 148 149 150 151 152 153 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 147 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |