Class: AdvancedBilling::RefundInvoiceEventData
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::RefundInvoiceEventData
- Defined in:
- lib/advanced_billing/models/refund_invoice_event_data.rb
Overview
Example schema for an ‘refund_invoice` event
Instance Attribute Summary collapse
-
#apply_credit ⇒ TrueClass | FalseClass
If true, credit was created and applied it to the invoice.
-
#consolidation_level ⇒ InvoiceConsolidationLevel
Consolidation level of the invoice, which is applicable to invoice consolidation.
-
#credit_note_attributes ⇒ CreditNote
Consolidation level of the invoice, which is applicable to invoice consolidation.
-
#memo ⇒ String
The refund memo.
-
#original_amount ⇒ String
The full, original amount of the refund.
-
#payment_id ⇒ Integer
The ID of the payment transaction to be refunded.
-
#refund_amount ⇒ String
The amount of the refund.
-
#refund_id ⇒ Integer
The ID of the refund transaction.
-
#transaction_time ⇒ DateTime
The time the refund was applied, in ISO 8601 format, i.e.
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(apply_credit = SKIP, consolidation_level = SKIP, credit_note_attributes = SKIP, memo = SKIP, original_amount = SKIP, payment_id = SKIP, refund_amount = SKIP, refund_id = SKIP, transaction_time = SKIP) ⇒ RefundInvoiceEventData
constructor
A new instance of RefundInvoiceEventData.
- #to_custom_transaction_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(apply_credit = SKIP, consolidation_level = SKIP, credit_note_attributes = SKIP, memo = SKIP, original_amount = SKIP, payment_id = SKIP, refund_amount = SKIP, refund_id = SKIP, transaction_time = SKIP) ⇒ RefundInvoiceEventData
Returns a new instance of RefundInvoiceEventData.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 107 def initialize(apply_credit = SKIP, consolidation_level = SKIP, credit_note_attributes = SKIP, memo = SKIP, original_amount = SKIP, payment_id = SKIP, refund_amount = SKIP, refund_id = SKIP, transaction_time = SKIP) @apply_credit = apply_credit unless apply_credit == SKIP @consolidation_level = consolidation_level unless consolidation_level == SKIP @credit_note_attributes = credit_note_attributes unless credit_note_attributes == SKIP @memo = memo unless memo == SKIP @original_amount = original_amount unless original_amount == SKIP @payment_id = payment_id unless payment_id == SKIP @refund_amount = refund_amount unless refund_amount == SKIP @refund_id = refund_id unless refund_id == SKIP @transaction_time = transaction_time unless transaction_time == SKIP end |
Instance Attribute Details
#apply_credit ⇒ TrueClass | FalseClass
If true, credit was created and applied it to the invoice.
15 16 17 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 15 def apply_credit @apply_credit end |
#consolidation_level ⇒ InvoiceConsolidationLevel
Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:
-
“none”: A normal invoice with no consolidation.
-
“child”: An invoice segment which has been combined into a consolidated
invoice.
-
“parent”: A consolidated invoice, whose contents are composed of invoice
segments. “Parent” invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments. See also the [invoice consolidation documentation](chargify.zendesk.com/hc/en-us/articles/440774639183 5).
30 31 32 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 30 def consolidation_level @consolidation_level end |
#credit_note_attributes ⇒ CreditNote
Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:
-
“none”: A normal invoice with no consolidation.
-
“child”: An invoice segment which has been combined into a consolidated
invoice.
-
“parent”: A consolidated invoice, whose contents are composed of invoice
segments. “Parent” invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments. See also the [invoice consolidation documentation](chargify.zendesk.com/hc/en-us/articles/440774639183 5).
45 46 47 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 45 def credit_note_attributes @credit_note_attributes end |
#memo ⇒ String
The refund memo.
49 50 51 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 49 def memo @memo end |
#original_amount ⇒ String
The full, original amount of the refund.
53 54 55 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 53 def original_amount @original_amount end |
#payment_id ⇒ Integer
The ID of the payment transaction to be refunded.
57 58 59 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 57 def payment_id @payment_id end |
#refund_amount ⇒ String
The amount of the refund.
61 62 63 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 61 def refund_amount @refund_amount end |
#refund_id ⇒ Integer
The ID of the refund transaction.
65 66 67 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 65 def refund_id @refund_id end |
#transaction_time ⇒ DateTime
The time the refund was applied, in ISO 8601 format, i.e. “2019-06-07T17:20:06Z”
70 71 72 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 70 def transaction_time @transaction_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 124 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. apply_credit = hash.key?('apply_credit') ? hash['apply_credit'] : SKIP consolidation_level = hash.key?('consolidation_level') ? hash['consolidation_level'] : SKIP credit_note_attributes = CreditNote.from_hash(hash['credit_note_attributes']) if hash['credit_note_attributes'] memo = hash.key?('memo') ? hash['memo'] : SKIP original_amount = hash.key?('original_amount') ? hash['original_amount'] : SKIP payment_id = hash.key?('payment_id') ? hash['payment_id'] : SKIP refund_amount = hash.key?('refund_amount') ? hash['refund_amount'] : SKIP refund_id = hash.key?('refund_id') ? hash['refund_id'] : SKIP transaction_time = if hash.key?('transaction_time') (DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time']) else SKIP end # Create object from extracted values. RefundInvoiceEventData.new(apply_credit, consolidation_level, credit_note_attributes, memo, original_amount, payment_id, refund_amount, refund_id, transaction_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 73 def self.names @_hash = {} if @_hash.nil? @_hash['apply_credit'] = 'apply_credit' @_hash['consolidation_level'] = 'consolidation_level' @_hash['credit_note_attributes'] = 'credit_note_attributes' @_hash['memo'] = 'memo' @_hash['original_amount'] = 'original_amount' @_hash['payment_id'] = 'payment_id' @_hash['refund_amount'] = 'refund_amount' @_hash['refund_id'] = 'refund_id' @_hash['transaction_time'] = 'transaction_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 88 def self.optionals %w[ apply_credit consolidation_level credit_note_attributes memo original_amount payment_id refund_amount refund_id transaction_time ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
163 164 165 166 167 168 169 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 163 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
157 158 159 |
# File 'lib/advanced_billing/models/refund_invoice_event_data.rb', line 157 def to_custom_transaction_time DateTimeHelper.to_rfc3339(transaction_time) end |