Class: CyberSourceMergedSpec::PaymentInformation38

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

Overview

PaymentInformation38 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(card: SKIP, tokenized_card: SKIP, customer: SKIP, payment_instrument: SKIP, instrument_identifier: SKIP, account_type: SKIP, additional_properties: nil) ⇒ PaymentInformation38

Returns a new instance of PaymentInformation38.



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

def initialize(card: SKIP, tokenized_card: SKIP, customer: SKIP,
               payment_instrument: SKIP, instrument_identifier: SKIP,
               account_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @card = card unless card == SKIP
  @tokenized_card = tokenized_card unless tokenized_card == SKIP
  @customer = customer unless customer == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @account_type =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_typeString

If supported, the accountType can specify what type of account is used by the issuer. Must be a valid value:

  • 00-Not applicable
  • 10-Saving account
  • 20-Checking account
  • 30-Credit card account
  • 40-Universal account

Returns:

  • (String)


40
41
42
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 40

def 
  @account_type
end

#cardCard127

TODO: Write general description for this method

Returns:



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

def card
  @card
end

#customerCustomer56

TODO: Write general description for this method

Returns:



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

def customer
  @customer
end

#instrument_identifierInstrumentIdentifier34

TODO: Write general description for this method



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

def instrument_identifier
  @instrument_identifier
end

#payment_instrumentPaymentInstrument23

TODO: Write general description for this method

Returns:



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

def payment_instrument
  @payment_instrument
end

#tokenized_cardTokenizedCard19

TODO: Write general description for this method

Returns:



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

def tokenized_card
  @tokenized_card
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  card = XmlUtilities.from_element(root, 'Card127', Card127)
  tokenized_card = XmlUtilities.from_element(root, 'TokenizedCard19',
                                             TokenizedCard19)
  customer = XmlUtilities.from_element(root, 'Customer56', Customer56)
  payment_instrument = XmlUtilities.from_element(root,
                                                 'PaymentInstrument23',
                                                 PaymentInstrument23)
  instrument_identifier = XmlUtilities.from_element(
    root, 'InstrumentIdentifier34', InstrumentIdentifier34
  )
   = XmlUtilities.from_element(root, 'accountType', String)

  new(card: card,
      tokenized_card: tokenized_card,
      customer: customer,
      payment_instrument: payment_instrument,
      instrument_identifier: instrument_identifier,
      account_type: ,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = Card127.from_hash(hash['card']) if hash['card']
  tokenized_card = TokenizedCard19.from_hash(hash['tokenizedCard']) if hash['tokenizedCard']
  customer = Customer56.from_hash(hash['customer']) if hash['customer']
  payment_instrument = PaymentInstrument23.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  instrument_identifier = InstrumentIdentifier34.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']
   = hash.key?('accountType') ? hash['accountType'] : 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.
  PaymentInformation38.new(card: card,
                           tokenized_card: tokenized_card,
                           customer: customer,
                           payment_instrument: payment_instrument,
                           instrument_identifier: instrument_identifier,
                           account_type: ,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['tokenized_card'] = 'tokenizedCard'
  @_hash['customer'] = 'customer'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash['account_type'] = 'accountType'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 55

def self.optionals
  %w[
    card
    tokenized_card
    customer
    payment_instrument
    instrument_identifier
    account_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



167
168
169
170
171
172
173
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 167

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}, tokenized_card: #{@tokenized_card.inspect},"\
  " customer: #{@customer.inspect}, payment_instrument: #{@payment_instrument.inspect},"\
  " instrument_identifier: #{@instrument_identifier.inspect}, account_type:"\
  " #{@account_type.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



158
159
160
161
162
163
164
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 158

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}, tokenized_card: #{@tokenized_card}, customer: #{@customer},"\
  " payment_instrument: #{@payment_instrument}, instrument_identifier:"\
  " #{@instrument_identifier}, account_type: #{@account_type}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/payment_information38.rb', line 139

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

  XmlUtilities.add_as_subelement(doc, root, 'Card127', card)
  XmlUtilities.add_as_subelement(doc, root, 'TokenizedCard19',
                                 tokenized_card)
  XmlUtilities.add_as_subelement(doc, root, 'Customer56', customer)
  XmlUtilities.add_as_subelement(doc, root, 'PaymentInstrument23',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'InstrumentIdentifier34',
                                 instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'accountType', )
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end