Class: UnivapayClientSdk::TransactionHistoryItem

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

Overview

A single charge or refund row in the merchant's transaction history.

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(store_id: SKIP, resource_id: SKIP, charge_id: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, type: SKIP, status: SKIP, metadata: SKIP, created_on: SKIP, mode: SKIP, merchant_name: SKIP, store_name: SKIP, payment_type: SKIP, user_data: SKIP, bank_transfer_payment_status: SKIP, bank_transfer_latest_deposit_date: SKIP, mcp_token_id: SKIP, charge_type: SKIP, additional_properties: nil) ⇒ TransactionHistoryItem

Returns a new instance of TransactionHistoryItem.



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
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 161

def initialize(store_id: SKIP, resource_id: SKIP, charge_id: SKIP,
               amount: SKIP, currency: SKIP, amount_formatted: SKIP,
               type: SKIP, status: SKIP, metadata: SKIP, created_on: SKIP,
               mode: SKIP, merchant_name: SKIP, store_name: SKIP,
               payment_type: SKIP, user_data: SKIP,
               bank_transfer_payment_status: SKIP,
               bank_transfer_latest_deposit_date: SKIP, mcp_token_id: SKIP,
               charge_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @store_id = store_id unless store_id == SKIP
  @resource_id = resource_id unless resource_id == SKIP
  @charge_id = charge_id unless charge_id == SKIP
  @amount = amount unless amount == SKIP
  @currency = currency unless currency == SKIP
  @amount_formatted = amount_formatted unless amount_formatted == SKIP
  @type = type unless type == SKIP
  @status = status unless status == SKIP
  @metadata =  unless  == SKIP
  @created_on = created_on unless created_on == SKIP
  @mode = mode unless mode == SKIP
  @merchant_name = merchant_name unless merchant_name == SKIP
  @store_name = store_name unless store_name == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @user_data = user_data unless user_data == SKIP
  unless bank_transfer_payment_status == SKIP
    @bank_transfer_payment_status =
      bank_transfer_payment_status
  end
  unless bank_transfer_latest_deposit_date == SKIP
    @bank_transfer_latest_deposit_date =
      bank_transfer_latest_deposit_date
  end
  @mcp_token_id = mcp_token_id unless mcp_token_id == SKIP
  @charge_type = charge_type unless charge_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Amount, in the currency's minor unit.

Returns:

  • (Integer)


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

def amount
  @amount
end

#amount_formattedFloat

Amount, formatted per the currency's display scale.

Returns:

  • (Float)


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

def amount_formatted
  @amount_formatted
end

#bank_transfer_latest_deposit_dateDateTime

Timestamp of the most recent deposit matched against a bank transfer charge. null when not applicable.

Returns:

  • (DateTime)


88
89
90
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 88

def bank_transfer_latest_deposit_date
  @bank_transfer_latest_deposit_date
end

#bank_transfer_payment_statusBankTransferPaymentStatus

Bank transfer payment status, or null when not applicable.



83
84
85
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 83

def bank_transfer_payment_status
  @bank_transfer_payment_status
end

#charge_idUUID | String

ID of the originating charge. null for charge rows; set for refund rows.

Returns:

  • (UUID | String)


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

def charge_id
  @charge_id
end

#charge_typeTransactionHistoryChargeType

Charge type, or null when not applicable.



97
98
99
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 97

def charge_type
  @charge_type
end

#created_onDateTime

Timestamp when the underlying resource was created.

Returns:

  • (DateTime)


54
55
56
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 54

def created_on
  @created_on
end

#currencyString

ISO-4217 currency code.

Returns:

  • (String)


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

def currency
  @currency
end

#mcp_token_idUUID | String

ID of the multi-currency-pricing token used, when applicable. null when not applicable.

Returns:

  • (UUID | String)


93
94
95
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 93

def mcp_token_id
  @mcp_token_id
end

#merchant_nameString

Merchant display name.

Returns:

  • (String)


64
65
66
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 64

def merchant_name
  @merchant_name
end

#metadataGenericMetadata

A free-form dictionary for custom metadata.

Returns:



50
51
52
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 50

def 
  @metadata
end

#modeTransactionHistoryMode

Environment mode: live and test reflect the credential used to authenticate, while live_test is reserved for privileged callers testing against live-mode data.



60
61
62
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 60

def mode
  @mode
end

#payment_typeTransactionHistoryPaymentType

The payment method used for the underlying charge.



72
73
74
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 72

def payment_type
  @payment_type
end

#resource_idUUID | String

ID of the underlying resource — a charge ID for charge rows, a refund ID for refund rows.

Returns:

  • (UUID | String)


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

def resource_id
  @resource_id
end

#statusTransactionHistoryStatus

Status of the underlying resource. Charge rows use the full set of values; refund rows only ever report pending, successful, failed, or error.



46
47
48
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 46

def status
  @status
end

#store_idUUID | String

Store identifier.

Returns:

  • (UUID | String)


15
16
17
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 15

def store_id
  @store_id
end

#store_nameString

Store display name.

Returns:

  • (String)


68
69
70
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 68

def store_name
  @store_name
end

#typeTransactionHistoryType

Whether this row represents a charge or a refund.



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

def type
  @type
end

#user_dataTransactionHistoryUserData

Payment-type-specific details for this row. This is a single flat object covering every payment type — the fields actually populated depend on payment_type (documented per field below). Fields not applicable to a given payment type are omitted.



79
80
81
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 79

def user_data
  @user_data
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 201

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  store_id = hash.key?('store_id') ? hash['store_id'] : SKIP
  resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
  charge_id = hash.key?('charge_id') ? hash['charge_id'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  amount_formatted =
    hash.key?('amount_formatted') ? hash['amount_formatted'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
   = GenericMetadata.from_hash(hash['metadata']) if hash['metadata']
  created_on = if hash.key?('created_on')
                 (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on'])
               else
                 SKIP
               end
  mode = hash.key?('mode') ? hash['mode'] : SKIP
  merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP
  store_name = hash.key?('store_name') ? hash['store_name'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
  user_data = TransactionHistoryUserData.from_hash(hash['user_data']) if hash['user_data']
  bank_transfer_payment_status =
    hash.key?('bank_transfer_payment_status') ? hash['bank_transfer_payment_status'] : SKIP
  bank_transfer_latest_deposit_date = if hash.key?('bank_transfer_latest_deposit_date')
                                        (DateTimeHelper.from_rfc3339(hash['bank_transfer_latest_deposit_date']) if hash['bank_transfer_latest_deposit_date'])
                                      else
                                        SKIP
                                      end
  mcp_token_id = hash.key?('mcp_token_id') ? hash['mcp_token_id'] : SKIP
  charge_type = hash.key?('charge_type') ? hash['charge_type'] : SKIP

  # 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.
  TransactionHistoryItem.new(store_id: store_id,
                             resource_id: resource_id,
                             charge_id: charge_id,
                             amount: amount,
                             currency: currency,
                             amount_formatted: amount_formatted,
                             type: type,
                             status: status,
                             metadata: ,
                             created_on: created_on,
                             mode: mode,
                             merchant_name: merchant_name,
                             store_name: store_name,
                             payment_type: payment_type,
                             user_data: user_data,
                             bank_transfer_payment_status: bank_transfer_payment_status,
                             bank_transfer_latest_deposit_date: bank_transfer_latest_deposit_date,
                             mcp_token_id: mcp_token_id,
                             charge_type: charge_type,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 100

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['store_id'] = 'store_id'
  @_hash['resource_id'] = 'resource_id'
  @_hash['charge_id'] = 'charge_id'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['amount_formatted'] = 'amount_formatted'
  @_hash['type'] = 'type'
  @_hash['status'] = 'status'
  @_hash['metadata'] = 'metadata'
  @_hash['created_on'] = 'created_on'
  @_hash['mode'] = 'mode'
  @_hash['merchant_name'] = 'merchant_name'
  @_hash['store_name'] = 'store_name'
  @_hash['payment_type'] = 'payment_type'
  @_hash['user_data'] = 'user_data'
  @_hash['bank_transfer_payment_status'] = 'bank_transfer_payment_status'
  @_hash['bank_transfer_latest_deposit_date'] =
    'bank_transfer_latest_deposit_date'
  @_hash['mcp_token_id'] = 'mcp_token_id'
  @_hash['charge_type'] = 'charge_type'
  @_hash
end

.nullablesObject

An array for nullable fields



151
152
153
154
155
156
157
158
159
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 151

def self.nullables
  %w[
    charge_id
    bank_transfer_payment_status
    bank_transfer_latest_deposit_date
    mcp_token_id
    charge_type
  ]
end

.optionalsObject

An array for optional fields



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 126

def self.optionals
  %w[
    store_id
    resource_id
    charge_id
    amount
    currency
    amount_formatted
    type
    status
    metadata
    created_on
    mode
    merchant_name
    store_name
    payment_type
    user_data
    bank_transfer_payment_status
    bank_transfer_latest_deposit_date
    mcp_token_id
    charge_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 288

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} store_id: #{@store_id.inspect}, resource_id: #{@resource_id.inspect},"\
  " charge_id: #{@charge_id.inspect}, amount: #{@amount.inspect}, currency:"\
  " #{@currency.inspect}, amount_formatted: #{@amount_formatted.inspect}, type:"\
  " #{@type.inspect}, status: #{@status.inspect}, metadata: #{@metadata.inspect}, created_on:"\
  " #{@created_on.inspect}, mode: #{@mode.inspect}, merchant_name: #{@merchant_name.inspect},"\
  " store_name: #{@store_name.inspect}, payment_type: #{@payment_type.inspect}, user_data:"\
  " #{@user_data.inspect}, bank_transfer_payment_status:"\
  " #{@bank_transfer_payment_status.inspect}, bank_transfer_latest_deposit_date:"\
  " #{@bank_transfer_latest_deposit_date.inspect}, mcp_token_id: #{@mcp_token_id.inspect},"\
  " charge_type: #{@charge_type.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_bank_transfer_latest_deposit_dateObject



269
270
271
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 269

def to_custom_bank_transfer_latest_deposit_date
  DateTimeHelper.to_rfc3339(bank_transfer_latest_deposit_date)
end

#to_custom_created_onObject



265
266
267
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 265

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_sObject

Provides a human-readable string representation of the object.



274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/univapay_client_sdk/models/transaction_history_item.rb', line 274

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} store_id: #{@store_id}, resource_id: #{@resource_id}, charge_id:"\
  " #{@charge_id}, amount: #{@amount}, currency: #{@currency}, amount_formatted:"\
  " #{@amount_formatted}, type: #{@type}, status: #{@status}, metadata: #{@metadata},"\
  " created_on: #{@created_on}, mode: #{@mode}, merchant_name: #{@merchant_name}, store_name:"\
  " #{@store_name}, payment_type: #{@payment_type}, user_data: #{@user_data},"\
  " bank_transfer_payment_status: #{@bank_transfer_payment_status},"\
  " bank_transfer_latest_deposit_date: #{@bank_transfer_latest_deposit_date}, mcp_token_id:"\
  " #{@mcp_token_id}, charge_type: #{@charge_type}, additional_properties:"\
  " #{@additional_properties}>"
end