Class: CyberSourceMergedSpec::JapanPaymentOptions1

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

Overview

JapanPaymentOptions1 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_method: SKIP, bonuses: SKIP, installments: SKIP, first_billing_month: SKIP, bonus_amount: SKIP, bonus_month: SKIP, second_bonus_amount: SKIP, second_bonus_month: SKIP, additional_properties: nil) ⇒ JapanPaymentOptions1

Returns a new instance of JapanPaymentOptions1.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 83

def initialize(payment_method: SKIP, bonuses: SKIP, installments: SKIP,
               first_billing_month: SKIP, bonus_amount: SKIP,
               bonus_month: SKIP, second_bonus_amount: SKIP,
               second_bonus_month: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payment_method = payment_method unless payment_method == SKIP
  @bonuses = bonuses unless bonuses == SKIP
  @installments = installments unless installments == SKIP
  @first_billing_month = first_billing_month unless first_billing_month == SKIP
  @bonus_amount = bonus_amount unless bonus_amount == SKIP
  @bonus_month = bonus_month unless bonus_month == SKIP
  @second_bonus_amount = second_bonus_amount unless second_bonus_amount == SKIP
  @second_bonus_month = second_bonus_month unless second_bonus_month == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bonus_amountString

This field contains the bonus amount.

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 36

def bonus_amount
  @bonus_amount
end

#bonus_monthString

This field contains the Japan specific first bonus month.

Returns:

  • (String)


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

def bonus_month
  @bonus_month
end

#bonusesString

Field contains the number of bonuses.

Returns:

  • (String)


24
25
26
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 24

def bonuses
  @bonuses
end

#first_billing_monthString

Billing month in MM format.

Returns:

  • (String)


32
33
34
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 32

def first_billing_month
  @first_billing_month
end

#installmentsString

Number of Installments.

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 28

def installments
  @installments
end

#payment_methodString

This value is a 2-digit code indicating the payment method. Use Payment Method Code value that applies to the tranasction.

  • 10 (One-time payment)
  • 21, 22, 23, 24 (Bonus(one-time)payment)
  • 61 (Installment payment)
  • 31, 32, 33, 34 (Integrated (Bonus + Installment)payment)
  • 80 (Revolving payment)

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 20

def payment_method
  @payment_method
end

#second_bonus_amountString

Field contains the second bonus amount.

Returns:

  • (String)


44
45
46
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 44

def second_bonus_amount
  @second_bonus_amount
end

#second_bonus_monthString

Field contains the Japan specific second bonus month.

Returns:

  • (String)


48
49
50
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 48

def second_bonus_month
  @second_bonus_month
end

Class Method Details

.from_element(root) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 137

def self.from_element(root)
  payment_method = XmlUtilities.from_element(root, 'paymentMethod', String)
  bonuses = XmlUtilities.from_element(root, 'bonuses', String)
  installments = XmlUtilities.from_element(root, 'installments', String)
  first_billing_month = XmlUtilities.from_element(root, 'firstBillingMonth',
                                                  String)
  bonus_amount = XmlUtilities.from_element(root, 'bonusAmount', String)
  bonus_month = XmlUtilities.from_element(root, 'bonusMonth', String)
  second_bonus_amount = XmlUtilities.from_element(root, 'secondBonusAmount',
                                                  String)
  second_bonus_month = XmlUtilities.from_element(root, 'secondBonusMonth',
                                                 String)

  new(payment_method: payment_method,
      bonuses: bonuses,
      installments: installments,
      first_billing_month: first_billing_month,
      bonus_amount: bonus_amount,
      bonus_month: bonus_month,
      second_bonus_amount: second_bonus_amount,
      second_bonus_month: second_bonus_month,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_method = hash.key?('paymentMethod') ? hash['paymentMethod'] : SKIP
  bonuses = hash.key?('bonuses') ? hash['bonuses'] : SKIP
  installments = hash.key?('installments') ? hash['installments'] : SKIP
  first_billing_month =
    hash.key?('firstBillingMonth') ? hash['firstBillingMonth'] : SKIP
  bonus_amount = hash.key?('bonusAmount') ? hash['bonusAmount'] : SKIP
  bonus_month = hash.key?('bonusMonth') ? hash['bonusMonth'] : SKIP
  second_bonus_amount =
    hash.key?('secondBonusAmount') ? hash['secondBonusAmount'] : SKIP
  second_bonus_month =
    hash.key?('secondBonusMonth') ? hash['secondBonusMonth'] : 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.
  JapanPaymentOptions1.new(payment_method: payment_method,
                           bonuses: bonuses,
                           installments: installments,
                           first_billing_month: first_billing_month,
                           bonus_amount: bonus_amount,
                           bonus_month: bonus_month,
                           second_bonus_amount: second_bonus_amount,
                           second_bonus_month: second_bonus_month,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_method'] = 'paymentMethod'
  @_hash['bonuses'] = 'bonuses'
  @_hash['installments'] = 'installments'
  @_hash['first_billing_month'] = 'firstBillingMonth'
  @_hash['bonus_amount'] = 'bonusAmount'
  @_hash['bonus_month'] = 'bonusMonth'
  @_hash['second_bonus_amount'] = 'secondBonusAmount'
  @_hash['second_bonus_month'] = 'secondBonusMonth'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 65

def self.optionals
  %w[
    payment_method
    bonuses
    installments
    first_billing_month
    bonus_amount
    bonus_month
    second_bonus_amount
    second_bonus_month
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_method: #{@payment_method.inspect}, bonuses: #{@bonuses.inspect},"\
  " installments: #{@installments.inspect}, first_billing_month:"\
  " #{@first_billing_month.inspect}, bonus_amount: #{@bonus_amount.inspect}, bonus_month:"\
  " #{@bonus_month.inspect}, second_bonus_amount: #{@second_bonus_amount.inspect},"\
  " second_bonus_month: #{@second_bonus_month.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



182
183
184
185
186
187
188
189
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 182

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_method: #{@payment_method}, bonuses: #{@bonuses}, installments:"\
  " #{@installments}, first_billing_month: #{@first_billing_month}, bonus_amount:"\
  " #{@bonus_amount}, bonus_month: #{@bonus_month}, second_bonus_amount:"\
  " #{@second_bonus_amount}, second_bonus_month: #{@second_bonus_month},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/cyber_source_merged_spec/models/japan_payment_options1.rb', line 161

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

  XmlUtilities.add_as_subelement(doc, root, 'paymentMethod', payment_method)
  XmlUtilities.add_as_subelement(doc, root, 'bonuses', bonuses)
  XmlUtilities.add_as_subelement(doc, root, 'installments', installments)
  XmlUtilities.add_as_subelement(doc, root, 'firstBillingMonth',
                                 first_billing_month)
  XmlUtilities.add_as_subelement(doc, root, 'bonusAmount', bonus_amount)
  XmlUtilities.add_as_subelement(doc, root, 'bonusMonth', bonus_month)
  XmlUtilities.add_as_subelement(doc, root, 'secondBonusAmount',
                                 second_bonus_amount)
  XmlUtilities.add_as_subelement(doc, root, 'secondBonusMonth',
                                 second_bonus_month)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end