Class: PaysecureApiDocumentationLive::Data2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/models/data2.rb

Overview

Data2 Model.

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(transaction_id:, merchant_reference:, customer_id:, amount:, currency:, status:, session_id:, email:, merchant_name:, payment_method:, payment_flow:, issuing_bank:, created_at:, error_reason:, last_updated_at:, transaction_type:, fees:, metadata:, additional_properties: nil) ⇒ Data2

Returns a new instance of Data2.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 118

def initialize(transaction_id:, merchant_reference:, customer_id:, amount:,
               currency:, status:, session_id:, email:, merchant_name:,
               payment_method:, payment_flow:, issuing_bank:, created_at:,
               error_reason:, last_updated_at:, transaction_type:, fees:,
               metadata:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transaction_id = transaction_id
  @merchant_reference = merchant_reference
  @customer_id = customer_id
  @amount = amount
  @currency = currency
  @status = status
  @session_id = session_id
  @email = email
  @merchant_name = merchant_name
  @payment_method = payment_method
  @payment_flow = payment_flow
  @issuing_bank = issuing_bank
  @created_at = created_at
  @error_reason = error_reason
  @last_updated_at = last_updated_at
  @transaction_type = transaction_type
  @fees = fees
  @metadata = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


26
27
28
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 26

def amount
  @amount
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 62

def created_at
  @created_at
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 30

def currency
  @currency
end

#customer_idString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 22

def customer_id
  @customer_id
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 42

def email
  @email
end

#error_reasonString

TODO: Write general description for this method

Returns:

  • (String)


66
67
68
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 66

def error_reason
  @error_reason
end

#feesArray[Fee]

TODO: Write general description for this method

Returns:



78
79
80
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 78

def fees
  @fees
end

#issuing_bankString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 58

def issuing_bank
  @issuing_bank
end

#last_updated_atString

TODO: Write general description for this method

Returns:

  • (String)


70
71
72
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 70

def last_updated_at
  @last_updated_at
end

#merchant_nameString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 46

def merchant_name
  @merchant_name
end

#merchant_referenceString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 18

def merchant_reference
  @merchant_reference
end

#metadataMetadata

TODO: Write general description for this method

Returns:



82
83
84
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 82

def 
  @metadata
end

#payment_flowString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 54

def payment_flow
  @payment_flow
end

#payment_methodString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 50

def payment_method
  @payment_method
end

#session_idString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 38

def session_id
  @session_id
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 34

def status
  @status
end

#transaction_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 14

def transaction_id
  @transaction_id
end

#transaction_typeString

TODO: Write general description for this method

Returns:

  • (String)


74
75
76
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 74

def transaction_type
  @transaction_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 148

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  merchant_reference =
    hash.key?('merchant_reference') ? hash['merchant_reference'] : nil
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  session_id = hash.key?('session_id') ? hash['session_id'] : nil
  email = hash.key?('email') ? hash['email'] : nil
  merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : nil
  payment_method =
    hash.key?('payment_method') ? hash['payment_method'] : nil
  payment_flow = hash.key?('payment_flow') ? hash['payment_flow'] : nil
  issuing_bank = hash.key?('issuing_bank') ? hash['issuing_bank'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  error_reason = hash.key?('error_reason') ? hash['error_reason'] : nil
  last_updated_at =
    hash.key?('last_updated_at') ? hash['last_updated_at'] : nil
  transaction_type =
    hash.key?('transaction_type') ? hash['transaction_type'] : nil
  # Parameter is an array, so we need to iterate through it
  fees = nil
  unless hash['fees'].nil?
    fees = []
    hash['fees'].each do |structure|
      fees << (Fee.from_hash(structure) if structure)
    end
  end

  fees = nil unless hash.key?('fees')
   = Metadata.from_hash(hash['metadata']) if hash['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.
  Data2.new(transaction_id: transaction_id,
            merchant_reference: merchant_reference,
            customer_id: customer_id,
            amount: amount,
            currency: currency,
            status: status,
            session_id: session_id,
            email: email,
            merchant_name: merchant_name,
            payment_method: payment_method,
            payment_flow: payment_flow,
            issuing_bank: issuing_bank,
            created_at: created_at,
            error_reason: error_reason,
            last_updated_at: last_updated_at,
            transaction_type: transaction_type,
            fees: fees,
            metadata: ,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 85

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['merchant_reference'] = 'merchant_reference'
  @_hash['customer_id'] = 'customer_id'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['status'] = 'status'
  @_hash['session_id'] = 'session_id'
  @_hash['email'] = 'email'
  @_hash['merchant_name'] = 'merchant_name'
  @_hash['payment_method'] = 'payment_method'
  @_hash['payment_flow'] = 'payment_flow'
  @_hash['issuing_bank'] = 'issuing_bank'
  @_hash['created_at'] = 'created_at'
  @_hash['error_reason'] = 'error_reason'
  @_hash['last_updated_at'] = 'last_updated_at'
  @_hash['transaction_type'] = 'transaction_type'
  @_hash['fees'] = 'fees'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



114
115
116
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 114

def self.nullables
  []
end

.optionalsObject

An array for optional fields



109
110
111
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 109

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 228

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id.inspect}, merchant_reference:"\
  " #{@merchant_reference.inspect}, customer_id: #{@customer_id.inspect}, amount:"\
  " #{@amount.inspect}, currency: #{@currency.inspect}, status: #{@status.inspect},"\
  " session_id: #{@session_id.inspect}, email: #{@email.inspect}, merchant_name:"\
  " #{@merchant_name.inspect}, payment_method: #{@payment_method.inspect}, payment_flow:"\
  " #{@payment_flow.inspect}, issuing_bank: #{@issuing_bank.inspect}, created_at:"\
  " #{@created_at.inspect}, error_reason: #{@error_reason.inspect}, last_updated_at:"\
  " #{@last_updated_at.inspect}, transaction_type: #{@transaction_type.inspect}, fees:"\
  " #{@fees.inspect}, metadata: #{@metadata.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



215
216
217
218
219
220
221
222
223
224
225
# File 'lib/paysecure_api_documentation_live/models/data2.rb', line 215

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id}, merchant_reference:"\
  " #{@merchant_reference}, customer_id: #{@customer_id}, amount: #{@amount}, currency:"\
  " #{@currency}, status: #{@status}, session_id: #{@session_id}, email: #{@email},"\
  " merchant_name: #{@merchant_name}, payment_method: #{@payment_method}, payment_flow:"\
  " #{@payment_flow}, issuing_bank: #{@issuing_bank}, created_at: #{@created_at},"\
  " error_reason: #{@error_reason}, last_updated_at: #{@last_updated_at}, transaction_type:"\
  " #{@transaction_type}, fees: #{@fees}, metadata: #{@metadata}, additional_properties:"\
  " #{@additional_properties}>"
end