Class: CyberSourceMergedSpec::PaymentInformation43

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/payment_information43.rb

Overview

PaymentInformation43 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(payment_type: SKIP, e_wallet: SKIP, customer: SKIP, card: SKIP, brands: SKIP, features: SKIP, invoice: SKIP, network: SKIP, issuer_information: SKIP, bank: SKIP, account_features: SKIP, payment_instrument: SKIP, instrument_identifier: SKIP, shipping_address: SKIP, fluid_data: SKIP, additional_properties: nil) ⇒ PaymentInformation43

Returns a new instance of PaymentInformation43.



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
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 119

def initialize(payment_type: SKIP, e_wallet: SKIP, customer: SKIP,
               card: SKIP, brands: SKIP, features: SKIP, invoice: SKIP,
               network: SKIP, issuer_information: SKIP, bank: SKIP,
               account_features: SKIP, payment_instrument: SKIP,
               instrument_identifier: SKIP, shipping_address: SKIP,
               fluid_data: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payment_type = payment_type unless payment_type == SKIP
  @e_wallet = e_wallet unless e_wallet == SKIP
  @customer = customer unless customer == SKIP
  @card = card unless card == SKIP
  @brands = brands unless brands == SKIP
  @features = features unless features == SKIP
  @invoice = invoice unless invoice == SKIP
  @network = network unless network == SKIP
  @issuer_information = issuer_information unless issuer_information == SKIP
  @bank = bank unless bank == SKIP
  @account_features =  unless  == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @fluid_data = fluid_data unless fluid_data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_featuresAccountFeatures3

This array contains the supported brands.

Returns:



54
55
56
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 54

def 
  @account_features
end

#bankBank15

This array contains the supported brands.

Returns:



50
51
52
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 50

def bank
  @bank
end

#brandsArray[Brand28]

This array contains the supported brands.

Returns:



30
31
32
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 30

def brands
  @brands
end

#cardCard131

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 26

def card
  @card
end

#customerCustomer63

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 22

def customer
  @customer
end

#e_walletEWallet5

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 18

def e_wallet
  @e_wallet
end

#featuresFeatures28

This array contains the supported brands.

Returns:



34
35
36
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 34

def features
  @features
end

#fluid_dataFluidData7

This array contains the supported brands.

Returns:



70
71
72
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 70

def fluid_data
  @fluid_data
end

#instrument_identifierInstrumentIdentifier37

This array contains the supported brands.



62
63
64
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 62

def instrument_identifier
  @instrument_identifier
end

#invoiceInvoice

This array contains the supported brands.

Returns:



38
39
40
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 38

def invoice
  @invoice
end

#issuer_informationIssuerInformation35

This array contains the supported brands.

Returns:



46
47
48
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 46

def issuer_information
  @issuer_information
end

#networkNetwork45

This array contains the supported brands.

Returns:



42
43
44
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 42

def network
  @network
end

#payment_instrumentPaymentInstrument4

This array contains the supported brands.

Returns:



58
59
60
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 58

def payment_instrument
  @payment_instrument
end

#payment_typePaymentType22

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 14

def payment_type
  @payment_type
end

#shipping_addressShippingAddress4

This array contains the supported brands.

Returns:



66
67
68
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 66

def shipping_address
  @shipping_address
end

Class Method Details

.from_element(root) ⇒ Object



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
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 207

def self.from_element(root)
  payment_type = XmlUtilities.from_element(root, 'PaymentType22',
                                           PaymentType22)
  e_wallet = XmlUtilities.from_element(root, 'EWallet5', EWallet5)
  customer = XmlUtilities.from_element(root, 'Customer63', Customer63)
  card = XmlUtilities.from_element(root, 'Card131', Card131)
  brands = XmlUtilities.from_element_to_array(root, 'Brand28', Brand28)
  features = XmlUtilities.from_element(root, 'Features28', Features28)
  invoice = XmlUtilities.from_element(root, 'Invoice', Invoice)
  network = XmlUtilities.from_element(root, 'Network45', Network45)
  issuer_information = XmlUtilities.from_element(root,
                                                 'IssuerInformation35',
                                                 IssuerInformation35)
  bank = XmlUtilities.from_element(root, 'Bank15', Bank15)
   = XmlUtilities.from_element(root, 'AccountFeatures3',
                                               AccountFeatures3)
  payment_instrument = XmlUtilities.from_element(root, 'PaymentInstrument4',
                                                 PaymentInstrument4)
  instrument_identifier = XmlUtilities.from_element(
    root, 'InstrumentIdentifier37', InstrumentIdentifier37
  )
  shipping_address = XmlUtilities.from_element(root, 'ShippingAddress4',
                                               ShippingAddress4)
  fluid_data = XmlUtilities.from_element(root, 'FluidData7', FluidData7)

  new(payment_type: payment_type,
      e_wallet: e_wallet,
      customer: customer,
      card: card,
      brands: brands,
      features: features,
      invoice: invoice,
      network: network,
      issuer_information: issuer_information,
      bank: bank,
      account_features: ,
      payment_instrument: payment_instrument,
      instrument_identifier: instrument_identifier,
      shipping_address: shipping_address,
      fluid_data: fluid_data,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 147

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_type = PaymentType22.from_hash(hash['paymentType']) if hash['paymentType']
  e_wallet = EWallet5.from_hash(hash['eWallet']) if hash['eWallet']
  customer = Customer63.from_hash(hash['customer']) if hash['customer']
  card = Card131.from_hash(hash['card']) if hash['card']
  # Parameter is an array, so we need to iterate through it
  brands = nil
  unless hash['brands'].nil?
    brands = []
    hash['brands'].each do |structure|
      brands << (Brand28.from_hash(structure) if structure)
    end
  end

  brands = SKIP unless hash.key?('brands')
  features = Features28.from_hash(hash['features']) if hash['features']
  invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
  network = Network45.from_hash(hash['network']) if hash['network']
  issuer_information = IssuerInformation35.from_hash(hash['issuerInformation']) if
    hash['issuerInformation']
  bank = Bank15.from_hash(hash['bank']) if hash['bank']
   = AccountFeatures3.from_hash(hash['accountFeatures']) if
    hash['accountFeatures']
  payment_instrument = PaymentInstrument4.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  instrument_identifier = InstrumentIdentifier37.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']
  shipping_address = ShippingAddress4.from_hash(hash['shippingAddress']) if
    hash['shippingAddress']
  fluid_data = FluidData7.from_hash(hash['fluidData']) if hash['fluidData']

  # 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.
  PaymentInformation43.new(payment_type: payment_type,
                           e_wallet: e_wallet,
                           customer: customer,
                           card: card,
                           brands: brands,
                           features: features,
                           invoice: invoice,
                           network: network,
                           issuer_information: issuer_information,
                           bank: bank,
                           account_features: ,
                           payment_instrument: payment_instrument,
                           instrument_identifier: instrument_identifier,
                           shipping_address: shipping_address,
                           fluid_data: fluid_data,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_type'] = 'paymentType'
  @_hash['e_wallet'] = 'eWallet'
  @_hash['customer'] = 'customer'
  @_hash['card'] = 'card'
  @_hash['brands'] = 'brands'
  @_hash['features'] = 'features'
  @_hash['invoice'] = 'invoice'
  @_hash['network'] = 'network'
  @_hash['issuer_information'] = 'issuerInformation'
  @_hash['bank'] = 'bank'
  @_hash['account_features'] = 'accountFeatures'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash['shipping_address'] = 'shippingAddress'
  @_hash['fluid_data'] = 'fluidData'
  @_hash
end

.nullablesObject

An array for nullable fields



115
116
117
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 115

def self.nullables
  []
end

.optionalsObject

An array for optional fields



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 94

def self.optionals
  %w[
    payment_type
    e_wallet
    customer
    card
    brands
    features
    invoice
    network
    issuer_information
    bank
    account_features
    payment_instrument
    instrument_identifier
    shipping_address
    fluid_data
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



292
293
294
295
296
297
298
299
300
301
302
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 292

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_type: #{@payment_type.inspect}, e_wallet: #{@e_wallet.inspect},"\
  " customer: #{@customer.inspect}, card: #{@card.inspect}, brands: #{@brands.inspect},"\
  " features: #{@features.inspect}, invoice: #{@invoice.inspect}, network:"\
  " #{@network.inspect}, issuer_information: #{@issuer_information.inspect}, bank:"\
  " #{@bank.inspect}, account_features: #{@account_features.inspect}, payment_instrument:"\
  " #{@payment_instrument.inspect}, instrument_identifier: #{@instrument_identifier.inspect},"\
  " shipping_address: #{@shipping_address.inspect}, fluid_data: #{@fluid_data.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



280
281
282
283
284
285
286
287
288
289
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 280

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_type: #{@payment_type}, e_wallet: #{@e_wallet}, customer:"\
  " #{@customer}, card: #{@card}, brands: #{@brands}, features: #{@features}, invoice:"\
  " #{@invoice}, network: #{@network}, issuer_information: #{@issuer_information}, bank:"\
  " #{@bank}, account_features: #{@account_features}, payment_instrument:"\
  " #{@payment_instrument}, instrument_identifier: #{@instrument_identifier},"\
  " shipping_address: #{@shipping_address}, fluid_data: #{@fluid_data}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/cyber_source_merged_spec/models/payment_information43.rb', line 250

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'PaymentType22', payment_type)
  XmlUtilities.add_as_subelement(doc, root, 'EWallet5', e_wallet)
  XmlUtilities.add_as_subelement(doc, root, 'Customer63', customer)
  XmlUtilities.add_as_subelement(doc, root, 'Card131', card)
  XmlUtilities.add_array_as_subelement(doc, root, 'Brand28', brands)
  XmlUtilities.add_as_subelement(doc, root, 'Features28', features)
  XmlUtilities.add_as_subelement(doc, root, 'Invoice', invoice)
  XmlUtilities.add_as_subelement(doc, root, 'Network45', network)
  XmlUtilities.add_as_subelement(doc, root, 'IssuerInformation35',
                                 issuer_information)
  XmlUtilities.add_as_subelement(doc, root, 'Bank15', bank)
  XmlUtilities.add_as_subelement(doc, root, 'AccountFeatures3',
                                 )
  XmlUtilities.add_as_subelement(doc, root, 'PaymentInstrument4',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'InstrumentIdentifier37',
                                 instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'ShippingAddress4',
                                 shipping_address)
  XmlUtilities.add_as_subelement(doc, root, 'FluidData7', fluid_data)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end