Class: UnivapayClientSdk::TransactionHistoryUserData

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

Overview

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.

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(type: SKIP, cardholder_name: SKIP, cardholder_email_address: SKIP, cardholder_phone_number: SKIP, customer_name: SKIP, convenience_store: SKIP, brand: SKIP, gateway: SKIP, service_provider: SKIP, refunds: SKIP, reason: SKIP, additional_properties: nil) ⇒ TransactionHistoryUserData

Returns a new instance of TransactionHistoryUserData.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 115

def initialize(type: SKIP, cardholder_name: SKIP,
               cardholder_email_address: SKIP,
               cardholder_phone_number: SKIP, customer_name: SKIP,
               convenience_store: SKIP, brand: SKIP, gateway: SKIP,
               service_provider: SKIP, refunds: SKIP, reason: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @cardholder_name = cardholder_name unless cardholder_name == SKIP
  @cardholder_email_address = cardholder_email_address unless cardholder_email_address == SKIP
  @cardholder_phone_number = cardholder_phone_number unless cardholder_phone_number == SKIP
  @customer_name = customer_name unless customer_name == SKIP
  @convenience_store = convenience_store unless convenience_store == SKIP
  @brand = brand unless brand == SKIP
  @gateway = gateway unless gateway == SKIP
  @service_provider = service_provider unless service_provider == SKIP
  @refunds = refunds unless refunds == SKIP
  @reason = reason unless reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#brandString

Raw brand identifier for the payment method. Present for every payment type; the value set is payment-type-specific (e.g. card brands for card/apple_pay, QR brands for qr_scan/qr_merchant, online-wallet brands for online, convenience-store brands for konbini, paidy for paidy rows). Nullable for qr_scan, qr_merchant, and online; always non-null for the other types.

Returns:

  • (String)


49
50
51
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 49

def brand
  @brand
end

#cardholder_email_addressString

Cardholder/customer email address. Present for every payment type except konbini's legacy alias fields; always non-null for bank_transfer rows, nullable for every other type.

Returns:

  • (String)


27
28
29
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 27

def cardholder_email_address
  @cardholder_email_address
end

#cardholder_nameString

Cardholder name. Present for card and apple_pay rows only.

Returns:

  • (String)


21
22
23
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 21

def cardholder_name
  @cardholder_name
end

#cardholder_phone_numberString

Cardholder phone number. Present for paidy rows only.

Returns:

  • (String)


31
32
33
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 31

def cardholder_phone_number
  @cardholder_phone_number
end

#convenience_storeString

Legacy duplicate of brand. Present for konbini rows only.

Returns:

  • (String)


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

def convenience_store
  @convenience_store
end

#customer_nameString

Customer name as entered at checkout. Present for konbini rows only (empty string when not provided).

Returns:

  • (String)


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

def customer_name
  @customer_name
end

#gatewayString

Raw gateway identifier that processed the payment. Present for every payment type.

Returns:

  • (String)


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

def gateway
  @gateway
end

#reasonTransactionHistoryRefundReason

Refund reason, or null when unset.



67
68
69
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 67

def reason
  @reason
end

#refundsArray[TransactionHistoryRefund]

Refunds issued against this charge. Present for charge rows only (type: charge); absent for refund rows.

Returns:



63
64
65
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 63

def refunds
  @refunds
end

#service_providerTransactionHistoryServiceProvider

Service provider, or null when not reported.



58
59
60
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 58

def service_provider
  @service_provider
end

#typeTransactionHistoryType

Whether this row represents a charge or a refund.



17
18
19
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 17

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
186
187
188
189
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 139

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  cardholder_name =
    hash.key?('cardholder_name') ? hash['cardholder_name'] : SKIP
  cardholder_email_address =
    hash.key?('cardholder_email_address') ? hash['cardholder_email_address'] : SKIP
  cardholder_phone_number =
    hash.key?('cardholder_phone_number') ? hash['cardholder_phone_number'] : SKIP
  customer_name = hash.key?('customer_name') ? hash['customer_name'] : SKIP
  convenience_store =
    hash.key?('convenience_store') ? hash['convenience_store'] : SKIP
  brand = hash.key?('brand') ? hash['brand'] : SKIP
  gateway = hash.key?('gateway') ? hash['gateway'] : SKIP
  service_provider =
    hash.key?('service_provider') ? hash['service_provider'] : SKIP
  # Parameter is an array, so we need to iterate through it
  refunds = nil
  unless hash['refunds'].nil?
    refunds = []
    hash['refunds'].each do |structure|
      refunds << (TransactionHistoryRefund.from_hash(structure) if structure)
    end
  end

  refunds = SKIP unless hash.key?('refunds')
  reason = hash.key?('reason') ? hash['reason'] : 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.
  TransactionHistoryUserData.new(type: type,
                                 cardholder_name: cardholder_name,
                                 cardholder_email_address: cardholder_email_address,
                                 cardholder_phone_number: cardholder_phone_number,
                                 customer_name: customer_name,
                                 convenience_store: convenience_store,
                                 brand: brand,
                                 gateway: gateway,
                                 service_provider: service_provider,
                                 refunds: refunds,
                                 reason: reason,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 70

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['cardholder_name'] = 'cardholder_name'
  @_hash['cardholder_email_address'] = 'cardholder_email_address'
  @_hash['cardholder_phone_number'] = 'cardholder_phone_number'
  @_hash['customer_name'] = 'customer_name'
  @_hash['convenience_store'] = 'convenience_store'
  @_hash['brand'] = 'brand'
  @_hash['gateway'] = 'gateway'
  @_hash['service_provider'] = 'service_provider'
  @_hash['refunds'] = 'refunds'
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



104
105
106
107
108
109
110
111
112
113
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 104

def self.nullables
  %w[
    cardholder_email_address
    cardholder_phone_number
    brand
    gateway
    service_provider
    reason
  ]
end

.optionalsObject

An array for optional fields



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 87

def self.optionals
  %w[
    type
    cardholder_name
    cardholder_email_address
    cardholder_phone_number
    customer_name
    convenience_store
    brand
    gateway
    service_provider
    refunds
    reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
210
211
212
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 203

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, cardholder_name: #{@cardholder_name.inspect},"\
  " cardholder_email_address: #{@cardholder_email_address.inspect}, cardholder_phone_number:"\
  " #{@cardholder_phone_number.inspect}, customer_name: #{@customer_name.inspect},"\
  " convenience_store: #{@convenience_store.inspect}, brand: #{@brand.inspect}, gateway:"\
  " #{@gateway.inspect}, service_provider: #{@service_provider.inspect}, refunds:"\
  " #{@refunds.inspect}, reason: #{@reason.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



192
193
194
195
196
197
198
199
200
# File 'lib/univapay_client_sdk/models/transaction_history_user_data.rb', line 192

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, cardholder_name: #{@cardholder_name},"\
  " cardholder_email_address: #{@cardholder_email_address}, cardholder_phone_number:"\
  " #{@cardholder_phone_number}, customer_name: #{@customer_name}, convenience_store:"\
  " #{@convenience_store}, brand: #{@brand}, gateway: #{@gateway}, service_provider:"\
  " #{@service_provider}, refunds: #{@refunds}, reason: #{@reason}, additional_properties:"\
  " #{@additional_properties}>"
end