Class: UnivapayClientSdk::BankTransferStatusData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/bank_transfer_status_data.rb

Overview

Data payload for bank_transfer_status_updated webhook events. Contains the bank transfer extension fields inlined alongside amount and metadata.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id: SKIP, charge_id: SKIP, payment_status: SKIP, latest_deposit_date: SKIP, created_on: SKIP, latest_deposit_amount: SKIP, balance: SKIP, currency: SKIP, amount: SKIP, amount_difference: SKIP, token_metadata: SKIP, charge_metadata: SKIP, additional_properties: nil) ⇒ BankTransferStatusData

Returns a new instance of BankTransferStatusData.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 111

def initialize(id: SKIP, charge_id: SKIP, payment_status: SKIP,
               latest_deposit_date: SKIP, created_on: SKIP,
               latest_deposit_amount: SKIP, balance: SKIP, currency: SKIP,
               amount: SKIP, amount_difference: SKIP, token_metadata: SKIP,
               charge_metadata: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @charge_id = charge_id unless charge_id == SKIP
  @payment_status = payment_status unless payment_status == SKIP
  @latest_deposit_date = latest_deposit_date unless latest_deposit_date == SKIP
  @created_on = created_on unless created_on == SKIP
  @latest_deposit_amount = latest_deposit_amount unless latest_deposit_amount == SKIP
  @balance = balance unless balance == SKIP
  @currency = currency unless currency == SKIP
  @amount = amount unless amount == SKIP
  @amount_difference = amount_difference unless amount_difference == SKIP
  @token_metadata =  unless  == SKIP
  @charge_metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Total charge amount in minor currency units.

Returns:

  • (Integer)


48
49
50
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 48

def amount
  @amount
end

#amount_differenceInteger

Difference between paid and expected amount (positive = over, negative = under).

Returns:

  • (Integer)


53
54
55
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 53

def amount_difference
  @amount_difference
end

#balanceInteger

Current outstanding balance in minor currency units.

Returns:

  • (Integer)


40
41
42
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 40

def balance
  @balance
end

#charge_idUUID | String

ID of the associated charge.

Returns:

  • (UUID | String)


20
21
22
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 20

def charge_id
  @charge_id
end

#charge_metadataGenericMetadata

A free-form dictionary for custom metadata.

Returns:



61
62
63
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 61

def 
  @charge_metadata
end

#created_onDateTime

When the bank transfer extension record was created.

Returns:

  • (DateTime)


32
33
34
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 32

def created_on
  @created_on
end

#currencyString

ISO 4217 currency code.

Returns:

  • (String)


44
45
46
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 44

def currency
  @currency
end

#idUUID | String

Bank transfer charge extension ID.

Returns:

  • (UUID | String)


16
17
18
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 16

def id
  @id
end

#latest_deposit_amountInteger

Amount of the most recent deposit in minor currency units.

Returns:

  • (Integer)


36
37
38
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 36

def latest_deposit_amount
  @latest_deposit_amount
end

#latest_deposit_dateDateTime

Date of the most recent deposit.

Returns:

  • (DateTime)


28
29
30
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 28

def latest_deposit_date
  @latest_deposit_date
end

#payment_statusBankTransferPaymentStatus

Payment status of a bank transfer charge.



24
25
26
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 24

def payment_status
  @payment_status
end

#token_metadataGenericMetadata

A free-form dictionary for custom metadata.

Returns:



57
58
59
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 57

def 
  @token_metadata
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
180
181
182
183
184
185
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 135

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  charge_id = hash.key?('charge_id') ? hash['charge_id'] : SKIP
  payment_status =
    hash.key?('payment_status') ? hash['payment_status'] : SKIP
  latest_deposit_date = if hash.key?('latest_deposit_date')
                          (DateTimeHelper.from_rfc3339(hash['latest_deposit_date']) if hash['latest_deposit_date'])
                        else
                          SKIP
                        end
  created_on = if hash.key?('created_on')
                 (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on'])
               else
                 SKIP
               end
  latest_deposit_amount =
    hash.key?('latest_deposit_amount') ? hash['latest_deposit_amount'] : SKIP
  balance = hash.key?('balance') ? hash['balance'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  amount_difference =
    hash.key?('amount_difference') ? hash['amount_difference'] : SKIP
   = GenericMetadata.from_hash(hash['token_metadata']) if hash['token_metadata']
   = GenericMetadata.from_hash(hash['charge_metadata']) if
    hash['charge_metadata']

  # 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.
  BankTransferStatusData.new(id: id,
                             charge_id: charge_id,
                             payment_status: payment_status,
                             latest_deposit_date: latest_deposit_date,
                             created_on: created_on,
                             latest_deposit_amount: latest_deposit_amount,
                             balance: balance,
                             currency: currency,
                             amount: amount,
                             amount_difference: amount_difference,
                             token_metadata: ,
                             charge_metadata: ,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 64

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['charge_id'] = 'charge_id'
  @_hash['payment_status'] = 'payment_status'
  @_hash['latest_deposit_date'] = 'latest_deposit_date'
  @_hash['created_on'] = 'created_on'
  @_hash['latest_deposit_amount'] = 'latest_deposit_amount'
  @_hash['balance'] = 'balance'
  @_hash['currency'] = 'currency'
  @_hash['amount'] = 'amount'
  @_hash['amount_difference'] = 'amount_difference'
  @_hash['token_metadata'] = 'token_metadata'
  @_hash['charge_metadata'] = 'charge_metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



100
101
102
103
104
105
106
107
108
109
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 100

def self.nullables
  %w[
    id
    latest_deposit_date
    created_on
    latest_deposit_amount
    balance
    amount_difference
  ]
end

.optionalsObject

An array for optional fields



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 82

def self.optionals
  %w[
    id
    charge_id
    payment_status
    latest_deposit_date
    created_on
    latest_deposit_amount
    balance
    currency
    amount
    amount_difference
    token_metadata
    charge_metadata
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



197
198
199
200
201
202
203
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 197

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



217
218
219
220
221
222
223
224
225
226
227
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 217

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, charge_id: #{@charge_id.inspect}, payment_status:"\
  " #{@payment_status.inspect}, latest_deposit_date: #{@latest_deposit_date.inspect},"\
  " created_on: #{@created_on.inspect}, latest_deposit_amount:"\
  " #{@latest_deposit_amount.inspect}, balance: #{@balance.inspect}, currency:"\
  " #{@currency.inspect}, amount: #{@amount.inspect}, amount_difference:"\
  " #{@amount_difference.inspect}, token_metadata: #{@token_metadata.inspect},"\
  " charge_metadata: #{@charge_metadata.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_onObject



191
192
193
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 191

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_custom_latest_deposit_dateObject



187
188
189
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 187

def to_custom_latest_deposit_date
  DateTimeHelper.to_rfc3339(latest_deposit_date)
end

#to_sObject

Provides a human-readable string representation of the object.



206
207
208
209
210
211
212
213
214
# File 'lib/univapay_client_sdk/models/bank_transfer_status_data.rb', line 206

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, charge_id: #{@charge_id}, payment_status: #{@payment_status},"\
  " latest_deposit_date: #{@latest_deposit_date}, created_on: #{@created_on},"\
  " latest_deposit_amount: #{@latest_deposit_amount}, balance: #{@balance}, currency:"\
  " #{@currency}, amount: #{@amount}, amount_difference: #{@amount_difference},"\
  " token_metadata: #{@token_metadata}, charge_metadata: #{@charge_metadata},"\
  " additional_properties: #{@additional_properties}>"
end