Class: Plaid::PaymentInitiationRefund
- Defined in:
- lib/plaid/models/payment_initiation_refund.rb
Overview
PaymentInitiationRefund defines a payment initiation refund
Instance Attribute Summary collapse
-
#amount ⇒ PaymentAmount
The amount and currency of a payment.
-
#last_status_update ⇒ DateTime
The date and time of the last time the ‘status` was updated, in IS0 8601 format.
-
#refund_id ⇒ String
The ID of the refund.
-
#status ⇒ Status2
The status of the refund.
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.
Instance Method Summary collapse
-
#initialize(refund_id:, amount:, status:, last_status_update:, additional_properties: nil) ⇒ PaymentInitiationRefund
constructor
A new instance of PaymentInitiationRefund.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_status_update ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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(refund_id:, amount:, status:, last_status_update:, additional_properties: nil) ⇒ PaymentInitiationRefund
Returns a new instance of PaymentInitiationRefund.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 57 def initialize(refund_id:, amount:, status:, last_status_update:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @refund_id = refund_id @amount = amount @status = status @last_status_update = last_status_update @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ PaymentAmount
The amount and currency of a payment
20 21 22 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 20 def amount @amount end |
#last_status_update ⇒ DateTime
The date and time of the last time the ‘status` was updated, in IS0 8601 format
35 36 37 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 35 def last_status_update @last_status_update end |
#refund_id ⇒ String
The ID of the refund. Like all Plaid identifiers, the ‘refund_id` is case sensitive.
16 17 18 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 16 def refund_id @refund_id end |
#status ⇒ Status2
The status of the refund. ‘PROCESSING`: The refund is currently being processed. The refund will automatically exit this state when processing is complete. `INITIATED`: The refund has been successfully initiated. `EXECUTED`: Indicates that the refund has been successfully executed. `FAILED`: The refund has failed to be executed. This error is retryable once the root cause is resolved.
30 31 32 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 30 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. refund_id = hash.key?('refund_id') ? hash['refund_id'] : nil amount = PaymentAmount.from_hash(hash['amount']) if hash['amount'] status = hash.key?('status') ? hash['status'] : nil last_status_update = if hash.key?('last_status_update') (DateTimeHelper.from_rfc3339(hash['last_status_update']) if hash['last_status_update']) end # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. PaymentInitiationRefund.new(refund_id: refund_id, amount: amount, status: status, last_status_update: last_status_update, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['refund_id'] = 'refund_id' @_hash['amount'] = 'amount' @_hash['status'] = 'status' @_hash['last_status_update'] = 'last_status_update' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 48 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} refund_id: #{@refund_id.inspect}, amount: #{@amount.inspect}, status:"\ " #{@status.inspect}, last_status_update: #{@last_status_update.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_last_status_update ⇒ Object
96 97 98 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 96 def to_custom_last_status_update DateTimeHelper.to_rfc3339(last_status_update) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
101 102 103 104 105 106 |
# File 'lib/plaid/models/payment_initiation_refund.rb', line 101 def to_s class_name = self.class.name.split('::').last "<#{class_name} refund_id: #{@refund_id}, amount: #{@amount}, status: #{@status},"\ " last_status_update: #{@last_status_update}, additional_properties:"\ " #{@additional_properties}>" end |